带有重复订阅的数字商品快速结账

时间:2011-07-08 10:08:33

标签: php paypal

以为我会在这里问,因为x论坛上有一个问题(5月7日发布)但似乎还没有回答。

我在这里使用PHP并作为测试获取令牌并处理事务在这里是我的代码:

$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";

我的回复很好,在这个回复中通常是这样的:

TOKEN = EC-87478432UK0557216
BILLINGAGREEMENTACCEPTEDSTATUS = 1
CHECKOUTSTATUS = PaymentActionNotInitiated

然后我改变响应然后被发送回paypal。在这里,我想我需要创建个人资料:

$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.

我的最后一次尝试(在放弃之前)是这样的:

$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.

不是很有帮助......

还有其他人这样做过吗?我很感激一些指导!

请注意,我认为这与正常设置定期订阅不同(虽然我可能错了)。

1 个答案:

答案 0 :(得分:2)

我得到了论坛上一名支持人员的帮助。

我需要将我的版本从69升到74.0并使用这些参数:

$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

所以对我来说一切都很好:)。