【问题标题】:Cancel Paypal Recurring payments取消 Paypal 定期付款
【发布时间】:2013-03-04 06:57:51
【问题描述】:

我目前正在我的网站中集成 paypal 定期付款流程。在我的网站中,用户可以选择取消他的 paypal 定期付款。我有每个用户的 payer_id 和 payer_email。是否可以使用这些详细信息取消定期付款。如果没有,如果特定用户单击取消我网站的定期付款,我如何取消定期选项。

谢谢。

【问题讨论】:

    标签: php codeigniter paypal payment-gateway


    【解决方案1】:

    您可以使用 ManageRecurringPaymentsProfileStatus API 暂停或取消配置文件。

    注意this reference。这专门用于快速结帐,但也适用于其他贝宝集成。

    这也已在此处得到解答,以供将来参考:Can you cancel a PayPal automatic payment via API? (Subscription created via Hosted button)

    【讨论】:

      【解决方案2】:

      您可以使用 PROFILE_ID 取消您的所有 paypal 定期资料。并使用您的定期付款配置文件 ID 执行此代码。希望对您有所帮助。

      <?php
      $curl = curl_init();
      
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($curl, CURLOPT_POST, true);
      curl_setopt($curl, CURLOPT_URL, 'https://api-3t.sandbox.paypal.com/nvp');
      curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query(array(
          'USER' => 'XXXXXXXXXXX',  //Your API User
          'PWD' => 'XXXXXXXXXXXXX',  //Your API Password
          'SIGNATURE' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',   //Your API Signature
      
          'VERSION' => '108',
          'METHOD' => 'ManageRecurringPaymentsProfileStatus',
          'PROFILEID' => 'I-315LHdijsju',         //here add your profile id                      
          'ACTION'    => 'Cancel' //this can be selected in these default paypal variables (Suspend, Cancel, Reactivate)
      )));
      
      $response =    curl_exec($curl);
      
      curl_close($curl);
      
      $nvp = array();
      
      if (preg_match_all('/(?<name>[^\=]+)\=(?<value>[^&]+)&?/', $response, $matches)) {
          foreach ($matches['name'] as $offset => $name) {
              $nvp[$name] = urldecode($matches['value'][$offset]);
          }
      }
      
      printf("<pre>%s</pre>",print_r($nvp, true));
      

      【讨论】:

      • 此代码在第一次运行时为我工作。只需更改参数即可。
      猜你喜欢
      • 2013-12-21
      • 2017-03-09
      • 2015-05-01
      • 2013-06-09
      • 2012-05-26
      • 2012-09-10
      • 2020-01-03
      • 2013-02-15
      相关资源
      最近更新 更多