Chargify更新订阅

时间:2015-10-13 14:31:29

标签: php curl chargify

$ch = curl_init("https://test.chargify.com/subscriptions/10441751.json");

$data = array(
    'subscription' => array(
        'customer' => array(
            'address' => "test123"
        )
    )
);

$data = json_encode($data);

curl_setopt_array($ch, array(
  CURLOPT_USERPWD => "xxx:x", // assume this is correct
  CURLOPT_RETURNTRANSFER => 1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => $data,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data)
  )
));

$output = curl_exec($ch);
curl_close($ch);

我一直试图更新chargify订阅。 cURL调用的输出完全相同。客户地址不会改变。关于什么可能出错的任何想法?

1 个答案:

答案 0 :(得分:0)

您似乎无法从subscriptions.json更新客户信息。我必须从订阅中提取客户ID,然后通过https://test.chargify.com/customers/XXX.json

更新客户信息