Jako
Jako

Reputation: 4901

Chargify Update Subscription

$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);

I'm stuck trying to update a chargify subscription. The output from the cURL call is the exact same. The customer address does not change. Any ideas on what could be wrong?

Upvotes: 1

Views: 148

Answers (1)

Jako
Jako

Reputation: 4901

It appears you can't update the customer information from the subscriptions.json. I had to pull the customer ID from the subscription then update the customer info through https://test.chargify.com/customers/XXX.json

Upvotes: 0

Related Questions