【问题标题】:How to cancel the Paypal Billing Agreement using REST API with PHP code如何使用带有 PHP 代码的 REST API 取消 Paypal 计费协议
【发布时间】:2017-06-28 14:25:42
【问题描述】:

http://paypal.github.io/PayPal-PHP-SDK/sample/ 所述,我们已在我们的网站中实施“计费计划和协议”。

我们已实施每周定期付款,只想通过 API 取消结算协议。

【问题讨论】:

  • 它位于结算计划和协议下的那个链接上,即“暂停协议”选项。 Details here.

标签: php payment-gateway paypal-rest-sdk paypal-subscriptions


【解决方案1】:

您需要创建一个Agreement & AgreementStateDescriptor 的对象,并使用Agreement 的对象调用cancel() 方法。下面是使用 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) {                  
        }

【讨论】:

  • 这不起作用,因为订阅必须首先处于非活动状态。
猜你喜欢
  • 2015-11-01
  • 2014-12-08
  • 2015-03-07
  • 2018-12-01
  • 2014-10-28
  • 2014-11-09
  • 2017-06-21
  • 1970-01-01
  • 2017-08-24
相关资源
最近更新 更多