forked from LiveCarta/PayPal-PHP-SDK
Remove credit card samples (#896)
* removed credit card payment samples * update docs to reflect sample changes * update readme to recommend braintree for direct card payments
This commit is contained in:
@@ -2,15 +2,12 @@
|
||||
<p>This sample code demonstrates how you can capture
|
||||
a previously authorized payment.
|
||||
API used: /v1/payments/payment
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#capture-an-authorization">https://developer.paypal.com/webapps/developer/docs/api/#capture-an-authorization</a></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Authorization $authorization */</span>
|
||||
<span class="hljs-variable">$authorization</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'GetAuthorization.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#capture-an-authorization">https://developer.paypal.com/webapps/developer/docs/api/#capture-an-authorization</a></p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Authorization</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Capture</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="capture-payment">Capture Payment</h3>
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Capture</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Replace $authorizationId with any static Id you might already have. </p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$authorizationId</span> = <span class="hljs-string">"<your authorization id here>"</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="capture-payment">Capture Payment</h3>
|
||||
<p>You can capture and process a previously created authorization
|
||||
by invoking the $authorization->capture method
|
||||
with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
|
||||
<span class="hljs-variable">$authId</span> = <span class="hljs-variable">$authorization</span>->getId();
|
||||
with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieve the authorization</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span> = Authorization::get(<span class="hljs-variable">$authorizationId</span>, <span class="hljs-variable">$apiContext</span>);
|
||||
|
||||
<span class="hljs-variable">$amt</span> = <span class="hljs-keyword">new</span> Amount();
|
||||
<span class="hljs-variable">$amt</span>->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||
@@ -23,4 +20,4 @@ with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)<
|
||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</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::printResult(<span class="hljs-string">"Capture Payment"</span>, <span class="hljs-string">"Authorization"</span>, <span class="hljs-variable">$getCapture</span>->getId(), <span class="hljs-variable">$capture</span>, <span class="hljs-variable">$getCapture</span>);
|
||||
|
||||
<span class="hljs-keyword">return</span> <span class="hljs-variable">$getCapture</span>;</div></div></div></div></body></html>
|
||||
<span class="hljs-keyword">return</span> <span class="hljs-variable">$getCapture</span>;</div></div></div></div></body></html>
|
||||
Reference in New Issue
Block a user