I'm using the php chargify connector described at https://github.com/jforrest/Chargify-PHP-Client and I would like to update the next_billing_at parameter of a subscription. I tried doing it like this:
$requestArr = array('customer_id'=>"$thisCustomerID",'next_billing_at' => '2013-04-20T02:52:17-04:00');
try {
$connector->requestUpdateSubscription($thisSubscriptionID, json_encode($requestArr), $format = 'JSON');
} catch (ChargifyValidationException $cve) {
//process error handling code here.
echo $cve->getMessage();
}
But although there are no validation exceptions, when I check the next assessment date right afterwards it is unchanged:
$subscriptionUpdated = $connector->getSubscriptionsByID($thisSubscriptionID);
$newBillingDate = $subscriptionUpdated->next_assessment_at;
echo "new next billing date is $newBillingDate<br>";
I tried passing the date as just '2013-04-20' but that didn't work either. Is it possible to update the billing dates in chargify using the API?
You've got the right idea, except your array should look like:
$requestArr = array(
'subscription' => array(
'customer_id' => $thisCustomerID,
'next_billing_at' => '2013-04-20'
)
);
and then you should be good (tested)
reference: http://docs.chargify.com/api-subscriptions#api-usage-json-subscriptions-update