PHP code example of adrianovcar / asaas-php-sdk

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

    

adrianovcar / asaas-php-sdk example snippets




drianovcar\Asaas\Adapter\GuzzleHttpAdapter;
use Adrianovcar\Asaas\Asaas;

$adapter = new GuzzleHttpAdapter('your_access_token');

// Instantiate the Asaas client using the previously created adapter instance.
$asaas = new Asaas($adapter);

// Note: If the second parameter is not informed, the API enters production mode
$asaas = new Asaas($adapter, 'sandbox|production');

// Returns the list of customers according to the filter used (https://docs.asaas.com/reference/listar-clientes)
$clientes = $asaas->customer()->getAll(array $filtros);

// Returns the customer's data according to the Id
$cobranca = $asaas->customer()->getById('cus_123123');

// Returns the customer's data according to the email
$clientes = $asaas->customer()->getByEmail('[email protected]');

// Inserts a new customer
$cobranca = $asaas->customer()->create(array $dadosCliente);

// Updates the customer's data
$cobranca = $asaas->customer()->update('cus_123123', array $dadosCliente);

// Deletes a customer
$asaas->customer()->delete('cus_123123');

// Returns the list of payments
$cobrancas = $asaas->payment()->getAll(array $filtros);

// Returns the payment data according to the Id
$cobranca = $asaas->payment()->getById('pay_123123');

// Returns the list of payments according to the Customer Id
$cobrancas = $asaas->payment()->getByCustomer($customer_id);

// Returns the list of payments according to the Subscriptions Id
$cobrancas = $asaas->payment()->getBySubscription($subscription_id);

// Inserts a new payment
$cobranca = $asaas->payment()->create(array $dadosCobranca);

// Updates the payment data
$cobranca = $asaas->payment()->update('pay_123123', array $dadosCobranca);

// Deletes a payment
$asaas->payment()->delete('pay_123123');

// Returns the list of subscriptions
$assinaturas = $asaas->subscription()->getAll(array $filtros);

// Returns the subscription data according to the Id
$assinatura = $asaas->subscription()->getById('sub_123123');

// Returns the list of subscriptions according to the Customer Id
$assinaturas = $asaas->subscription()->getByCustomer($customer_id);

// Inserts a new subscription
$assinatura = $asaas->subscription()->create(array $dadosAssinatura);

// Updates the subscription data
$assinatura = $asaas->subscription()->update('sub_123123', array $dadosAssinatura);

// Deletes a subscription
$asaas->subscription()->delete('sub_123123');

// Returns the list of notifications
$notificacoes = $asaas->notification()->getAll(array $filtros);

// Returns the notification data according to the Id
$notificacao = $asaas->notification()->getById('not_123123');

// Returns the list of notifications according to the Customer Id
$notificacoes = $asaas->notification()->getByCustomer($customer_id);

// Inserts a new notification
$notificacao = $asaas->notification()->create(array $dadosNotificacao);

// Updates the notification data
$notificacao = $asaas->notification()->update('not_123123', array $dadosNotificacao);

// Deletes a notification
$asaas->notification()->delete('not_123123');

// Returns the list of cities
$cidades = $asaas->city()->getAll(array $filtros);

// Returns the city data according to the Id
$action123 = $asaas->city()->getById(123);
bash
composer