Reputation: 608
I am trying to setup a recurring payment profile via the ExpressCheckout API of Paypal in Ruby on Rails with the help of paypal-express gem but i keep getting error code 11502 (Invalid token) => Paypal error code documentation
The documentation is a bit unclear because there it is not saying what's missing:
One or more subscription detail fields are missing from the request.
I have checked the required field in the documentation here but i don't think i missed any. No need for shipping details as we don't ship a product. Here is a log of what is being sent to Paypal when i am doing the checkout and then creating the recurring profile:
SetExpressCheckout
Parameters:
{:RETURNURL=>"http://localhost:3000/paypal/validate", :CANCELURL=>"http://localhost:3000/paypal/cancel", :REQCONFIRMSHIPPING=>0, :NOSHIPPING=>1, :ALLOWNOTE=>0, :PAYMENTREQUEST_0_AMT=>"88.00", :PAYMENTREQUEST_0_TAXAMT=>"0.00", :PAYMENTREQUEST_0_SHIPPINGAMT=>"0.00", :PAYMENTREQUEST_0_CURRENCYCODE=>"HKD", :PAYMENTREQUEST_0_DESC=>"Plus x 2-month subscription x 2 staff", :LOCALECODE=>:fr}
Response:
TOKEN=EC%2d0H440138VJ9552235&TIMESTAMP=2015%2d04%2d25T08%3a38%3a42Z&CORRELATIONID>=48742557da98&ACK=Success&VERSION=88%2e0&BUILD=16428450
CreateRecurringPaymentsProfile
Parameters:
{:TOKEN=>"EC-0H440138VJ9552235", :BILLINGPERIOD=>:Month, :BILLINGFREQUENCY=>2, :TOTALBILLINGCYCLES=>0, :AMT=>"88.00", :CURRENCYCODE=>"HKD", :SHIPPINGAMT=>"0.00", :TAXAMT=>"0.00", :DESC=>"Plus x 2-month subscription x 2 staff", :MAXFAILEDPAYMENTS=>0, :PROFILESTARTDATE=>"2015-04-25 16:39:24"}
Response:
TIMESTAMP=2015%2d04%2d25T08%3a39%3a26Z&CORRELATIONID=533964ff183a1&ACK=Failure&VE>RSION=88%2e0&BUILD=16398710&L_ERRORCODE0=11502&L_SHORTMESSAGE0=Invalid%20Token&L_>LONGMESSAGE0=The %20token%20is%20invalid&L_SEVERITYCODE0=Error
Do you guys have any ideas of what could be wrong? I can execute a payment without any issue, the issue appear when creating a recurring profile.
Upvotes: 1
Views: 563
Reputation: 608
Never mind! I found what was wrong misread the gem wiki (https://github.com/nov/paypal-express/wiki/Recurring-Payment) and mistakenly mix instant payment request with recurring profile creation so there was no billing_agreement_description nor billing_agreements in the data sent to paypal...
Upvotes: 1