Ano*_*j P 2 php codeigniter paypal payment-gateway
我目前正在我的网站中集成贝宝定期付款流程。在我的网站中,用户可以选择取消他的贝宝定期付款。我有每个用户的 payer_id 和 payer_email。是否可以使用这些详细信息取消定期付款。如果没有,如果特定用户从我的网站点击取消定期付款,我如何取消定期付款。
谢谢你。
小智 5
您可以使用 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));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4651 次 |
| 最近记录: |