Adding Execute Step to Authorize Payment Sample

- Additional Formatting Updates
This commit is contained in:
Jay Patel
2015-07-20 11:33:47 -05:00
parent 0e62ec416f
commit 2929f63859
27 changed files with 60 additions and 120 deletions

View File

@@ -2,10 +2,7 @@
<p>Use this call to void an existing order.
Note: An order cannot be voided if payment has already been partially or fully captured.
API used: POST /v1/payments/orders/<Order-Id>/do-void</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\Payment $payment */</span>
<span class="hljs-variable">$payment</span> = <span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/ExecutePayment.php'</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>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="approval-status">Approval Status</h3>
<span class="hljs-variable">$payment</span> = <span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/ExecutePayment.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="approval-status">Approval Status</h3>
<p>Determine if the user approved the payment or not</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">if</span> (<span class="hljs-keyword">isset</span>(<span class="hljs-variable">$_GET</span>[<span class="hljs-string">'success'</span>]) &amp;&amp; <span class="hljs-variable">$_GET</span>[<span class="hljs-string">'success'</span>] == <span class="hljs-string">'true'</span>) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-the-order">Retrieve the order</h3>
<p>OrderId could be retrieved by parsing the object inside related_resources.</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$transactions</span> = <span class="hljs-variable">$payment</span>-&gt;getTransactions();
<span class="hljs-variable">$transaction</span> = <span class="hljs-variable">$transactions</span>[<span class="hljs-number">0</span>];