New to the community? Welcome! Please read our Community Rules and Guidelines
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?
Yes, you have to use webhooks in this case.
> 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.
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();
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
©1999-2019 PayPal, Inc. All rights reserved.