1. Go to this page and download the library: Download astrotechlabs/asaas-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/ */
astrotechlabs / asaas-sdk example snippets
use AstrotechLabs\AsaasSdk\AssasGateway;
use AstrotechLabs\AsaasSdk\AssasGatewayParams;
use AstrotechLabs\AsaasSdk\Pix\CreatePixCharge\Dto\PixData;
use AstrotechLabs\AsaasSdk\Pix\Enum\BillingTypes;
$asaasGateway = new AssasGateway(new AssasGatewayParams(
apiKey: 'xxxxxxxxxx',
// isSandBox: true (opcional)
));
$pixChargeResponse = $asaasGateway->createPixCharge(new PixData(
customer: new CustomerData(
name: 'Joãozinho Barbosa',
phone: '999999999',
cpfCnpj: '01234567890'
),
billingType: BillingTypes::PIX,
value: 100.00,
dueDate: "2023-12-20" // Deve ser informada uma data futura
));
print_r($pixChargeResponse);
use AstrotechLabs\AsaasSdk\AssasGateway;
use AstrotechLabs\AsaasSdk\AssasGatewayParams;
use AstrotechLabs\AsaasSdk\Transfer\CreateTransferCharge\Dto\TransferData;
use AstrotechLabs\AsaasSdk\Transfer\Enum\PixKeyTypes;
$asaasGateway = new AssasGateway(new AssasGatewayParams(
apiKey: $_ENV['ASAAS_API_KEY'],
isSandBox: false
));
$transferChargeResponse = $asaasGateway->createTransferCharge(new TransferData(
value: 1,
pixAddressKey: 'xxxxxxxx-xxxxx-xxxxx-xxxx',
pixAddressKeyType: PixKeyTypes::RANDOM_KEY
));
print_r($transferChargeResponse);
bash
$ php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.