Refund PayPal PAYID using v2 REST API? - paypal

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.

Related

API calls required to obtain buyer's e-mail

I'm using PayPal Express checkout with BigCommerce with a sandbox account. Via the BigCommerce API, only one field is supplied, which is also listed via the http://www.sandbox.paypal.com interface as the "Unique Transaction ID" under "Details":
<payment_provider_id>0P192574JB861364C</payment_provider_id>
The orders are going from BigCommerce into an ERP system that, for PayPal Express orders, expects the PayPal username (e-mail) to be provided.
Via the PayPal REST API (or otherwise), is there a way derive the e-mail used during the transaction via the transaction ID?
If so, which API call(s) would be necessary to get the e-mail?
Thanks.
The GetTransactionDetails of the classic NVP/SOAP APIs will let you get the buyer's e-mail with only a transaction ID.
Info is here: https://developer.paypal.com/docs/classic/api/merchant/GetTransactionDetails_API_Operation_NVP/

Mass Payment doesn't work over NVP API

I'm trying to make a pay out to my service's users. I'm using Node.js SDK and choose Mass Payments to make automatical pay outs, since looks like it's only possible choise for me (user presses "withdraw" button inside mobile application, application sends request to our server and then our server makes call to PayPal NVP API to transfer money from our paypal account to user's paypal account). I'm making requests through NVP API.
PayPal responses with this error:
{
"TIMESTAMP": "2015-02-17T20:20:29Z",
"CORRELATIONID": "5a949b0257755",
"ACK": "Failure",
"VERSION": "2.3",
"BUILD": "15295733",
"L_ERRORCODE0": "10329",
"L_SHORTMESSAGE0": "User is blocked",
"L_LONGMESSAGE0": "We're sorry, but your PayPal account isn't currently eligible to send mass payments. Please contact either PayPal Customer Service or your account manager.",
"L_SEVERITYCODE0": "Error"
}
What are possible reasons for such error? Maybe I'm using not appropriate type of account for making mass payments? What kind of account should I have? Or maybe I'm just using not appropriate API for making pay outs?
UPD this error occures when I'm trying to use live paypal servers. On sandbox servers mass payment works completely fine.

Paypal REST API: add a payment experience to a billing agreement

If you want to customise your store when using the payment endpoint, that's fine, you can create a payment experience and then pass the payment_experience_id to the payment endpoint.
But what if you're using the billing agreement endpoint? I notice there's no payment_experience_id field, so how do you customise the store? Can't find anything about this in the API docs.
In the PayPal standard & express payment payment reference docs, e.g.:
https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/
... see the fields PAGESTYLE for the direct equivalent of the REST payment experience (a group of setting that you set up at an account level and apply to the payment experience as a set), or the fields HRDIMG, PAGEFLOWCOLOR, CARTBORDERCOLOR, LOGOIMG, and BRANDNAME fto override any single piece of the experince for a particular payment.

Does PayPal REST API support adaptive payments?

I need to charge fee at every transaction made via PayPal so when user pays via my application i need to charge additional $1 to my PayPal account.
I know Adaptive payments in Classic API can do what i need. Is there a support for this in new REST API?
The REST API is a replacement to the Adaptive Payment API. However, if I understand that you're asking for the more complex payments like chained, parallel or split, then I believe they are scheduled to be supported by the REST API by early next year (2015).

PayPal REST API equivalent of GetExpressCheckoutDetails

As far as I can tell, this doesn't exist yet, but I was wondering if anyone knew if there was an equivalent of the PayPal Payments Pro NVP call "GetExpressCheckoutDetails" in the new PayPal REST API.
The REST API documentation lists information on authorizing the sale and the redirect contains the token that would be used in Payments Pro but there's no docs on how to retrieve the Billing/Shipping info prior to executing the sale (after which I assume you can retrieve that information through the "Look up a payment resource" call of payments/payment/{id}
Tangential question in case PayPal official response comes in: Is recurring payment support coming to the REST API soon or will it be exclusive to PayPal Payments Pro?
You can look up a payment resource even before you execute it. However, we have a bug in the API that doesn't currently return the shipping information.