Skip to content

Repository files navigation

Utopia Pay

Important

This repository is a read-only mirror of packages/pay in Appwrite's private Cloud repository (appwrite-labs/cloud). Development happens there, so pull requests and issues opened here are closed automatically.

Billing objects and payment processor adapters (Stripe) for PHP, maintained by the Appwrite team.

Getting started

composer require utopia-php/pay
use Utopia\Pay\Adapter\Stripe;
use Utopia\Pay\Pay;

$pay = new Pay(new Stripe('SECRET_KEY'));
$pay->setCurrency('USD');

$customer = $pay->createCustomer('Customer One', 'customer@example.com');
$purchase = $pay->purchase(5000, $customer['id'], $paymentMethodId);

authorize() holds funds that capture() charges or cancelAuthorization() releases; customers, payment methods, refunds, future payments (setup intents) and disputes have their own methods on Pay.

Tests

composer test                                       # unit tier, no network
STRIPE_SECRET=sk_test_... phpunit --group stripe    # calls Stripe's test mode

License

MIT

About

Lite & fast micro PHP payments abstraction library that is **easy to use**.

Topics

Resources

Stars

10 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages