PayPal CreateRecurringPaymentProfile错误11502-无效令牌


PayPal CreateRecurringPaymentProfile Error 11502 - Invalid Token

我正在使用PayPal的API设置定期付款。首先,我将以下参数发送到SetExpressCheckout:

Array
(
    [METHOD] => SetExpressCheckout
    [USER] => XXX
    [PWD] => XXX
    [SIGNATURE] => XXX
    [VERSION] => 98.0
    [AMT] => 0
    [MAXAMT] => 99.00
    [RETURNURL] => http://google.com
    [CANCELURL] => http://google.com
    [L_BILLINGTYPE0] => RecurringPayments
    [L_BILLINGAGREEMENTDESCRIPTION0] => 99.00 per month till stopped
)

这会生成如下响应:

Array
(
    [TOKEN] => EC-90P39652RF345525U
    [TIMESTAMP] => 2013-02-08T17:09:24Z
    [ACK] => Success
    [VERSION] => 98.0
)

使用创建的计费协议中的描述和令牌,我将以下参数发送到CreateRecurringPaymentsProfile:

Array
    (
    [METHOD] => CreateRecurringPaymentsProfile
    [USER] => XXX
    [PWD] => XXX
    [SIGNATURE] => XXX
    [TOKEN] => EC-90P39652RF345525U
    [PROFILESTARTDATE] => Feb 22 2013 17:09:24
    [DESC] => 99.00 per month till stopped
    [BILLINGPERIOD] => Month
    [BILLINGFREQUENCY] => 12
    [AMT] => 99.00
    [CURRENTCYCODE] => USD
    [CREDITCARDTYPE] => VISA
    [ACCT] => 1234123412341234
    [EXPDATE] => 012014
    [CVV2] => 123
    [EMAIL] => fake@example.com
    [STREET] => 123 Main St
    [CITY] => New York City
    [STATE] => NY
    [COUNTRYCODE] => US
    [ZIP] => 12345
)

在我看来一切都很好,但失败了:

Array
(
    [TIMESTAMP] => 2013-02-08T17:09:24Z
    [ACK] => Failure
    [VERSION] => 98.0
    [L_ERRORCODE0] => 11502
    [L_SHORTMESSAGE0] => Invalid Token
    [L_LONGMESSAGE0] => The token is invalid
    [L_SEVERITYCODE0] => Error
)

非常感谢您的帮助!

在调用CreateRecurringPaymentsProfile之前,您需要将买家重定向到PayPal以批准定期付款。您的两个API响应的时间戳是相同的,这告诉我,您在从SetExpressCheckout收到响应后立即调用了CreateRecurringPaymentsProfile。在从SetExpressCheckout收到回复后,您需要将买家重定向到PayPal。