PHPackages                             jorzelalves/laravel-asaas - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. jorzelalves/laravel-asaas

ActiveLibrary[Payment Processing](/categories/payments)

jorzelalves/laravel-asaas
=========================

Package for integration with Asaas.

2.0.2(2w ago)01.6k↓41.1%1MITPHPPHP ^8.0

Since Mar 26Pushed 2w ago1 watchersCompare

[ Source](https://github.com/Jorzel21/laravel-asaas)[ Packagist](https://packagist.org/packages/jorzelalves/laravel-asaas)[ RSS](/packages/jorzelalves-laravel-asaas/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (9)Versions (17)Used By (0)

Laravel Asaas
=============

[](#laravel-asaas)

Pacote Laravel para integrar com a API de pagamentos [Asaas](https://www.asaas.com/). Oferece Facade e classes para gerenciar clientes, cobranças, assinaturas, parcelamentos, notas fiscais, links de pagamento, antecipações, finanças, transferências, subcontas, webhooks e chaves Pix.

Requisitos
----------

[](#requisitos)

- PHP &gt;= 8.0
- Laravel &gt;= 10.0

Instalação
----------

[](#instalação)

```
composer require jorzelalves/laravel-asaas
```

Publique o arquivo de configuração:

```
php artisan asaas:publish
# ou
php artisan vendor:publish --provider="Asaas\AsaasServiceProvider" --tag=config
```

Adicione as variáveis de ambiente no `.env`:

```
ASAAS_BASE_URL=https://api.asaas.com/
ASAAS_API_KEY=sua_chave_aqui
```

Para ambiente sandbox:

```
ASAAS_BASE_URL=https://sandbox.asaas.com/api/
```

Uso
---

[](#uso)

A API key é passada por parâmetro em cada chamada, permitindo uso multi-tenant com chaves diferentes por subconta:

```
use Asaas\Facades\Asaas;

$customer = Asaas::customer($apiKey)->create([...]);
$payment = Asaas::payment($apiKey)->create([...]);
```

Todas as respostas seguem o formato:

```
[
    'code' => 200,                // HTTP status code
    'response' => [...]           // Dados da API
]
```

---

Módulos
-------

[](#módulos)

### Customer (Clientes)

[](#customer-clientes)

```
$customer = Asaas::customer($apiKey);

// Criar
$customer->create([
    'name' => 'João Silva',
    'cpfCnpj' => '12345678901',
    'email' => 'joao@email.com',
    'phone' => '11999999999',
]);

// Listar
$customer->list(['name' => 'João']);

// Buscar
$customer->get('cus_xxx');

// Atualizar
$customer->update('cus_xxx', ['name' => 'João Santos']);

// Remover
$customer->delete('cus_xxx');

// Restaurar removido
$customer->restoreRemovedCustomer('cus_xxx');

// Notificações do cliente
$customer->retriveNotificationsFromCustomer('cus_xxx');
```

---

### Payment (Cobranças)

[](#payment-cobranças)

```
$payment = Asaas::payment($apiKey);

// Criar cobrança (PIX, BOLETO ou CREDIT_CARD)
$payment->create([
    'customer' => 'cus_xxx',
    'billingType' => 'PIX',
    'value' => 100.00,
    'dueDate' => '2026-06-01',
    'description' => 'Cobrança de teste',
]);

// Criar cobrança com cartão de crédito
$payment->createWithCreditCard([
    'customer' => 'cus_xxx',
    'billingType' => 'CREDIT_CARD',
    'value' => 100.00,
    'dueDate' => '2026-06-01',
    'creditCard' => [
        'holderName' => 'João Silva',
        'number' => '4111111111111111',
        'expiryMonth' => '12',
        'expiryYear' => '2028',
        'ccv' => '123',
    ],
    'creditCardHolderInfo' => [
        'name' => 'João Silva',
        'email' => 'joao@email.com',
        'cpfCnpj' => '12345678901',
        'postalCode' => '01001000',
        'addressNumber' => '100',
        'phone' => '11999999999',
    ],
    'remoteIp' => '127.0.0.1',
]);

// Listar
$payment->list(['customer' => 'cus_xxx']);

// Buscar
$payment->get('pay_xxx');

// Atualizar
$payment->update('pay_xxx', [...]);

// Remover
$payment->delete('pay_xxx');

// Restaurar removido
$payment->restore('pay_xxx');

// Status do pagamento
$payment->getStatus('pay_xxx');

// Informações de cobrança
$payment->getBillingInfo('pay_xxx');

// Informações de visualização
$payment->getViewingInfo('pay_xxx');

// QR Code Pix
$payment->getQrCodeForPix('pay_xxx');

// Linha digitável do boleto
$payment->getDigitableBillLine('pay_xxx');

// Capturar pré-autorização
$payment->capturePaymentWithPreAuthorization('pay_xxx');

// Pagar com cartão de crédito
$payment->payChargeWithCreditCard('pay_xxx');

// Confirmar recebimento em dinheiro
$payment->payed('pay_xxx', ['paymentDate' => '2026-06-01', 'value' => 100.00]);

// Desfazer confirmação de recebimento
$payment->undoCashReceipt('pay_xxx');

// Estorno
$payment->refund('pay_xxx', ['value' => 50.00, 'description' => 'Estorno parcial']);

// Listar estornos
$payment->getRefunds('pay_xxx');

// Estorno de boleto
$payment->refundBankSlip('pay_xxx');

// Simulador de vendas
$payment->simulate(['value' => 100.00, 'installmentCount' => 3]);

// Limites de pagamento
$payment->getLimits();

// Escrow
$payment->getEscrow('pay_xxx');
```

---

### Subscription (Assinaturas)

[](#subscription-assinaturas)

```
$subscription = Asaas::subscription($apiKey);

// Criar assinatura
$subscription->create([
    'customer' => 'cus_xxx',
    'billingType' => 'PIX',
    'value' => 49.90,
    'nextDueDate' => '2026-07-01',
    'cycle' => 'MONTHLY',
    'description' => 'Plano mensal',
]);

// Criar assinatura com cartão de crédito
$subscription->createWithCreditCard([
    'customer' => 'cus_xxx',
    'billingType' => 'CREDIT_CARD',
    'value' => 49.90,
    'nextDueDate' => '2026-07-01',
    'cycle' => 'MONTHLY',
    'creditCard' => [...],
    'creditCardHolderInfo' => [...],
    'remoteIp' => '127.0.0.1',
]);

// Listar
$subscription->list(['customer' => 'cus_xxx']);

// Buscar
$subscription->get('sub_xxx');

// Atualizar
$subscription->update('sub_xxx', ['value' => 59.90]);

// Remover
$subscription->delete('sub_xxx');

// Atualizar cartão de crédito
$subscription->updateCreditCard('sub_xxx', [...]);

// Listar pagamentos da assinatura
$subscription->getPayments('sub_xxx');

// Gerar carnê
$subscription->getBooklet('sub_xxx', ['month' => 6, 'year' => 2026]);

// Configuração de nota fiscal
$subscription->getInvoiceConfig('sub_xxx');
$subscription->createInvoiceConfig('sub_xxx', [...]);
$subscription->updateInvoiceConfig('sub_xxx', [...]);
$subscription->deleteInvoiceConfig('sub_xxx');

// Listar notas fiscais
$subscription->getInvoices('sub_xxx');
```

**Ciclos disponíveis:** `WEEKLY`, `BIWEEKLY`, `MONTHLY`, `BIMONTHLY`, `QUARTERLY`, `SEMIANNUALLY`, `YEARLY`

---

### Installment (Parcelamentos)

[](#installment-parcelamentos)

```
$installment = Asaas::installment($apiKey);

// Criar parcelamento
$installment->create([
    'customer' => 'cus_xxx',
    'billingType' => 'BOLETO',
    'value' => 600.00,
    'dueDate' => '2026-07-01',
    'installmentCount' => 6,
    'description' => 'Parcelamento em 6x',
]);

// Criar parcelamento com cartão
$installment->createWithCreditCard([
    'customer' => 'cus_xxx',
    'billingType' => 'CREDIT_CARD',
    'value' => 600.00,
    'dueDate' => '2026-07-01',
    'installmentCount' => 6,
    'creditCard' => [...],
    'creditCardHolderInfo' => [...],
    'remoteIp' => '127.0.0.1',
]);

// Listar
$installment->list();

// Buscar
$installment->get('inst_xxx');

// Remover
$installment->delete('inst_xxx');

// Listar pagamentos do parcelamento
$installment->getPayments('inst_xxx');

// Gerar carnê
$installment->getBooklet('inst_xxx');

// Estornar parcelamento
$installment->refund('inst_xxx');

// Atualizar splits
$installment->updateSplits('inst_xxx', [...]);
```

---

### Invoice (Notas Fiscais)

[](#invoice-notas-fiscais)

```
$invoice = Asaas::invoice($apiKey);

// Agendar nota fiscal
$invoice->create([
    'serviceDescription' => 'Consultoria em TI',
    'value' => 1000.00,
    'effectiveDate' => '2026-07-01',
    'customer' => 'cus_xxx',
    'taxes' => [
        'retainIss' => false,
        'iss' => 5,
        'cofins' => 3,
        'csll' => 1,
        'inss' => 0,
        'ir' => 1.5,
        'pis' => 0.65,
    ],
]);

// Listar
$invoice->list(['customer' => 'cus_xxx']);

// Buscar
$invoice->get('inv_xxx');

// Atualizar
$invoice->update('inv_xxx', ['value' => 1200.00]);

// Autorizar (emitir)
$invoice->authorize('inv_xxx');

// Cancelar
$invoice->cancel('inv_xxx');
```

---

### PaymentLink (Links de Pagamento)

[](#paymentlink-links-de-pagamento)

```
$paymentLink = Asaas::paymentLink($apiKey);

// Criar link de pagamento
$paymentLink->create([
    'name' => 'Produto X',
    'billingType' => 'UNDEFINED',
    'chargeType' => 'DETACHED',
    'value' => 150.00,
    'description' => 'Link para pagamento do Produto X',
]);

// Listar
$paymentLink->list(['active' => true]);

// Buscar
$paymentLink->get('pl_xxx');

// Atualizar
$paymentLink->update('pl_xxx', ['name' => 'Produto X - Atualizado']);

// Remover
$paymentLink->delete('pl_xxx');

// Restaurar removido
$paymentLink->restore('pl_xxx');

// Imagens do link
$paymentLink->listImages('pl_xxx');
$paymentLink->addImage('pl_xxx', '/path/to/image.jpg', true);  // true = imagem principal
$paymentLink->getImage('pl_xxx', 'img_xxx');
$paymentLink->deleteImage('pl_xxx', 'img_xxx');
$paymentLink->setMainImage('pl_xxx', 'img_xxx');
```

**Tipos de cobrança:** `DETACHED` (avulsa), `RECURRENT` (recorrente), `INSTALLMENT` (parcelada)

**Tipos de billing:** `PIX`, `BOLETO`, `CREDIT_CARD`, `UNDEFINED` (cliente escolhe)

---

### Anticipation (Antecipação)

[](#anticipation-antecipação)

```
$anticipation = Asaas::anticipation($apiKey);

// Solicitar antecipação
$anticipation->create([
    'payment' => 'pay_xxx',
]);

// Solicitar antecipação com documentos
$anticipation->create([
    'installment' => 'inst_xxx',
    'documents' => ['/path/to/doc.pdf'],
]);

// Simular antecipação
$anticipation->simulate([
    'payment' => 'pay_xxx',
]);

// Listar
$anticipation->list(['status' => 'PENDING']);

// Buscar
$anticipation->get('ant_xxx');

// Cancelar
$anticipation->cancel('ant_xxx');

// Configuração de antecipação automática
$anticipation->getConfig();
$anticipation->updateConfig(['enabled' => true]);

// Limites
$anticipation->getLimits();
```

---

### Finance (Finanças)

[](#finance-finanças)

```
$finance = Asaas::finance($apiKey);

// Saldo da conta
$finance->getBalance();

// Estatísticas de pagamento
$finance->getPaymentStatistics([
    'customer' => 'cus_xxx',
    'billingType' => 'PIX',
]);

// Estatísticas de split
$finance->getSplitStatistics();

// Extrato financeiro
$finance->getExtract([
    'startDate' => '2026-01-01',
    'finishDate' => '2026-05-01',
]);
```

---

### Transfer (Transferências)

[](#transfer-transferências)

```
$transfer = Asaas::transfer($apiKey);

// Transferência via Pix
$transfer->transferByPix([
    'value' => 100.00,
    'pixAddressKey' => 'email@destino.com',
    'pixAddressKeyType' => 'EMAIL',
    'description' => 'Pagamento',
]);

// Transferência via TED
$transfer->transferByBankAccount([
    'value' => 500.00,
    'bankAccount' => [
        'bank' => ['code' => '341'],
        'accountName' => 'Conta Empresa',
        'ownerName' => 'Empresa LTDA',
        'cpfCnpj' => '12345678000190',
        'agency' => '1234',
        'account' => '56789',
        'accountDigit' => '0',
        'bankAccountType' => 'CONTA_CORRENTE',
    ],
]);

// Transferência para conta Asaas
$transfer->transferToAsaas([
    'value' => 250.00,
    'walletId' => 'wallet_xxx',
]);

// Buscar
$transfer->get('transfer_xxx');

// Cancelar
$transfer->cancel('transfer_xxx');

// Listar (com filtros)
$transfer->list([
    'dateCreatedFrom' => '2026-01-01',
    'dateCreatedTo' => '2026-05-01',
    'type' => 'PIX',
]);
```

**Tipos de chave Pix:** `CPF`, `CNPJ`, `EMAIL`, `PHONE`, `EVP`

---

### Pix

[](#pix)

```
$pix = Asaas::pix($apiKey);

// Criar chave Pix (aleatória - EVP)
$pix->createPixKey();

// Listar chaves
$pix->listPixKeys();

// Buscar chave
$pix->getPixKey('pix_xxx');

// Remover chave
$pix->deletePixKey('pix_xxx');

// QR Code estático
$pix->createStaticQrCode([
    'value' => 50.00,
    'description' => 'Pagamento via QR Code',
]);
$pix->deleteStaticQrCode('qr_xxx');

// Verificar token bucket
$pix->getTokenBucket();

// Pagar QR Code
$pix->payQrCode([
    'qrCode' => ['payload' => '00020126...'],
    'value' => 100.00,
]);

// Decodificar QR Code
$pix->decodeQrCode(['payload' => '00020126...']);

// Transações Pix
$pix->listTransactions(['status' => 'DONE']);
$pix->getTransaction('txn_xxx');
$pix->cancelTransaction('txn_xxx');
```

---

### CreditCard (Cartão de Crédito)

[](#creditcard-cartão-de-crédito)

```
$creditCard = Asaas::creditCard($apiKey);

// Tokenizar cartão
$creditCard->tokenize([
    'customer' => 'cus_xxx',
    'creditCard' => [
        'holderName' => 'João Silva',
        'number' => '4111111111111111',
        'expiryMonth' => '12',
        'expiryYear' => '2028',
        'ccv' => '123',
    ],
    'creditCardHolderInfo' => [
        'name' => 'João Silva',
        'email' => 'joao@email.com',
        'cpfCnpj' => '12345678901',
        'postalCode' => '01001000',
        'addressNumber' => '100',
        'phone' => '11999999999',
    ],
    'remoteIp' => '127.0.0.1',
]);
```

---

### SubAccount (Subcontas)

[](#subaccount-subcontas)

```
$subAccount = Asaas::subAccount($apiKey);

// Criar subconta
$subAccount->create([
    'name' => 'Empresa Parceira',
    'email' => 'parceiro@email.com',
    'cpfCnpj' => '12345678000190',
    'mobilePhone' => '11999999999',
    'incomeValue' => 5000,
    'address' => 'Rua Exemplo',
    'addressNumber' => '123',
    'province' => 'Centro',
    'postalCode' => '01001000',
]);

// Listar
$subAccount->list();

// Buscar
$subAccount->get('acc_xxx');

// Configuração de escrow
$subAccount->getEscrowConfig('acc_xxx');
$subAccount->saveEscrowConfig('acc_xxx', [...]);
```

**Tipos de empresa:** `MEI`, `LIMITED`, `INDIVIDUAL`, `ASSOCIATION`

---

### Webhook

[](#webhook)

```
$webhook = Asaas::webhook($apiKey);

// Criar webhook
$webhook->create([
    'url' => 'https://meuapp.com/webhook',
    'email' => 'admin@meuapp.com',
    'enabled' => true,
    'events' => ['PAYMENT_CONFIRMED', 'PAYMENT_RECEIVED'],
]);

// Listar
$webhook->list();

// Buscar
$webhook->get('wh_xxx');

// Atualizar
$webhook->update('wh_xxx', ['enabled' => false]);

// Remover
$webhook->delete('wh_xxx');
```

#### Eventos disponíveis

[](#eventos-disponíveis)

ClasseEventos`PaymentsWebhookEvents`PAYMENT\_CREATED, PAYMENT\_CONFIRMED, PAYMENT\_RECEIVED, PAYMENT\_OVERDUE, PAYMENT\_DELETED, PAYMENT\_REFUNDED, ...`SubscriptionsWebhookEvents`SUBSCRIPTION\_CREATED, SUBSCRIPTION\_UPDATED, SUBSCRIPTION\_INACTIVATED, SUBSCRIPTION\_DELETED, ...`TransfersWebhookEvents`TRANSFER\_CREATED, TRANSFER\_PENDING, TRANSFER\_DONE, TRANSFER\_FAILED, TRANSFER\_CANCELLED, ...`InvoicesWebhookEvents`INVOICE\_CREATED, INVOICE\_AUTHORIZED, INVOICE\_CANCELED, INVOICE\_ERROR, ...`BillsWebhookEvents`BILL\_CREATED, BILL\_PAID, BILL\_CANCELLED, BILL\_FAILED, ...`AccountStatusWebhookEvents`ACCOUNT\_STATUS\_DOCUMENT\_APPROVED, ACCOUNT\_STATUS\_GENERAL\_APPROVAL\_APPROVED, ...`PhoneRechargeWebhookEvents`PHONE\_RECHARGE\_CONFIRMED, PHONE\_RECHARGE\_CANCELLED, ...`ReceivableAnticipationWebhookEvents`RECEIVABLE\_ANTICIPATION\_CREDITED, RECEIVABLE\_ANTICIPATION\_DENIED, ...---

Retry automático
----------------

[](#retry-automático)

O pacote possui retry automático com backoff exponencial para resiliência contra falhas transitórias:

- **Tentativas:** 1 retry após falha
- **Delay inicial:** 150ms
- **Delay máximo:** 1000ms
- **Backoff:** Exponencial (fator 2.0) com jitter aleatório (0-150ms)
- **Status codes retryable:** 408, 429, 500, 502, 503, 504
- **Exceptions retryable:** Erros de conexão (timeout, rede)

---

Tratamento de erros
-------------------

[](#tratamento-de-erros)

Erros da API retornam no mesmo formato padronizado:

```
[
    'code' => 400,
    'response' => [
        ['code' => 'invalid_customer', 'message' => 'Cliente inválido']
    ]
]
```

Erros de validação (antes do envio à API) lançam `\Exception` com os detalhes dos campos inválidos.

---

Multi-tenant
------------

[](#multi-tenant)

A `$apiKey` é passada em toda chamada via `Asaas::modulo($apiKey)`. Isso permite que uma aplicação multi-tenant use chaves diferentes por subconta/cliente:

```
// Subconta A
$pagamentoA = Asaas::payment($apiKeySubcontaA)->create([...]);

// Subconta B
$pagamentoB = Asaas::payment($apiKeySubcontaB)->create([...]);
```

---

Licença
-------

[](#licença)

MIT

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance96

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~32 days

Recently: every ~109 days

Total

15

Last Release

18d ago

Major Versions

0.0.11 → 1.0.02025-05-13

1.0.0 → 2.0.02026-05-05

PHP version history (2 changes)0.0.1PHP &gt;=7.4

1.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/877555b5761ecafd8257f3a8fa201c68360a23ebee4d80b7d4dc13c7691aee4e?d=identicon)[Jorzel21](/maintainers/Jorzel21)

---

Top Contributors

[![Jorzel21](https://avatars.githubusercontent.com/u/66644621?v=4)](https://github.com/Jorzel21 "Jorzel21 (1 commits)")

---

Tags

laravelBankAsaas

### Embed Badge

![Health badge](/badges/jorzelalves-laravel-asaas/health.svg)

```
[![Health](https://phpackages.com/badges/jorzelalves-laravel-asaas/health.svg)](https://phpackages.com/packages/jorzelalves-laravel-asaas)
```

###  Alternatives

[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.5k21.5M601](/packages/laravel-boost)[laravel/sail

Docker files for running a basic Laravel application.

1.9k205.7M1.3k](/packages/laravel-sail)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M167](/packages/spatie-laravel-health)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M201](/packages/laravel-ai)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
