0
votes

I have setup PayPal Sandbox test accounts, a Personal (buyer) and a Business (merchant).

I'd like to test a PayPal 'DoCapture' API Operation. The problem I'm encountering is that I need an AuthorizationID and don't know how to obtain it. If i run the 'DoExpressCheckoutPayment' API call, I do not get an AuthorizationID returned, using the merchant API credentials, though I do get an 'ACK' of success. Do I need to be using the buyer credentials with the 'DoExpressCheckOutPayment' call? I don't see the API credentials in the PayPal Sandbox profile for the Personal account.

2

2 Answers

1
votes

Express Checkout example with authorization and capturing you can find here.

Short answer - according with DoCapture documentation

AuthorizationID ... This is the transaction ID returned from DoExpressCheckoutPayment...

According with DoExpressCheckout documentation you need field from response, attention, PaymentInfo#TransactionId

... this value is your AuthorizationID for use with the Authorization & Capture APIs.

0
votes

This is what you need to do to implement the capture API.

  1. Create Payment: set intent as authorize in its request to get payment Id
  2. Show Payment Details: to get approval_url. The customer will use this URL to pay for the order.
  3. Execute approved PayPal payment: Use this API after customer successfully pays for the order. This API returns authorization-id along with capture link.
  4. Use Capture API: use the URL obtained from step 3 to capture.

Use this link and check payments API. https://developer.paypal.com/docs/api/payments/#payment_execute

Hope this helps to someone who stumbles upon here.