cancel
Showing results for 
Search instead for 
Did you mean: 

When using PayPal API is it possible to get payer info?

Contributor

When using PayPal API is it possible to get payer info?

Currently we use IPN, and when we receive notification there is payer info, such as email, residence_country, first_name, last_name.

 

We want to switch to API (because it is possible to create refund thought API). But in API calls create payment and execute payment,  there is no information about payer.

 

How can we get this payer info?

 

4 REPLIES 4
Highlighted
Contributor

Re: When using PayPal API is it possible to get payer info?

Yes, you have to use webhooks in this case.

Contributor

Re: When using PayPal API is it possible to get payer info?

> Yes, you have to use webhooks in this case.

 

Which exactly webhook provides this info?

I've already checked webhook and I could not find such info in webhooks.

Contributor

Re: When using PayPal API is it possible to get payer info?

I'm using PHP with the Paypal-SDK. The general approach (without error-handling etc) is:

 

PAYMENT.SALE.COMPLETED

$resource = $webhookEvent->getResource();

$Payment = \Paypal\Api\Payment::get($resource->parent_payment, $api);
$Payer = $Payment->getPayer();
$Payerinfo = $Payer->getPayerInfo();

 

Contributor

Re: When using PayPal API is it possible to get payer info?

Thank you!

 

I checked this webhook in webhook simulator. And it really does not provide payer info.

But your code looks more like sequential API calls, than just parsing webhook response.

So I dig into it, and I found that execute payment API call returns payer info.

 

https://developer.paypal.com/docs/api/payments/v1/#payment_execute