This sample code demonstrates how you can process a refund on a Captured transaction. API used: /v1/payments/capture/{}/refund
Create a refund object indicating refund amount and call the refund method
Create a new apiContext object so we send a new PayPal-Request-Id (idempotency) header for this resource
Refund Capture Sample
This sample code demonstrates how you can process a refund on a Captured transaction. API used: /v1/payments/capture/{}/refund