diff --git a/README.md b/README.md index 80f5b67..59efdb8 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ __Welcome to PayPal PHP SDK__. This repository contains PayPal's PHP SDK and sam ## Please Note > **The Payment Card Industry (PCI) Council has [mandated](http://blog.pcisecuritystandards.org/migrating-from-ssl-and-early-tls) that early versions of TLS be retired from service. All organizations that handle credit card information are required to comply with this standard. As part of this obligation, PayPal is updating its services to require TLS 1.2 for all HTTPS connections. At this time, PayPal will also require HTTP/1.1 for all connections. [Click here](https://github.com/paypal/tls-update) for more information** -> **If you have the SDK v1.6.2 or higher installed, you can easily test this by running the [TLSCheck sample](sample/tls/TlsCheck.php).** +> **Connections to the sandbox environment use only TLS 1.2.** ## SDK Documentation diff --git a/sample/doc/assets/behavior.js b/sample/doc/assets/behavior.js index b0a183f..6716c04 100644 --- a/sample/doc/assets/behavior.js +++ b/sample/doc/assets/behavior.js @@ -1939,34 +1939,6 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 ] } ] - }, { - "type": "folder", - "data": { - "path": "tls", - "title": "tls" - }, - "depth": 1, - "children": [ - { - "type": "file", - "data": { - "language": { - "nameMatchers": [{}, ".fbp"], - "pygmentsLexer": "php", - "singleLineComment": ["//"], - "ignorePrefix": "}", - "foldPrefix": "^", - "name": "PHP" - }, - "sourcePath": "/Users/japatel/paypal/github/PayPal-PHP-SDK/sample/tls/TlsCheck.php", - "projectPath": "tls/TlsCheck.php", - "targetPath": "tls/TlsCheck", - "pageTitle": "tls/TlsCheck", - "title": "TlsCheck" - }, - "depth": 2 - } - ] }, { "type": "folder", "data": { diff --git a/sample/doc/tls/TlsCheck.html b/sample/doc/tls/TlsCheck.html deleted file mode 100644 index c66cfae..0000000 --- a/sample/doc/tls/TlsCheck.html +++ /dev/null @@ -1,46 +0,0 @@ -tls/TlsCheck
tls/TlsCheck.php
<?php

Create Payment using PayPal as payment method

-

This sample code demonstrates how you can process a -PayPal Account based Payment. -API used: /v1/payments/payment

require __DIR__ . '/../bootstrap.php'; -use PayPal\Api\Amount; -use PayPal\Api\Payer; -use PayPal\Api\Payment; -use PayPal\Api\RedirectUrls; -use PayPal\Api\Transaction;

TLS Check

-

We will add a separate unique endpoint specifically set for testing TLS check instead of using -our conventional sandbox endpoint. -TLS ENDPOINT: https://test-api.sandbox.paypal.com -To test your own implementation to verify it TLS is successfully supported in your application, you can follow -the following steps.

-
    -
  1. Create an APIContext object as usual. (No Change Required).
  2. -
  3. Add Configs as shown below to your apiContext object -Note: Explicitly disabling caching for specific testing.
  4. -
$apiContext->setConfig(array('service.EndPoint'=>"https://test-api.sandbox.paypal.com", 'cache.enabled'=>false));
    -
  1. Thats it. Run your code, and see if it works as normal.
  2. -
  3. You can check sdk logs to verify it is infact pointing to the above URL instead of default sandbox one.
  4. -

Create a Payment for testing

-

We will create a conventional paypal payment to verify its creation

$payer = new Payer(); -$payer->setPaymentMethod("paypal"); -$amount = new Amount(); -$amount->setCurrency("USD") - ->setTotal(20); -$transaction = new Transaction(); -$transaction->setAmount($amount); -$baseUrl = getBaseUrl(); -$redirectUrls = new RedirectUrls(); -$redirectUrls->setReturnUrl("$baseUrl/ExecutePayment.php?success=true") - ->setCancelUrl("$baseUrl/ExecutePayment.php?success=false"); -$payment = new Payment(); -$payment->setIntent("sale") - ->setPayer($payer) - ->setRedirectUrls($redirectUrls) - ->setTransactions(array($transaction));

For Sample Purposes Only.

$request = clone $payment; -$curl_info = curl_version(); -try { - $payment->create($apiContext); -} catch (Exception $ex) {

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printError("FAILURE: SECURITY WARNING: TLSv1.2 is not supported on this system. Please upgrade your curl to atleast 7.34.0.<br /> - Current Curl Version: " . $curl_info['version'] . "<br /> - Current OpenSSL Version:" . $curl_info['ssl_version'], "Payment", null, $request, $ex); - exit(1); -}

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printResult("<b>SUCCESS</b>: Your server supports TLS protocols required for secure connection to PayPal Servers. <br /> - Current Curl Version: " . $curl_info['version'] . "<br /> - Current OpenSSL Version:" . $curl_info['ssl_version'], null, null, null, "SUCCESS. Your system supports TLSv1.2"); - -return $payment;
diff --git a/sample/index.php b/sample/index.php index 974f99e..77b56c3 100644 --- a/sample/index.php +++ b/sample/index.php @@ -232,30 +232,6 @@ if (PHP_SAPI == 'cli') {
-
-
-

TLS CHECK

-
- - -
-

setConfig(array('service.EndPoint'=>"https://test-api.sandbox.paypal.com", 'cache.enabled'=>false)); -// 3. Thats it. Run your code, and see if it works as normal. -// 4. You can check sdk logs to verify it is infact pointing to the above URL instead of default sandbox one. - -// ### Create a Payment for testing -// We will create a conventional paypal payment to verify its creation -$payer = new Payer(); -$payer->setPaymentMethod("paypal"); -$amount = new Amount(); -$amount->setCurrency("USD") - ->setTotal(20); -$transaction = new Transaction(); -$transaction->setAmount($amount); -$baseUrl = getBaseUrl(); -$redirectUrls = new RedirectUrls(); -$redirectUrls->setReturnUrl("$baseUrl/ExecutePayment.php?success=true") - ->setCancelUrl("$baseUrl/ExecutePayment.php?success=false"); -$payment = new Payment(); -$payment->setIntent("sale") - ->setPayer($payer) - ->setRedirectUrls($redirectUrls) - ->setTransactions(array($transaction)); - - -// For Sample Purposes Only. -$request = clone $payment; -$curl_info = curl_version(); -try { - $payment->create($apiContext); -} catch (Exception $ex) { - // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY - ResultPrinter::printError("FAILURE: SECURITY WARNING: TLSv1.2 is not supported on this system. Please upgrade your curl to atleast 7.34.0.
- Current Curl Version: " . $curl_info['version'] . "
- Current OpenSSL Version:" . $curl_info['ssl_version'], "Payment", null, $request, $ex); - exit(1); -} - - -// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY -ResultPrinter::printResult("SUCCESS: Your server supports TLS protocols required for secure connection to PayPal Servers.
- Current Curl Version: " . $curl_info['version'] . "
- Current OpenSSL Version:" . $curl_info['ssl_version'], null, null, null, "SUCCESS. Your system supports TLSv1.2"); - -return $payment;