I have used the Amelia Booking plugin for my one of the site.
I would like to implement the split payment & refund to customer functionality with PayPal payment gateway.
I made one addon for my site which can split the payment using PayPal payout APIs(https://api-m.sandbox.paypal.com/v1/payments/payouts).
Split is working fine but to make a refund I need customer's PayPal details.
So I did below things:
Amelia is storing the transaction information in the database in below format.
{
"data":
{
"PayerId": "4ABCDEFGHIJKL",
"PaymentId": "PAYID-ABCDEFGHIJKLMNO2PQRSTUVW",
"transactionReference": "PAYID-ABCDEFGHIJKLMNO2PQRSTUVW"
},
"amount": "00.00",
"gateway": "payPal",
"currency": "USD"
}
So from above information I can access "transactionReference" to fetch the customer's details using (https://api-m.sandbox.paypal.com/v1/payments/payment/{transactionReference}) API call to make refund.
But unfortunately this endpoint is deprecated, so is there anyway to fetch the customer's PayPal data using above information from PayPal v2 API ?
The v1 APIs are deprecated for new integrations, but if you are currently using them to process payments -- which if you have a PAYID, you are in fact doing -- then you must use the v1 API for refunds.
Using the v2 API for refunds is only applicable if you are using something like the v2/checkout/orders API to process payments, which that plugin is not doing.