PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
give / vendor / paypal / paypal-checkout-sdk / samples / PayPalClient.php

PayPalClient.php in GiveWP – Donation Plugin and Fundraising Platform 4.18.0, at vendor/paypal/paypal-checkout-sdk/samples/PayPalClient.php

36 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sample;
4
5 use PayPalCheckoutSdk\Core\PayPalHttpClient;
6 use PayPalCheckoutSdk\Core\SandboxEnvironment;
7
8 ini_set('error_reporting', E_ALL); // or error_reporting(E_ALL);
9 ini_set('display_errors', '1');
10 ini_set('display_startup_errors', '1');
11
12 class PayPalClient
13 {
14 /**
15 * Returns PayPal HTTP client instance with environment which has access
16 * credentials context. This can be used invoke PayPal API's provided the
17 * credentials have the access to do so.
18 */
19 public static function client()
20 {
21 return new PayPalHttpClient(self::environment());
22 }
23
24 /**
25 * Setting up and Returns PayPal SDK environment with PayPal Access credentials.
26 * For demo purpose, we are using SandboxEnvironment. In production this will be
27 * ProductionEnvironment.
28 */
29 public static function environment()
30 {
31 $clientId = getenv("CLIENT_ID") ?: "<<PAYPAL-CLIENT-ID>>";
32 $clientSecret = getenv("CLIENT_SECRET") ?: "<<PAYPAL-CLIENT-SECRET>>";
33 return new SandboxEnvironment($clientId, $clientSecret);
34 }
35 }
36