ruby on rails - "The token is invalid" when trying to setup Paypal recurring payments with ActiveMerchant -
i feel lot of documentation on outdated, have been trying far:
i using activemerchant::billing::paypalexpressgateway
gateway.
first setup purchase , redirect user paypal:
response = gateway.setup_purchase price, return_url: <confirm url>, cancel_return_url: <cancel url>, items: [ { name: 'my item', quantity: 1, description: "my item description", amount: price } ] redirect_to gateway.redirect_url_for(response.token)
this works, can sign in sandboxed buyer , confirm payment, brings me <confirm url>
above. in confirmation, do:
response = gateway.recurring price, nil, token: params[:token], period: 'year', frequency: 1, start_date: time.now, description: 'my item subscription'
when this, receive invalid token error paypal in response
variable. token seems fine, present in url when brought confirmation url. i'm taking directly (params[:token]
) , sending paypal.
am doing wrong? said, seems lot of documentation type of process outdated (or maybe trying stuff outdated...)
after looking through source code activemerchant's paypal express checkout gateway, came conclusion it's outdated when dealing recurring payments. switched paypal-recurring gem instead , worked fine.
Comments
Post a Comment