This library wants to be a PHP client for the PayPal REST API.
There is an official SDK and you can find it here.
I tried it and I tried to contribute on it (the tests were calling the actual paypal sandbox). But I needed a simpler and OOP library, and I did not have the time to contribute as much as I think is needed on the official one, therefore I did this one.
I'm working on a first stable realease that should be out before August 15th.
Feedback, PR and contribution are welcome.
At the moment the only PayPal REST API calls implemented are:
- Require an access token: https://developer.paypal.com/docs/api/#authentication--headers
- Create a payment (only with "paypal" and "credit_card" payment methods): https://developer.paypal.com/docs/api/#create-a-payment
- Execute a payment: https://developer.paypal.com/docs/api/#execute-an-approved-paypal-payment
- Authorize and capture a payment: https://developer.paypal.com/docs/integration/direct/capture-payment/
- Validation of json schema for payment request body: Json Schema, PHP Json Schema validator, PayPal REST API objects
Run
composer require p16/paypal-rest-api-client:1.0.0
or edit your composer.json as follow
...
"require": {
"p16/paypal-rest-api-client": "1.0.0"
...
}
...
and then run
composer update p16/paypal-rest-api-client
Donwload the repository
Run
composer install
From the root folder run
./vendor/bin/phpunit -c .
Using the library
- Direct payment with paypal method
- Direct payment with credit card method
- Payment authorization and capture with paypal method
- Payment authorization and capture with credit card method
PayPal Json schema validation
A Json Schema validator is used to validate a call request body. You can find all the available schema definition here.
TO-DO for release 1.1.0
-
Move PayPalJsonSchemaValidator into a standalone repo (?)
-
Make the builder aware of the PayPalJsonSchemaValidator, so that they can validate what they are building when building from/to json
-
Add strict validation to model classes (?)
TO-DO for release 1.2.0
- Add "billing plans" feature
Licensed under the MIT license
Read LICENSE for more information