I am implementing @paypal/react-paypal-js
I am able to create an order hitting my backend server from createOrder callback in the PayPalButtons component to /api/order where I make the request on the server to the API at /v2/checkout/orders.
I get a response with two links one is where you are to redirect the user to approve their payment (payer-action). I go to that link in a new tab, login to a sandbox account and proceed to complete payment. It redirects to the redirect url.
I take the created orderID and past in in the JSON body in postman it hits another server endpoint I called /api/capture.
onApprove callback calls my server at /api/capture where I make a request to /v2/checkout/orders/{id}/capture where that orderID is put in the path.
The documentation says no request body is required, however doing so results in an error, so putting a request body works and I supply the same request body that is shown as required in the create orders documentation.
The result of submitting this request is PAYER_ACTION_REQUIRED status.
But I thought redirecting to the payment link, where the payer "approves" of payment is where the payer action takes place, so why am I being asked this again? I am expecting a status of COMPLETED.