我雇了一个人给我编码一些代码,取消PayPal API中的定期付款,如下所示:
function change_subscription_status( $profile_id, $action ) {
$api_request = 'USER=' . urlencode( 'xxxxxxxxxxxxxxx' )
. '&PWD=' . urlencode( 'xxxxxxxxxxxxxxx' )
. '&SIGNATURE=' . urlencode( 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' )
. '&VERSION=76.0'
. '&METHOD=ManageRecurringPaymentsProfileStatus'
. '&PROFILEID=' . urlencode( $profile_id )
. '&ACTION=' . urlencode( $action )
. '&NOTE=' . urlencode( 'Plan cancelled in application' );
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, 'https://api-3t.paypal.com/nvp' );
[...]
PayPal API 有没有办法同时退还 X.XX 金额?
基本上,我想取消每月 10 美元的重复交易,如果客户使用该软件 15 天,则退款 5 美元。
是的,您只需构建 RefundTransaction 请求,就像构建 ManageRecurringPaymentsProfileStatus 请求一样,并在脚本中背靠背运行它们。