1. Go to this page and download the library: Download globalis/chargebee-php-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
globalis / chargebee-php-sdk example snippets
use Globalis\Chargebee\Client as ChargebeeClient;
use Http\Client\Exception\HttpException;
$chargebee = new ChargebeeClient('{site}', '{site_api_key}');
try {
// List last created subscription:
$response = $chargebee->subscription()->list([
"limit" => 1,
"sort_by[desc]" => "created_at",
"status[is]" => "active",
]);
} catch (HttpException $e) {
// Get API error details:
$response = json_decode($e->getResponse()->getBody(), true);
echo sprintf("Error: (%s) %s", $response["api_error_code"], $response["message"]);
}
use Globalis\Chargebee\Client as Chargebee;
use Globalis\Chargebee\Events\EventChargebeeApiResponseSuccess as EventResponseSuccess;
use Globalis\Chargebee\Events\EventChargebeeApiResponseError as EventResponseError;
Chargebee::onApiResponseSuccess(function (EventResponseSuccess $event) {
// $event contains data about the API request and response
// do something
});
Chargebee::onApiResponseError(function (EventResponseError $event) {
// $event contains data about the API request and response
// do something
});
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.