为CreateRecurringPaymentsProfile获取“无效令牌”错误

时间:2014-07-01 22:11:35

标签: php paypal

我正在使用angelleye php库来创建CreateRecurringPaymentsProfile并遵循以下4个步骤:

1,SetExpressCheckout

2,重定向到www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=tokenvalue

3,GetExpressCheckoutDetails

4,DoExpressCheckoutPayment

5,CreateRecurringPaymentsProfile

除了CreateRecurringPaymentsProfile之外,上述所有步骤都已通过......我的想法已经用完了,感谢您的帮助。

我的请求/回复的原始值是:

RAWREQUEST

    USER=hide.hide-facilitator_api1.gmail.com
    PWD=hide
    VERSION=98.0
    BUTTONSOURCE=AngellEYE_PHPClass
    SIGNATURE=hide
    METHOD=GetExpressCheckoutDetails
    TOKEN=EC-55V363450P8173204 

RAWRESPONSE

    TOKEN=EC-55V363450P8173204
    BILLINGAGREEMENTACCEPTEDSTATUS=0
    CHECKOUTSTATUS=PaymentActionNotInitiated
    TIMESTAMP=2014-07-01T21:26:27Z
    CORRELATIONID=88436244ae580
    ACK=Success
    VERSION=98.0
    BUILD=11624049
    EMAIL=%40yahoo.com
    PAYERID=hide
    PAYERSTATUS=verified
    FIRSTNAME=Jacqueline
    LASTNAME=Dias
    COUNTRYCODE=US
    CURRENCYCODE=USD
    AMT=10.00
    ITEMAMT=10.00
    SHIPPINGAMT=0.00
    HANDLINGAMT=0.00
    TAXAMT=0.00
    CUSTOM=1%7c1%7c8561112555243
    DESC=Plan%20Details:%201-8561112555243
    INVNUM=8561112555243
    NOTIFYURL=PayPalIPN
    INSURANCEAMT=0.00
    SHIPDISCAMT=0.00
    L_NAME0=Plan%20Details:%201-8561112555243
    L_NUMBER0=na
    L_QTY0=1
    L_TAXAMT0=0.00
    L_AMT0=10.00
    L_DESC0=Plan%20Details:%201-8561112555243
    L_ITEMWEIGHTVALUE0=%20%20%200.00000
    L_ITEMLENGTHVALUE0=%20%20%200.00000
    L_ITEMWIDTHVALUE0=%20%20%200.00000
    L_ITEMHEIGHTVALUE0=%20%20%200.00000
    L_ITEMCATEGORY0=Digital
    PAYMENTREQUEST_0_CURRENCYCODE=USD
    PAYMENTREQUEST_0_AMT=10.00
    PAYMENTREQUEST_0_ITEMAMT=10.00
    PAYMENTREQUEST_0_SHIPPINGAMT=0.00
    PAYMENTREQUEST_0_HANDLINGAMT=0.00
    PAYMENTREQUEST_0_TAXAMT=0.00
    PAYMENTREQUEST_0_CUSTOM=1%7c1%7c8561112555243
    PAYMENTREQUEST_0_DESC=Plan%20Details:%201-8561112555243
    PAYMENTREQUEST_0_INVNUM=8561112555243
    PAYMENTREQUEST_0_NOTIFYURL=PayPalIPN
    PAYMENTREQUEST_0_INSURANCEAMT=0.00
    PAYMENTREQUEST_0_SHIPDISCAMT=0.00
    PAYMENTREQUEST_0_NOTETEXT=This%20is%20a%20test%20note%20before%20ever%20having%20left%20the%20web%20site.
    PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false
    PAYMENTREQUEST_0_ADDRESSNORMALIZATIONSTATUS=None
    L_PAYMENTREQUEST_0_NAME0=Plan%20Details:%201-8561112555243
    L_PAYMENTREQUEST_0_NUMBER0=na
    L_PAYMENTREQUEST_0_QTY0=1
    L_PAYMENTREQUEST_0_TAXAMT0=0.00
    L_PAYMENTREQUEST_0_AMT0=10.00
    L_PAYMENTREQUEST_0_DESC0=Plan%20Details:%201-8561112555243
    L_PAYMENTREQUEST_0_ITEMWEIGHTVALUE0=%20%20%200.00000
    L_PAYMENTREQUEST_0_ITEMLENGTHVALUE0=%20%20%200.00000
    L_PAYMENTREQUEST_0_ITEMWIDTHVALUE0=%20%20%200.00000
    L_PAYMENTREQUEST_0_ITEMHEIGHTVALUE0=%20%20%200.00000
    L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital
    PAYMENTREQUESTINFO_0_ERRORCODE=0 

