1. Go to this page and download the library: Download abacatepay/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/ */
abacatepay / php-sdk example snippets
use AbacatePay\Clients\Client;
Client::setToken($_ENV["ABACATEPAY_TOKEN"]);
use AbacatePay\Clients\BillingClient;
$billingClient = new BillingClient();
$billings = $billingClient->list();
use AbacatePay\Resources\Billing;
use AbacatePay\Resources\Billing\Product;
use AbacatePay\Resources\Billing\Metadata as BillingMetadata;
use AbacatePay\Enums\Billing\Methods;
use AbacatePay\Enums\Billing\Frequencies;
use AbacatePay\Resources\Customer;
use AbacatePay\Resources\Customer\Metadata as CustomerMetadata;
$billing = $billingClient->create(new Billing([
'frequency' => Frequencies::ONE_TIME,
'methods' => [Methods::PIX],
'products' => [
new Product([
'external_id' => 'abc_123',
'name' => 'Product A',
'description' => 'Description of product A',
'quantity' => 1,
'price' => 100 // Price in cents
])
],
'metadata' => new BillingMetadata([
'return_url' => 'https://www.abacatepay.com',
'completion_url' => 'https://www.abacatepay.com'
]),
'customer' => new Customer([
'metadata' => new CustomerMetadata([
'name' => 'John Doe',
'cellphone' => '01912341234',
'email' => '[email protected]',
'tax_id' => '13827826837'
])
])
]));