Paypal定期付款-立即收费



我正在使用Paypal API,并且我想创建定期付款,第一笔金额应该立即收取。我需要知道它是否成功地为用户解锁了内容。我怎么能做到这一点?

$fields = array(


    'USER' => urlencode('email'),
    'PWD' => urlencode('pass'),
    'SIGNATURE' => urlencode('signature'),
    'METHOD' => urlencode('GetExpressCheckoutDetails'),
    'VERSION' => urlencode('86'),
    'TOKEN' => urlencode($_GET['token'])


);

//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://api-3t.sandbox.paypal.com/nvp");
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields_string);  //Post Fields
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);
curl_close ($ch);


// Get PAYERID of 1. query
$payerid = parseNVP($server_output);
$payerid = $payerid['PAYERID'];


$fields2 = array(


    'USER' => urlencode('Email'),
    'PWD' => urlencode('Pass'),
    'SIGNATURE' => urlencode('Signature'),
    'METHOD' => urlencode('CreateRecurringPaymentsProfile'),
    'VERSION' => urlencode('86'),
    'TOKEN' => urlencode($_GET['token']),
    'PAYERID' => urlencode($payerid),
'PROFILESTARTDATE' => urlencode(date('Y-m-d').'T'.date('H:i:s', strtotime('-5 minutes')).'Z'),
'DESC' => urlencode('FitnessMembership'),
'BILLINGPERIOD' => urlencode('Day'),
'BILLINGFREQUENCY' => urlencode('1'),
'AMT' => urlencode($price),
'CURRENCYCODE' => urlencode('USD'),
'COUNTRYCODE' => urlencode('US'),
'MAXFAILEDPAYMENTS' => urlencode('3')


);

Paypal结果:

 [2016-04-12 12:50 America/New_York] Verified IPN:cmd=_notify-validate&
payment_cycle=Daily&
txn_type=recurring_payment_profile_created&
last_name=Mustermann&
next_payment_date=03%3A00%3A00+Apr+12%2C+2016+PDT&
residence_country=US&
initial_payment_amount=0.00&
currency_code=USD&
time_created=09%3A49%3A25+Apr+12%2C+2016+PDT&
verify_sign=AJjtUEC2-zvkp.2Yz8a-.FGmZ2b3AoUov3DJ70yddjCmc1KidQVDeZHd&
period_type=+Regular&
payer_status=verified&
test_ipn=1&
tax=0.00&
payer_email=gut%40gut.de&
first_name=Hendrik&
receiver_email=hendrik.tewes-facilitator%40live.de&
payer_id=6AJ2HHWAPZSF6&
product_type=1&shipping=0.00&
amount_per_cycle=119.00&
profile_status=Active&
charset=windows-1252&
notify_version=3.8&
amount=119.00&
outstanding_balance=0.00&
recurring_payment_id=I-8P0534LSX2A3&
product_name=FitnessMembership&
ipn_track_id=59fede576b95c

您可以在为Express Checkout创建定期付款配置文件时收取初始金额。这是来自PayPal开发者网站的文档
CreateRecurringPaymentsProfile API调用中,您需要使用变量INITAMT

以下是来自PayPal开发者网站的更多信息:

INITAMT

(可选)在配置文件创建。使用初始金额进行注册或设置费用。

注意:请求中包含的所有金额必须具有相同的货币。

字符长度和限制:

价值通常是一个正数,不能超过10000.00美元或货币的每笔交易限额。它不包括货币象征大多数货币需要小数点后两位;十进制分隔符必须是句点(.),可选的千分隔符必须是逗号(,)。有些货币不允许使用小数。请参阅货币代码页面了解详细信息。

相关内容

  • 没有找到相关文章

最新更新