PHP code example of andrefelipe18 / abacatepay-php

1. Go to this page and download the library: Download andrefelipe18/abacatepay-php 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/ */

    

andrefelipe18 / abacatepay-php example snippets




use Andrefelipe18\AbacatePay\AbacatePay;

$abacatePay = new AbacatePay('your_api_token');

$customer = $abacatePay->customer()->create(
    new \Andrefelipe18\AbacatePay\Models\Customer(
        '[email protected]',
        'Customer Name',
        '+1234567890',
        '123456789'
    )
);

$customers = $abacatePay->customer()->list();

$billing = $abacatePay->billing()->create(
    'ONE_TIME',
    ['PIX'],
    [
        new \Andrefelipe18\AbacatePay\Models\Product(
            'product_1',
            'Product 1',
            'Product 1 description',
            1,
            1000
        ),
        new \Andrefelipe18\AbacatePay\Models\Product(
            'product_2',
            'Product 2',
            'Product 2 description',
            1,
            2000
        ),
    ],
    'https://example.com/return',
    'https://example.com/completion',
    $customer->data->metadata,
);

$billings = $abacatePay->billing()->list();
bash
composer