utopia-php / pay
A simple library to manage payments using multiple payment provider adapters
Installs: 2 843
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 6
Forks: 2
Open Issues: 3
Requires
- php: >=8.0
Requires (Dev)
- laravel/pint: 1.2.*
- phpstan/phpstan: 1.9.x-dev
- phpunit/phpunit: ^9.4
This package is auto-updated.
Last update: 2024-12-22 07:43:40 UTC
README
Utopia Pay library is simple and lite library for accepting payments. This library is aiming to be as simple and easy to learn and use. This library is maintained by the Appwrite team.
Although this library is part of the Utopia Framework, it is dependency free and can be used as standalone with any other PHP project or framework.
Getting Started
Install using composer:
composer require utopia-php/pay
Get Secret Key and Publishable Key from your Stripe Account.
require_once '../vendor/autoload.php'; use Utopia\Pay\Pay; use Utopia\Pay\Adapter\Stripe; $pay = new Pay(new Stripe('PUBLISHABLE_KEY', 'SECRET_KEY')); $customer = $pay->createCustomer('Customer One', 'customer@gmail.com'); \var_dump($customer); $pay->setCurrency('INR'); $purchase = $pay->purchase( 5000, // price $customer['id'], // customer ID null, // card ID [ 'description' => 'some countries require descriptions' ] ); var_dump($purchase);
System Requirements
Utopia Pay requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible.
Contributing
All code contributions - including those of people having commit access - must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.
Fork the project, create a feature branch, and send us a pull request.
You can refer to the Contributing Guide for more info.
Testing
vendor/bin/phpunit --configuration phpunit.xml
Copyright and license
The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php