Reputation: 1847
When getting an event PAYMENT.SALE.COMPLETED in a webhook, you can use this code to get more information about the payer:
$resource = $webhookEvent->getResource();
$Payment = \Paypal\Api\Payment::get($resource->parent_payment, $apiContext);
$Payer = $Payment->getPayer();
$Payerinfo = $Payer->getPayerInfo();
Now I updated to SDK V2, and get PAYMENT.CAPTURE.COMPLETED-events. How does this work here? It seems there is no $resource->parent_payment. I tried something like:
$request = new PayPalCheckoutSdk\Orders\OrdersGetRequest($resource->id);
But this only returns RESOURCE_NOT_FOUND.
How can I get the Payerinfo here?
Upvotes: 1
Views: 777
Reputation: 30402
The resource->id returned is a v2/payments id, not an Order ID.
v2/checkout/orders IDs are only used during payer approval, and have no accounting value.
Upvotes: 1