2011-07-08 56 views
1

想到我會問這裏,因爲有一個關於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 

然後我改變回應,然後發送回貝寶。在這裏,我想我需要創建配置文件:

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

不是非常有幫助..... 。

那麼還有沒有這樣做?我會很感激一些指導!

請注意,我認爲這與設置定期訂閱通常不同(儘管我可能是錯的)。

回答

2

我從論壇上的一位支持人員那裏得到了幫助。

我需要我從69版高達74.0,並使用這些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 

所以,一切都很好,對我來說:)

相關問題