Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mcoil.corals.io/vendor/paypal/rest-api-sdk-php/sample/doc/tls/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mcoil.corals.io/vendor/paypal/rest-api-sdk-php/sample/doc/tls/TlsCheck.html
<!DOCTYPE html><html lang="en"><head><title>tls/TlsCheck</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="tls/TlsCheck"><meta name="groc-project-path" content="tls/TlsCheck.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">tls/TlsCheck.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-paypal-as-payment-method">Create Payment using PayPal as payment method</h1>
<p>This sample code demonstrates how you can process a 
PayPal Account based Payment.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.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>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Details</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Item</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">ItemList</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payer</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payment</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">RedirectUrls</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Transaction</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="tls-check">TLS Check</h2>
<p>We will add a separate unique endpoint specifically set for testing TLS check instead of using
our conventional sandbox endpoint.
TLS ENDPOINT: <a href="https://test-api.sandbox.paypal.com">https://test-api.sandbox.paypal.com</a>
To test your own implementation to verify it TLS is successfully supported in your application, you can follow
the following steps.</p>
<ol>
<li>Create an APIContext object as usual. (No Change Required).</li>
<li>Add Configs as shown below to your apiContext object</li>
</ol></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$apiContext</span>-&gt;setConfig(<span class="hljs-keyword">array</span>(<span class="hljs-string">'service.EndPoint'</span>=&gt;<span class="hljs-string">"https://test-api.sandbox.paypal.com"</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><ol>
<li>Thats it. Run your code, and see if it works as normal.</li>
<li>You can check sdk logs to verify it is infact pointing to the above URL instead of default sandbox one.</li>
</ol></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="create-a-payment-for-testing">Create a Payment for testing</h3>
<p>We will create a conventional paypal payment to verify its creation</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payer</span> = <span class="hljs-keyword">new</span> Payer();
<span class="hljs-variable">$payer</span>-&gt;setPaymentMethod(<span class="hljs-string">"paypal"</span>);
<span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amount</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>)
    -&gt;setTotal(<span class="hljs-number">20</span>);
<span class="hljs-variable">$transaction</span> = <span class="hljs-keyword">new</span> Transaction();
<span class="hljs-variable">$transaction</span>-&gt;setAmount(<span class="hljs-variable">$amount</span>);
<span class="hljs-variable">$baseUrl</span> = getBaseUrl();
<span class="hljs-variable">$redirectUrls</span> = <span class="hljs-keyword">new</span> RedirectUrls();
<span class="hljs-variable">$redirectUrls</span>-&gt;setReturnUrl(<span class="hljs-string">"$baseUrl/ExecutePayment.php?success=true"</span>)
    -&gt;setCancelUrl(<span class="hljs-string">"$baseUrl/ExecutePayment.php?success=false"</span>);
<span class="hljs-variable">$payment</span> = <span class="hljs-keyword">new</span> Payment();
<span class="hljs-variable">$payment</span>-&gt;setIntent(<span class="hljs-string">"sale"</span>)
    -&gt;setPayer(<span class="hljs-variable">$payer</span>)
    -&gt;setRedirectUrls(<span class="hljs-variable">$redirectUrls</span>)
    -&gt;setTransactions(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$transaction</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>For Sample Purposes Only.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$request</span> = <span class="hljs-keyword">clone</span> <span class="hljs-variable">$payment</span>;
<span class="hljs-variable">$curl_info</span> = curl_version();
<span class="hljs-keyword">try</span> {
    <span class="hljs-variable">$payment</span>-&gt;create(<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">"FAILURE: SECURITY WARNING: TLSv1.2 is not supported on this system. Please upgrade your curl/openssl to enable TLSv1.2. &lt;br /&gt; - Your Current SSL Version is : "</span> . <span class="hljs-variable">$curl_info</span>[<span class="hljs-string">'ssl_version'</span>], <span class="hljs-string">"Payment"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$request</span>, <span class="hljs-variable">$ex</span>);
    <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">"&lt;b&gt;SUCCESS&lt;/b&gt;: Your server supports TLS protocols required for secure connection to PayPal Servers. &lt;br /&gt; - Your Current SSL Version is : "</span> . <span class="hljs-variable">$curl_info</span>[<span class="hljs-string">'ssl_version'</span>], <span class="hljs-keyword">null</span>, <span class="hljs-keyword">null</span>, <span class="hljs-keyword">null</span>, <span class="hljs-string">"SUCCESS. Your system supports TLSv1.2"</span>);

<span class="hljs-keyword">return</span> <span class="hljs-variable">$payment</span>;</div></div></div></div></body></html>

Spamworldpro Mini