You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Creating webhook is sample purposes only. In real scenario, you dont need to create a new webhook everytime you want to search
7
7
for a webhook events. This is made in a sample just to make sure there is minimum of one webhook to listen to.</p></div></div><divclass="code"><divclass="wrapper"><spanclass="hljs-comment">/**<spanclass="hljs-phpdoc"> @var</span> \PayPal\Api\Webhook $webhook */</span>
Copy file name to clipboardExpand all lines: sample/doc/notifications/createWebhook.html
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,11 @@
14
14
]
15
15
}</code></pre>
16
16
<p>Fill up the basic information that is required for the webhook
17
-
The URL should be actually accessible over the internet. Having a localhost here would not work.</p></div></div><divclass="code"><divclass="wrapper"><spanclass="hljs-variable">$webhook</span>->setUrl(<spanclass="hljs-string">"https://requestb.in/10ujt3c1?uniqid="</span> . uniqid());</div></div></div><divclass="segment"><divclass="comments "><divclass="wrapper"><h1id="event-types">Event Types</h1>
17
+
The URL should be actually accessible over the internet. Having a localhost here would not work.</p>
18
+
<h4id="there-is-an-open-source-tool-http-requestb-in-that-allows-you-to-receive-any-web-requests-to-a-url-given-there-">There is an open source tool <ahref="http://requestb.in/">http://requestb.in/</a> that allows you to receive any web requests to a url given there.</h4>
19
+
<h4id="note-please-note-that-you-need-an-https-url-for-paypal-webhooks-you-can-however-override-the-url-with-https-and-accept">NOTE: Please note that you need an https url for paypal webhooks. You can however override the url with https, and accept</h4>
20
+
<p>any warnings your browser might show you. Also, please note that this is entirely for demo purposes, and you should not
21
+
be using this in production</p></div></div><divclass="code"><divclass="wrapper"><spanclass="hljs-variable">$webhook</span>->setUrl(<spanclass="hljs-string">"https://requestb.in/10ujt3c1?uniqid="</span> . uniqid());</div></div></div><divclass="segment"><divclass="comments "><divclass="wrapper"><h1id="event-types">Event Types</h1>
18
22
<p>Event types correspond to what kind of notifications you want to receive on the given URL.</p></div></div><divclass="code"><divclass="wrapper"><spanclass="hljs-variable">$webhookEventTypes</span> = <spanclass="hljs-keyword">array</span>();
<p>This sample code demonstrates how you can process a
3
+
PayPal Account based Payment.
4
+
API used: /v1/payments/payment
5
+
As you can see, there is only one difference between creating a payment using PayPal with sale or authorize as intent.
6
+
You need to set the proper intent in the request, and the remaining data would be the same</p></div></div><divclass="code"><divclass="wrapper"><spanclass="hljs-keyword">require</span><spanclass="hljs-keyword">__DIR__</span> . <spanclass="hljs-string">'/../bootstrap.php'</span>;
<p>A resource representing a Payer that funds a payment
16
+
For paypal account payments, set payment method
17
+
to 'paypal'.</p></div></div><divclass="code"><divclass="wrapper"><spanclass="hljs-variable">$payer</span> = <spanclass="hljs-keyword">new</span> Payer();
such as shipping, tax.</p></div></div><divclass="code"><divclass="wrapper"><spanclass="hljs-variable">$amount</span> = <spanclass="hljs-keyword">new</span> Amount();
is fulfilling it. </p></div></div><divclass="code"><divclass="wrapper"><spanclass="hljs-variable">$transaction</span> = <spanclass="hljs-keyword">new</span> Transaction();
the above types and intent set to 'sale'</p></div></div><divclass="code"><divclass="wrapper"><spanclass="hljs-variable">$payment</span> = <spanclass="hljs-keyword">new</span> Payment();
ResultPrinter::printError(<spanclass="hljs-string">"Created Payment Authorization Using PayPal. Please visit the URL to Authorize."</span>, <spanclass="hljs-string">"Payment"</span>, <spanclass="hljs-keyword">null</span>, <spanclass="hljs-variable">$request</span>, <spanclass="hljs-variable">$ex</span>);
0 commit comments