PHP code example of jetimob / asaas-sdk-php-laravel
1. Go to this page and download the library: Download jetimob/asaas-sdk-php-laravel 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/ */
jetimob / asaas-sdk-php-laravel example snippets
use Jetimob\Asaas\Facades\Asaas;
use Jetimob\Asaas\Entity\Customer\Customer;
$customer = with(new Customer())
->setName('John Doe')
->setEmail('[email protected]')
->setCpfCnpj('00000000000');
$response = Asaas::customer()->create($customer);
$charging = new Charging();
/**
* Dessa forma irá criar uma cobrança para a conta principal,
* que possua a api key configurada no arquivo asaas.php.
*/
Asaas::charging()->create($charging);
/**
* Dessa forma será criada uma cobrança para essa conta que foi criada agora
*/
$account = new Account();
$response = Asaas::account()->create($account);
$apiKey = $response->getApiKey();
Asaas::charging()->usingToken($apiKey)->create($charging);
bash
php artisan asaas:install