我正在使用https://github.com/jforrest/Chargify-PHP-Client中描述的php chargify连接器,我想更新订阅的next_billing_at参数。我尝试这样做:
$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();
}
但是虽然没有验证例外,但是当我在之后检查下一个评估日期时,它会保持不变:
$subscriptionUpdated = $connector->getSubscriptionsByID($thisSubscriptionID);
$newBillingDate = $subscriptionUpdated->next_assessment_at;
echo "new next billing date is $newBillingDate<br>";
我尝试将日期作为'2013-04-20'传递,但这也不起作用。是否可以使用API更新chargify中的开票日期?
答案 0 :(得分:2)
你有正确的想法,除了你的数组应该是这样的:
$requestArr = array(
'subscription' => array(
'customer_id' => $thisCustomerID,
'next_billing_at' => '2013-04-20'
)
);
然后你应该好(测试)
参考:http://docs.chargify.com/api-subscriptions#api-usage-json-subscriptions-update