如何使用带有 PHP 代码的 REST API 取消 Paypal 计费协议 [英] How to cancel the Paypal Billing Agreement using REST API with PHP code
本文介绍了如何使用带有 PHP 代码的 REST API 取消 Paypal 计费协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如中所述,我们已在我们的网站中实施了计费计划和协议"http://paypal.github.io/PayPal-PHP-SDK/sample/.
我们已经实施了每周定期付款,只是想通过 API 取消结算协议.
We have implemented weekly recurring payment and just want to cancel the billing agreement through the API.
推荐答案
您需要创建一个协议对象&AgreementStateDescriptor 和使用Agreement 对象调用cancel() 方法.下面是使用 PHP 的代码示例.
You need to create a object of Agreement & AgreementStateDescriptor and using object of Agreement call the cancel() method. Below is the code example using PHP.
$agreementId = "I-ABACAGAH";
$agreement = new Agreement();
$agreement->setId($agreementId);
$agreementStateDescriptor = new AgreementStateDescriptor();
$agreementStateDescriptor->setNote("Cancel the agreement");
try {
$agreement->cancel($agreementStateDescriptor, $this->_apiContext);
$cancelAgreementDetails = Agreement::get($agreement->getId(), $this->_apiContext);
} catch (Exception $ex) {
}
这篇关于如何使用带有 PHP 代码的 REST API 取消 Paypal 计费协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文