forked from LiveCarta/PayPal-PHP-SDK
Updates to Sample Docs
This commit is contained in:
@@ -10,9 +10,9 @@ This is a sample data, that represents the webhook event data.</p></div></div><d
|
||||
* This is one way to receive the entire body that you received from PayPal webhook. This is one of the way to retrieve that information.
|
||||
* Just uncomment the below line to read the data from actual request.
|
||||
*/</span>
|
||||
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> String $bodyReceived */</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>$bodyReceived = file_get_contents('php://input');</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="validate-received-event-method">Validate Received Event Method</h3>
|
||||
<span class="hljs-comment">/** <span class="hljs-doctag">@var</span> String $bodyReceived */</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>$bodyReceived = file_get_contents('php://input');</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="validate-received-event-method">Validate Received Event Method</h3>
|
||||
<p>Call the validateReceivedEvent() method with provided body, and apiContext object to validate</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
|
||||
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\WebhookEvent $output */</span>
|
||||
<span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\WebhookEvent $output */</span>
|
||||
<span class="hljs-variable">$output</span> = \PayPal\Api\WebhookEvent::validateAndGetReceivedEvent(<span class="hljs-variable">$bodyReceived</span>, <span class="hljs-variable">$apiContext</span>);
|
||||
} <span class="hljs-keyword">catch</span> (<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper"> ResultPrinter::printError(<span class="hljs-string">"Validate Received Webhook Event"</span>, <span class="hljs-string">"WebhookEvent"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$bodyReceived</span>, <span class="hljs-variable">$ex</span>);
|
||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||
|
||||
Reference in New Issue
Block a user