This Package is a PHP Http Client. It provides a simple, fluent API to interact with PayPal rest API.
To learn all about it, head over to the extensive documentation.
This Package requires PHP 7.4 or higher.
One can install this package via Composer.
composer require "phpjuice/paypal-http-client"
PayPal HTTP Client is designed to simplify using the new PayPal checkout api in your app.
Get client ID and client secret by visiting the PayPal Developer Account and generating a REST API app.
In order to communicate with PayPal platform we need to set up a client first :
<?php
use PayPal\Http\Environment\SandboxEnvironment;
use PayPal\Http\PayPalClient;
// client id and client secret retrieved from PayPal
$clientId = "<<PAYPAL-CLIENT-ID>>";
$clientSecret = "<<PAYPAL-CLIENT-SECRET>>";
// create a new sandbox environment
$environment = new SandboxEnvironment($clientId, $clientSecret);
// create a new client
$client = new PayPalClient($environment);
<?php
use PayPal\Http\Environment\ProductionEnvironment;
use PayPal\Http\PayPalClient;
// client id and client secret retrieved from PayPal
$clientId = "<<PAYPAL-CLIENT-ID>>";
$clientSecret = "<<PAYPAL-CLIENT-SECRET>>";
// create a new sandbox environment
$environment = new ProductionEnvironment($clientId, $clientSecret);
// create a new client
$client = new PayPalClient($environment);
Please see the CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details and a todo list.
If you discover any security related issues, please email author instead of using the issue tracker.
Please see the Licence file.