phpjuice / paypal-http-client
PHP Http Client for PayPal's REST API
Installs: 18 742
Dependents: 1
Suggesters: 0
Security: 0
Stars: 7
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: ^7.4 || ^8.0 || ^8.1
- ext-json: *
- guzzlehttp/guzzle: ^7.0
- guzzlehttp/psr7: ^1.6 || ^2.0
Requires (Dev)
- pestphp/pest: ^1.18
- phpstan/phpstan: ^0.12
- squizlabs/php_codesniffer: ^3.4
README
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.
Installation
This Package requires PHP 7.4 or higher.
One can install this package via Composer.
composer require "phpjuice/paypal-http-client"
Setup
PayPal HTTP Client is designed to simplify using the new PayPal checkout api in your app.
Setup Credentials
Get client ID and client secret by visiting the PayPal Developer Account and generating a REST API app.
Setup Paypal Client
In order to communicate with PayPal platform we need to set up a client first :
Create a client with sandbox environment:
<?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);
Create a client with production 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);
Changelog
Please see the CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details and a todo list.
Security
If you discover any security related issues, please email author instead of using the issue tracker.
Credits
License
Please see the Licence file.