【问题标题】:How to update chargify next_billing_at value using php api?如何使用 php api 更新 chargify next_billing_at 值?
【发布时间】:2013-02-23 01:13:39
【问题描述】:

我正在使用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 中的计费日期?

【问题讨论】:

    标签: php api subscription billing chargify


    【解决方案1】:

    你的想法是对的,除了你的数组应该是这样的:

    $requestArr = array(
        'subscription' => array(
            'customer_id' => $thisCustomerID,
            'next_billing_at' => '2013-04-20'
        )
    );
    

    然后你应该很好(经过测试)

    参考:http://docs.chargify.com/api-subscriptions#api-usage-json-subscriptions-update

    【讨论】:

    • 耶!谢谢詹姆斯!我刚刚将上面的第一行更改为 $requestArr['subscription'] = array('customer_id'=>"$thisCustomerID",'next_billing_at' => '2013-04-20T02:52:17-04:00');它工作得很好。 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-06
    • 2017-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多