This sample code demonstrate how you can process a refund on a Captured transaction created using the Capture API. API used: /v1/payments/capture/{}/refund
create payment to get authorization Id
Get the authorization
Create a capture
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 demonstrate how you can process a refund on a Captured transaction created using the Capture API. API used: /v1/payments/capture/{}/refund