取消Paypal定期付款

问题描述:

我目前在我的网站中整合了paypal定期付款流程。我的网站用户可以选择取消他的paypal定期付款。我有每个用户的payer_id和payer_email。是否有可能取消这些细节的定期付款。如果不是,如果特定用户点击取消我的网站的定期付款,我如何取消定期选项。取消Paypal定期付款

谢谢。

您可以使用ManageRecurringPaymentsProfileStatus API挂起或取消配置文件。

注意this reference。这是特别为快速结账,但它将适用于其他贝宝集成。

这也已经在这里找到答案,以供将来参考:Can you cancel a PayPal automatic payment via API? (Subscription created via Hosted button)

你可以取消所有你的PayPal经常性配置文件与PROFILE_ID。并使用您的定期付款资料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));