带有定期订阅的数字商品快速结帐 [英] Digital Goods Express Checkout with Recurring Subscriptions
问题描述
我想在这里问一下,因为x论坛上有一个问题(发布于5月7日),但似乎尚未得到答复.
Thought I would ask here as there is a question on the x forums (posted May 7) but it doesn't seem to be answered yet.
我在这里使用PHP,这是我的代码,作为获取令牌和处理交易的测试:
I'm using PHP here and as a test to get the token and process the transaction here is my code:
$nvps = array();
$nvps["VERSION"] = "69.0";
$nvps["METHOD"] = "SetExpressCheckout";
$nvps["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
$nvps["PAYMENTREQUEST_0_AMT"] = "1.00";
$nvps["PAYMENTREQUEST_0_CURRENCYCODE"] = "GBP";
$nvps["PAYMENTREQUEST_0_ITEMAMT"] = "1.00";
$nvps["L_BILLINGTYPE0"] = 'RecurringPayments';
$nvps["L_BILLINGAGREEMENTDESCRIPTION0"] = "the subscription";
$nvps["L_PAYMENTREQUEST_0_NUMBER0"] = 1;
$nvps["L_PAYMENTREQUEST_0_NAME0"]= "subscription";
$nvps["L_PAYMENTREQUEST_0_AMT0"]= 1.00;
$nvps["L_PAYMENTREQUEST_0_QTY0"]= 1;
$nvps["L_PAYMENTREQUEST_0_ITEMCATEGORY0"] = "Digital";
$nvps["REQCONFIRMSHIPPING"] = "0";
$nvps["NOSHIPPING"] = "1";
我得到了很好的答复,并且在这种答复中是通常的东西:
I get a response back fine, and in this response is the usual stuff:
TOKEN = EC-87478432UK0557216
BILLINGAGREEMENTACCEPTEDSTATUS = 1
CHECKOUTSTATUS = PaymentActionNotInitiated
然后,我将响应更改为,然后将其发送回Paypal.在这里,我认为我需要创建个人资料:
I then change the response to then be sent back to paypal. Here I think I need to create the profile:
$response["METHOD"] = "CreateRecurringPaymentsProfile";
$response["PROFILESTARTDATE"] = "2011-7-7T0:0:0";
$response["BILLINGPERIOD"] = "Month";
$response["BILLINGFREQUENCY"] = "4";
$response = RunAPICall($response); // Send the API call to PayPal.
但是我得到了:
TIMESTAMP = 2011-07-07T21:29:15Z
CORRELATIONID = 59260374116e4
ACK = Failure
VERSION = 69.0
BUILD = 1907759
L_ERRORCODE0 = 11581
L_SHORTMESSAGE0 = Invalid Data
L_LONGMESSAGE0 = Profile description is invalid
L_SEVERITYCODE0 = Error
An error occurred.
我最后一次尝试(放弃之前)是:
My last attempt (before giving up) was this:
$nvps = array();
$nvps["VERSION"] = "69.0";
$nvps["METHOD"] = "CreateRecurringPaymentsProfile";
$nvps["TOKEN"] = $response["TOKEN"];
$nvps["paymentType"] = urlencode('Authorization');
$nvps["RETURNURL"] = $script_url . "/modules/paypal/success.inc.php";
$nvps["CANCELURL"] = $script_url . "/modules/paypal/failure.inc.php";
$nvps["paymentAmount"] = urlencode("1.00");
$nvps["currencyID"] = urlencode("GBP"); // or other currency code ('GBP', 'EUR', 'JPY', 'CAD', 'AUD')
$nvps["startDate"] = urlencode("2011-07-08T00:00:00");
$nvps["billingPeriod"] = urlencode("Month"); // or "Day", "Week", "SemiMonth", "Year"
$nvps["billingFreq"] = urlencode("12");
$response = RunAPICall($nvps); // Send the API call to PayPal.
我现在明白了:
TIMESTAMP = 2011-07-08T11:07:33Z
CORRELATIONID = 1e97153fed038
ACK = Failure
L_ERRORCODE0 = 10001
L_SHORTMESSAGE0 = Internal Error
L_LONGMESSAGE0 = Timeout processing request
An error occurred.
不是很有帮助...
那么还有其他方法吗?我希望能提供一些指导!
So has else done this? I would appreciate some guidence!
请注意,我认为这与正常设置定期订阅不同(尽管我可能错了).
Please note, I think this is different from setting up recurring subscriptions normally (although I may be wrong).
推荐答案
我从论坛的一名支持人员那里得到了帮助.
I got help from one of the support staff on the forum.
我需要将版本从69升级到74.0,并使用以下参数:
I needed to up my version from 69 to 74.0 and use these params:
$nvps["PROFILESTARTDATE"] = "2011-07-08T17:40:00Z";
$nvps["BILLINGPERIOD"] = "Month";
$nvps["BILLINGFREQUENCY"] = "1";
$nvps["AMT"] = "1.00";
$nvps["CURRENCYCODE"] = "GBP";
$nvps["DESC"] = "the+subscription";
然后屈服……
PROFILEID = I-762SUW9D8VVF
PROFILESTATUS = ActiveProfile
TIMESTAMP = 2011-07-08T16:50:55Z
CORRELATIONID = 880f95195604f
ACK = Success
VERSION = 74.0
BUILD = 1907759
所以对我来说一切都很好:)
So all is well for me :)
这篇关于带有定期订阅的数字商品快速结帐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!