RAWREQUEST

    USER=hide.hide-facilitator_api1.gmail.com
    PWD=hide
    VERSION=98.0
    BUTTONSOURCE=AngellEYE_PHPClass
    SIGNATURE=hide
    METHOD=DoExpressCheckoutPayment
    TOKEN=EC-55V363450P8173204
    PAYERID=hide
    RETURNFMFDETAILS=1
    BUTTONSOURCE=hide
    PAYMENTREQUEST_0_AMT=10.00
    PAYMENTREQUEST_0_CURRENCYCODE=USD
    PAYMENTREQUEST_0_ITEMAMT=10.00
    PAYMENTREQUEST_0_DESC=Plan+Details:+1-8561112555243
    PAYMENTREQUEST_0_INVNUM=8561112555243
    PAYMENTREQUEST_0_NOTIFYURL=PayPalIPN
    PAYMENTREQUEST_0_PAYMENTACTION=Sale
    L_PAYMENTREQUEST_0_NAME0=Plan+Details:+1-8561112555243
    L_PAYMENTREQUEST_0_DESC0=Plan+Details:+1-8561112555243
    L_PAYMENTREQUEST_0_AMT0=10.00
    L_PAYMENTREQUEST_0_NUMBER0=na
    L_PAYMENTREQUEST_0_QTY0=1 

RAWRESPONSE

    TOKEN=EC-55V363450P8173204
    SUCCESSPAGEREDIRECTREQUESTED=false
    TIMESTAMP=2014-07-01T21:26:30Z
    CORRELATIONID=c299c1d456a1f
    ACK=Success
    VERSION=98.0
    BUILD=11624049
    INSURANCEOPTIONSELECTED=false
    SHIPPINGOPTIONISDEFAULT=false
    PAYMENTINFO_0_TRANSACTIONID=7WV52893XW736654U
    PAYMENTINFO_0_TRANSACTIONTYPE=cart
    PAYMENTINFO_0_PAYMENTTYPE=instant
    PAYMENTINFO_0_ORDERTIME=2014-07-01T21:26:30Z
    PAYMENTINFO_0_AMT=10.00
    PAYMENTINFO_0_FEEAMT=0.59
    PAYMENTINFO_0_TAXAMT=0.00
    PAYMENTINFO_0_CURRENCYCODE=USD
    PAYMENTINFO_0_PAYMENTSTATUS=Completed
    PAYMENTINFO_0_PENDINGREASON=None
    PAYMENTINFO_0_REASONCODE=None
    PAYMENTINFO_0_PROTECTIONELIGIBILITY=Ineligible
    PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE=None
    PAYMENTINFO_0_SECUREMERCHANTACCOUNTID=hide
    PAYMENTINFO_0_ERRORCODE=0
    PAYMENTINFO_0_ACK=Success 

RAWREQUEST

    USER=hide.hide-facilitator_api1.gmail.com
    PWD=hide
    VERSION=98.0
    BUTTONSOURCE=AngellEYE_PHPClass
    SIGNATURE=hide
    METHOD=CreateRecurringPaymentsProfile
    TOKEN=EC-55V363450P8173204
    PROFILESTARTDATE=2014-07-01T21:27:30Z
    DESC=Plan+Details:+1-8561112555243
    AUTOBILLAMT=1
    BILLINGPERIOD=Year
    BILLINGFREQUENCY=1
    TOTALBILLINGCYCLES=0
    AMT=10.00
    CURRENCYCODE=USD
    PAYERID=hide
    COUNTRYCODE=US
    L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital
    L_PAYMENTREQUEST_0_NAME0=Plan+Details:+1-8561112555243
    L_PAYMENTREQUEST_0_DESC0=Plan+Details:+1-8561112555243
    L_PAYMENTREQUEST_0_AMT0=10.00
    L_PAYMENTREQUEST_0_NUMBER0=na
    L_PAYMENTREQUEST_0_QTY0=1 

RAWRESPONSE

    TIMESTAMP=2014-07-01T21:26:31Z
    CORRELATIONID=79d7deb94f82f
    ACK=Failure
    VERSION=98.0
    BUILD=11457922
    L_ERRORCODE0=11502
    L_SHORTMESSAGE0=Invalid%20Token
    L_LONGMESSAGE0=The%20token%20is%20invalid
    L_SEVERITYCODE0=Error

1 个答案:

答案 0 :(得分:2)

我在这里看不到您的SetExpressCheckout请求。??

您需要确保SEC请求包含使其能够进行定期付款的结算协议参数。由于您正在使用我的库,请查看SetExpressCheckout.php模板以了解以下内容:

$BillingAgreements = array();
$Item = array(
              'l_billingtype' => '',                            // Required.  Type of billing agreement.  For recurring payments it must be RecurringPayments.  You can specify up to ten billing agreements.  For reference transactions, this field must be either:  MerchantInitiatedBilling, or MerchantInitiatedBillingSingleSource
              'l_billingagreementdescription' => '',            // Required for recurring payments.  Description of goods or services associated with the billing agreement.  
              'l_paymenttype' => '',                            // Specifies the type of PayPal payment you require for the billing agreement.  Any or IntantOnly
              'l_billingagreementcustom' => ''                  // Custom annotation field for your own use.  256 char max.
              );

array_push($BillingAgreements, $Item);

您只需要使用值" RecurringPayments"对于结算类型,然后也创建说明。描述将需要与您在最后的CreateRecurringPaymentsProfile中发送的描述完全匹配。当然,您需要确保在$ PayPalRequestData中添加$ BillingAgreements,以便相应地传递它。

一旦您向SEC请求添加了结算协议参数,该令牌将对CRPP有效。