I have setup an integration such that you can create a recurring subscription through my application via the PayPal JS SDK's Buttons functionality. When you've made a subscription on my platform I capture the subscription ID and retain it in a database for future use. I have functioning logic that allows me to cancel a user's subscription with the subscription ID I've retained. I also have logic that determines how much of their subscription they have leveraged. For example, if the subscription was $10/mo and they cancel halfway through the month I can identify I need to refund them $5 for the unused portion of their subscription. The problem I have encountered is I cannot identify any way to refund their money via the REST API. So far I've used /v1/billing/subscriptions/{id}/transactions as defined here to capture the last transaction they were charged for that is in a "COMPLETED" state. I have attempted to send the id of that transaction to /v2/payments/captures/{capture_id}/refund as defined here specifying the amount I want to refund for the transaction in the body of the request. But it appears a transaction ID is not the same as a payment capture ID. Is there some series of API requests I can make to identify a capture ID associated with a given subscription so I can issue a refund to my user? Or maybe should I be trying to use something besides /v2/payments/captures/{capture_id}/refund to issue the refund and trying to acquire a capture ID is actually a red herring?
... View more