Hello, I'm missing an example where you show how to get details of a resource from a webhook. So far I got: $signatureVerification = new \PayPal\Api\VerifyWebhookSignature();
$signatureVerification->setAuthAlgo($headers['PAYPAL-AUTH-ALGO']);
$signatureVerification->setTransmissionId($headers['PAYPAL-TRANSMISSION-ID']);
$signatureVerification->setCertUrl($headers['PAYPAL-CERT-URL']);
$signatureVerification->setWebhookId([my-webhook-id]);
$signatureVerification->setTransmissionSig($headers['PAYPAL-TRANSMISSION-SIG']);
$signatureVerification->setTransmissionTime($headers['PAYPAL-TRANSMISSION-TIME']);
$webhookEvent = new \PayPal\Api\WebhookEvent();
$webhookEvent->fromJson($requestBody);
$signatureVerification->setWebhookEvent($webhookEvent); // This is marked as deprecated
$request = clone $signatureVerification;
try
{ $output = $signatureVerification->post($apiContext); } catch(Exception $ex) { // Error-handling } if ($webhookEvent->event_type = "PAYMENT.SALE.COMPLETED") { $sale = $webhookEvent->getResource(); // What to do next? } I got 2 problems with the code: setWebhookEvent is marked as deprecated $sale seems to be an object of the type "PayPalModel", but how can I get a Sale-Object from it? Or where can I find which type a resource is for a specific webhook anyway?
... View more