How am I supposed to capture a payment 1 day after its authorization if the PayPal token expires after 3 hours?

StackOverflow https://stackoverflow.com/questions/17240419

  •  01-06-2022
  •  | 
  •  

سؤال

I'm using the express checkout API through the ActiveMerchant gem in a Ruby on Rails app. The whole authorize and capture flow works just fine when is done within 3 hours. But after that my token expires and I lose the transaction. Even if the authorize and capture documentation says that the authorization is valid for 3 days (at least according to https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_admin_authcapture).

So, how can I capture the transaction after the token has expired?

هل كانت مفيدة؟

المحلول

You shouldn't have to be passing your token. You should be following the flow below.

  1. Make your SetExpressCheckout API call and set payment action to authorization (A)
  2. Get token back
  3. Redirect buyer over to PayPal with to token to login and agree to payment
  4. Buyer gets redirected back to your site with token and payer id returned
  5. You can then execute your GetExpressCheckoutDetails API call using the token.(this step is optional)
  6. Then you perform the DoExpressCheckoutPayment API where you pass over the token and set the payment action to authorization (A)

Then then completes the Express Checkout authorization.

Now you would go back a day or two later and perform your DoCapture API where you send over the transaction id that was returned from your DoExpressCheckoutPayment API earlier. You don't send over the token again here. Once you complete the DoCapture, the funds should then show in your account.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top