编程语言
首页 > 编程语言> > php – PayPal CreateRecurringPaymentProfile错误11502 – 无效令牌

php – PayPal CreateRecurringPaymentProfile错误11502 – 无效令牌

作者:互联网

我正在使用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.

标签:recurring-billing,php,paypal
来源: https://codeday.me/bug/20190825/1723838.html