jsdecena / omnipay-chargebee
Omnipay Chargebee package
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
Requires
- php: ^8.0
- chargebee/chargebee-php: ^3.3
- illuminate/collections: ^8.0
- illuminate/support: ^8.0
- league/omnipay: ^3
Requires (Dev)
- mockery/mockery: ^1.5
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.5
README
A Chargebee driver for Omnipay PHP payment processing library.
Installation
composer require league/omnipay:^3 jsdecena/omnipay-chargebee
Usage
To start charging your customer
1. Make an Omnipay Gateway:
$gateway = Omnipay::create('Chargebee');
2. Initialize your site settings
$gateway->authorize(['site_name' => '<YOUR-SITE-NAME>', 'site_api_key' => '<YOUR-API-KEY>']);
3. Make a transaction
You need to pass in the subscriber_id
and the item_price_id
to make a subscription.
$payment = $gateway->purchase([ 'subscriber_id' => '16BR23Sxald0PM3m', 'subscription_items' => [ [ 'billing_cycles' => 12, 'free_quantity' => 0, 'item_price_id' => 'cbdemo_advanced-USD-monthly', 'quantity' => 1 ] ] ]);
This will return a Charge
object containing information about your subscription.
Customers
Retrieve all your customers and get the id
of your subscriber which will be used in making the transaction
$gateway->authorize(['site_name' => '<YOUR-SITE-NAME>', 'site_api_key' => '<YOUR-API-KEY>']); $payment = $gateway->getSubscribers();
Retrieve your customer with their email and get the id
of your subscriber which will be used in making the transaction
$gateway->authorize(['site_name' => '<YOUR-SITE-NAME>', 'site_api_key' => '<YOUR-API-KEY>']); $payment = $gateway->getSubscribers('john@doe.com');