PHP code example of adila-sh / pay

1. Go to this page and download the library: Download adila-sh/pay 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/ */

    

adila-sh / pay example snippets


use AdilaPay\AdilaPayClient;
use AdilaPay\Customers\Requests\CreateCustomersRequest;
use AdilaPay\Customers\Requests\ListCustomersRequest;

$client = new AdilaPayClient(getenv('ADILA_PAY_API_KEY'), [
    'timeout' => 30,
    'maxRetries' => 2,
]);

$customers = $client->customers->list(new ListCustomersRequest([
    'organizationId' => getenv('ADILA_PAY_ORGANIZATION_ID'),
    'limit' => 10,
]));

$customer = $client->customers->create(new CreateCustomersRequest([
    'organizationId' => getenv('ADILA_PAY_ORGANIZATION_ID'),
    'idempotencyKey' => 'cliente-integracao-001',
    'name' => 'Cliente de exemplo',
]));

use AdilaPay\AdilaPayClient;
use AdilaPay\Customers\Requests\ListCustomersRequest;
use AdilaPay\Laravel\Facades\AdilaPay;

$customers = AdilaPay::customers()->list(new ListCustomersRequest([
    'organizationId' => config('adila-pay.organization_id'),
]));

class CheckoutController
{
    public function __construct(private AdilaPayClient $adilaPay) {}
}
bash
php artisan vendor:publish --tag=adila-pay-config