PHPackages                             cavalheri/laravel-abacatepay - 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. [API Development](/categories/api)
4. /
5. cavalheri/laravel-abacatepay

ActiveLibrary[API Development](/categories/api)

cavalheri/laravel-abacatepay
============================

Laravel-native SDK for the AbacatePay API v2.

v2.1.3(2w ago)133MITPHPPHP ^8.3CI passing

Since May 23Pushed 1w agoCompare

[ Source](https://github.com/LucasCavalheri/laravel-abacatepay)[ Packagist](https://packagist.org/packages/cavalheri/laravel-abacatepay)[ RSS](/packages/cavalheri-laravel-abacatepay/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (8)Versions (10)Used By (0)

Laravel AbacatePay
==================

[](#laravel-abacatepay)

[![Tests](https://github.com/LucasCavalheri/laravel-abacatepay/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/LucasCavalheri/laravel-abacatepay/actions/workflows/tests.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/45f1e0c68afb9e8c2aeba613904df96c2382d229419e081ecd39c1f0179392e7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636176616c686572692f6c61726176656c2d616261636174657061793f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cavalheri/laravel-abacatepay)[![Total Downloads](https://camo.githubusercontent.com/c453e474f3d8652afeda62e87ff4845c4c7d8d58584278757c919133ed88c41d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636176616c686572692f6c61726176656c2d616261636174657061793f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cavalheri/laravel-abacatepay)[![License](https://camo.githubusercontent.com/21378bc2d9998a299d23232e41d78c3632dd3deae6d756947602412593a091ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636176616c686572692f6c61726176656c2d616261636174657061793f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cavalheri/laravel-abacatepay)

[![PHP Version](https://camo.githubusercontent.com/62c818c7128b9795d42cb7acbb1fc38fbed88d0b153c2a8ef8e1054745a4ea5c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e332d3737374242343f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/cavalheri/laravel-abacatepay)[![Laravel](https://camo.githubusercontent.com/91b453418e2968e787424df8c7f38687dcdd30d49d9d6beb33ab06cdb953df40/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31332e782d6666326432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://laravel.com)[![Documentation](https://camo.githubusercontent.com/70f41511a1840bbfb4f1484ed4f82ac619622c2dcf698dfb4f54ffc135bf45d3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d6c61726176656c2d2d616261636174657061792d3763623334323f7374796c653d666c61742d737175617265)](https://laravel-abacatepay.lucascavalheri.com.br/)

Laravel-native SDK for the AbacatePay API v2.

Documentação
------------

[](#documentação)

Site de documentação com suporte a **Português (padrão)** e **English**:

```
cd docs
npm install
npm run dev
```

Build para produção:

```
npm run build
npm run serve
```

Para gerar URLs canônicas e metadados Open Graph completos no build de produção, defina a URL pública do site:

```
DOCS_SITE_URL=https://seu-dominio.com npm run build
```

Na Vercel, configure o **Root Directory** como `docs`. O arquivo `docs/vercel.json` já aponta o output para `docs/.vitepress/dist`. A URL da Vercel é detectada automaticamente para SEO; use `DOCS_SITE_URL` se tiver domínio customizado.

A documentação abre em português. Use o seletor de idioma no topo para alternar para inglês (`/en/`).

Requisitos
----------

[](#requisitos)

- PHP 8.3 or higher
- Laravel 13.x
- Composer

Installation
------------

[](#installation)

```
composer require cavalheri/laravel-abacatepay
```

Publish The Configuration
-------------------------

[](#publish-the-configuration)

```
php artisan vendor:publish --tag=abacatepay-config
```

The published file will be available at `config/abacatepay.php`.

Environment Variables
---------------------

[](#environment-variables)

```
ABACATEPAY_API_KEY=
ABACATEPAY_WEBHOOK_SECRET=
ABACATEPAY_DEV_MODE=false
ABACATEPAY_PLAYGROUND_ENABLED=true
```

Playground (interactive SDK explorer)
-------------------------------------

[](#playground-interactive-sdk-explorer)

Horizon-style UI to try AbacatePay SDK calls and watch the matching Laravel code update in real time.

Enabled by default in `local`. Open:

```
http://localhost/abacatepay/playground

```

Configure in `config/abacatepay.php`:

```
'playground' => [
    'enabled' => env('ABACATEPAY_PLAYGROUND_ENABLED', env('APP_ENV') === 'local'),
    'path' => env('ABACATEPAY_PLAYGROUND_PATH', 'abacatepay/playground'),
    'middleware' => ['web'],
    'authorize' => fn ($request) => app()->environment('local'),
],
```

The `authorize` callback lets you lock the playground down in shared environments.

Usage With The Facade
---------------------

[](#usage-with-the-facade)

```
use Cavalheri\LaravelAbacatePay\Facades\AbacatePay;

$checkout = AbacatePay::checkouts()->forProduct('prod_abc123xyz');

return redirect()->away($checkout->url);
```

Usage With Dependency Injection
-------------------------------

[](#usage-with-dependency-injection)

```
use Cavalheri\LaravelAbacatePay\AbacatePayManager;

public function __invoke(AbacatePayManager $abacatePay)
{
    $checkout = $abacatePay->checkouts()->forProduct('prod_abc123xyz');

    return redirect()->away($checkout->url);
}
```

Customers
---------

[](#customers)

```
$customer = AbacatePay::customers()->firstOrCreate([
    'email' => 'lover@example.com',
    'name' => 'Abacate Lover',
    'tax_id' => '12345678901',
]);
```

You can also use the full v2 customer resource methods:

```
$customer = AbacatePay::customers()->create([...]);

$customers = AbacatePay::customers()->list(['limit' => 50]);

$customer = AbacatePay::customers()->get('cust_abcdefghij');

$deleted = AbacatePay::customers()->delete('cust_abcdefghij');
```

Coupons
-------

[](#coupons)

```
$coupon = AbacatePay::coupons()->percentage('WELCOME10', 10, [
    'max_redeems' => -1,
]);
```

Fixed amount coupons use cents:

```
$coupon = AbacatePay::coupons()->fixed('PROMO20', 2000);
```

You can also use the full v2 coupon resource methods:

```
$coupon = AbacatePay::coupons()->create([...]);

$coupons = AbacatePay::coupons()->list(['status' => 'ACTIVE']);

$coupon = AbacatePay::coupons()->get('WELCOME10');

$coupon = AbacatePay::coupons()->toggle('WELCOME10');

$deleted = AbacatePay::coupons()->delete('WELCOME10');
```

Products
--------

[](#products)

Create a one-time product:

```
$product = AbacatePay::products()->oneTime('PRO-PLAN', 'Pro plan', 10000);
```

Create a subscription product:

```
$product = AbacatePay::products()->subscription('PRO-MONTHLY', 'Pro monthly', 10000, 'MONTHLY');
```

You can also use the full v2 product resource methods:

```
$product = AbacatePay::products()->create([
    'external_id' => 'PRO-PLAN',
    'name' => 'Pro plan',
    'price' => 10000,
    'description' => 'Professional plan',
]);

$products = AbacatePay::products()->list(['status' => 'ACTIVE']);

$product = AbacatePay::products()->get('prod_abc123xyz');

$product = AbacatePay::products()->get(['external_id' => 'PRO-PLAN']);

$deleted = AbacatePay::products()->delete('prod_abc123xyz');
```

Checkouts
---------

[](#checkouts)

Create a hosted checkout for a product:

```
$checkout = AbacatePay::checkouts()->forProduct('prod_abc123xyz');

return redirect()->away($checkout->url);
```

Create a PIX-only checkout:

```
$checkout = AbacatePay::checkouts()->pix('prod_abc123xyz', 1, [
    'customer_id' => 'cust_abcdefghij',
]);
```

Create a card checkout with installments:

```
$checkout = AbacatePay::checkouts()->card('prod_abc123xyz', 1, [
    'max_installments' => 12,
]);
```

You can also use the full v2 checkout resource methods:

```
$checkout = AbacatePay::checkouts()->create([
    'items' => [
        ['id' => 'prod_abc123xyz', 'quantity' => 1],
    ],
    'methods' => ['PIX', 'CARD'],
    'return_url' => route('checkout.index'),
    'completion_url' => route('checkout.success'),
]);

$checkouts = AbacatePay::checkouts()->list(['status' => 'PENDING']);

$checkout = AbacatePay::checkouts()->get('bill_abc123xyz');

$refund = AbacatePay::checkouts()->refund('bill_abc123xyz', 'Customer canceled the order.');
```

Payment Links
-------------

[](#payment-links)

Create a reusable payment link for a product:

```
$paymentLink = AbacatePay::paymentLinks()->forProduct('prod_abc123xyz');

return redirect()->away($paymentLink->url);
```

Create a PIX-only payment link:

```
$paymentLink = AbacatePay::paymentLinks()->pix('prod_abc123xyz');
```

You can also use the full v2 payment link resource methods:

```
$paymentLink = AbacatePay::paymentLinks()->create([
    'items' => [
        ['id' => 'prod_abc123xyz', 'quantity' => 1],
    ],
    'methods' => ['PIX', 'CARD'],
    'return_url' => route('checkout.index'),
    'completion_url' => route('checkout.success'),
]);

$paymentLinks = AbacatePay::paymentLinks()->list(['status' => 'PENDING']);

$paymentLink = AbacatePay::paymentLinks()->get('bill_link123xyz');

$refund = AbacatePay::paymentLinks()->refund('bill_link789xyz', 'Duplicated charge.');
```

Transparent Checkouts
---------------------

[](#transparent-checkouts)

Create a PIX QR Code without redirecting the customer:

```
$charge = AbacatePay::transparentCheckouts()->pix(10000, [
    'description' => 'Order #123',
    'metadata' => ['order_id' => 'ORDER-123'],
]);

echo $charge->brCode;
```

Create a boleto with alternative PIX:

```
$charge = AbacatePay::transparentCheckouts()->boleto(25000, [
    'name' => 'Abacate Lover',
    'tax_id' => '12345678901',
]);
```

You can also use the full v2 transparent checkout methods:

```
$charge = AbacatePay::transparentCheckouts()->create([
    'method' => 'PIX',
    'data' => [
        'amount' => 10000,
        'expires_in' => 3600,
    ],
]);

$status = AbacatePay::transparentCheckouts()->check('pix_char_abc123xyz');

$charge = AbacatePay::transparentCheckouts()->simulatePayment('pix_char_abc123xyz');

$charges = AbacatePay::transparentCheckouts()->list(['status' => 'PENDING']);

$refund = AbacatePay::transparentCheckouts()->refund('pix_char_abc123xyz', 'Customer paid twice.');
```

Payouts
-------

[](#payouts)

Create a payout in one line:

```
$payout = AbacatePay::payouts()->withdraw(10000, 'withdraw-123');
```

You can also use the full v2 payout resource methods:

```
$payout = AbacatePay::payouts()->create([
    'amount' => 10000,
    'external_id' => 'withdraw-123',
    'description' => 'Weekly withdrawal',
]);

$payout = AbacatePay::payouts()->get('withdraw-123');

$payouts = AbacatePay::payouts()->list(['status' => 'PENDING']);
```

PIX Transfers
-------------

[](#pix-transfers)

Send PIX to a key in one line:

```
$pix = AbacatePay::pixTransfers()->toPhone(10000, 'pix-123', '11987654321');
```

Use the helper that matches the key type:

```
AbacatePay::pixTransfers()->toEmail(10000, 'pix-124', 'supplier@example.com');
AbacatePay::pixTransfers()->toCpf(10000, 'pix-125', '12345678901');
AbacatePay::pixTransfers()->toCnpj(10000, 'pix-126', '12345678000199');
AbacatePay::pixTransfers()->toRandomKey(10000, 'pix-127', 'random-key');
AbacatePay::pixTransfers()->toBrCode(10000, 'pix-128', '000201...');
```

You can also use the full v2 PIX transfer methods:

```
$pix = AbacatePay::pixTransfers()->send([
    'amount' => 10000,
    'external_id' => 'pix-123',
    'description' => 'Supplier payment',
    'pix' => [
        'key' => '11987654321',
        'type' => 'PHONE',
    ],
]);

$pix = AbacatePay::pixTransfers()->get('txn_pix_abc123');

$pix = AbacatePay::pixTransfers()->getByExternalId('pix-123');

$pixTransfers = AbacatePay::pixTransfers()->list(['status' => 'PENDING']);
```

Subscriptions
-------------

[](#subscriptions)

Create a subscription checkout in one line:

```
$checkout = AbacatePay::subscriptions()->card('prod_monthly_abc123');
```

You can also use the full v2 subscription checkout payload:

```
$checkout = AbacatePay::subscriptions()->create([
    'items' => [
        ['id' => 'prod_monthly_abc123', 'quantity' => 1],
    ],
    'methods' => ['CARD'],
    'customer_id' => 'cust_abc123xyz',
    'external_id' => 'sub-123',
    'metadata' => ['plan' => 'monthly'],
]);

$subscriptions = AbacatePay::subscriptions()->list(['status' => 'PAID']);
```

Manage active subscriptions:

```
$subscription = AbacatePay::subscriptions()->cancel('subs_abc123xyz');

$update = AbacatePay::subscriptions()->changePlan('subs_abc123xyz', 'prod_plano_pro', 1);

$usage = AbacatePay::subscriptions()->addUsage('subs_abc123xyz', 'prod_api_calls', 50);

$usage = AbacatePay::subscriptions()->subtractUsage('subs_abc123xyz', 'prod_api_calls', 10);
```

Store
-----

[](#store)

Get your store details and balance in one line:

```
$store = AbacatePay::store()->get();

$availableBalance = $store->balance->available;
```

Public MRR
----------

[](#public-mrr)

Get public merchant metrics in one line:

```
$mrr = AbacatePay::publicMrr()->mrr();
```

You can also use the full v2 public MRR methods:

```
$merchant = AbacatePay::publicMrr()->merchantInfo();

$mrr = AbacatePay::publicMrr()->mrr();

$revenue = AbacatePay::publicMrr()->revenue('2024-01-01', '2024-01-31');

$revenue = AbacatePay::publicMrr()->revenueForPeriod([
    'start_date' => '2024-01-01',
    'end_date' => '2024-01-31',
]);
```

Webhooks
--------

[](#webhooks)

Create a webhook with a fluent, Laravel-friendly flow:

```
$webhook = AbacatePay::webhooks()
    ->checkoutEvents()
    ->at('https://example.com/webhooks/abacatepay')
    ->named('Checkout payments')
    ->create();
```

Use official event presets, or subscribe to one exact event:

```
use Cavalheri\LaravelAbacatePay\Webhooks\WebhookEvent;

AbacatePay::webhooks()->subscriptionEvents()->at($url)->named('Subscriptions')->create();
AbacatePay::webhooks()->payoutEvents()->at($url)->named('Payouts')->create();
AbacatePay::webhooks()->listenTo(WebhookEvent::CHECKOUT_COMPLETED)->at($url)->named('Paid checkouts')->create();
```

You can still use the raw v2 resource methods when you need full control:

```
$webhook = AbacatePay::webhooks()->create([
    'name' => 'Webhook de Pagamentos',
    'endpoint' => 'https://example.com/webhooks/abacatepay',
    'secret' => env('ABACATEPAY_WEBHOOK_SECRET'),
    'events' => [
        WebhookEvent::CHECKOUT_COMPLETED,
        WebhookEvent::SUBSCRIPTION_RENEWED,
    ],
]);

$webhooks = AbacatePay::webhooks()->list(['search' => 'pagamentos']);

$webhook = AbacatePay::webhooks()->get('webh_abc123xyz');

$deleted = AbacatePay::webhooks()->delete('webh_abc123xyz');
```

Validate incoming webhook requests with the URL secret and HMAC signature:

```
$isValid = AbacatePay::webhooks()->verify(
    rawBody: $request->getContent(),
    signature: $request->header('X-Webhook-Signature'),
    secret: $request->query('webhookSecret'),
);
```

Running Tests
-------------

[](#running-tests)

```
composer test
```

Or run Pest directly:

```
vendor/bin/pest
```

Creating This Package From Scratch
----------------------------------

[](#creating-this-package-from-scratch)

```
mkdir laravel-abacatepay
cd laravel-abacatepay
composer init --name=cavalheri/laravel-abacatepay --type=library
composer require php:^8.3 illuminate/support:^13.0 guzzlehttp/guzzle
composer require --dev orchestra/testbench:^11.0 pestphp/pest:^4.0 pestphp/pest-plugin-laravel:^4.0
mkdir -p config src/Exceptions src/Facades src/Http tests/Feature
```

After creating the package files, refresh Composer autoloading:

```
composer dump-autoload
```

Publishing To Packagist
-----------------------

[](#publishing-to-packagist)

1. Push the repository to GitHub.
2. Create a release tag, for example `v0.1.0`.
3. Sign in to Packagist.
4. Submit the repository URL.
5. Enable GitHub synchronization so Packagist updates on each new tag.
6. Install the package in a Laravel 13 application and run a smoke test before announcing it.

Contributing
------------

[](#contributing)

Pull requests are welcome. Please include tests for new behavior and keep changes focused.

Author
------

[](#author)

Created and maintained by **[Lucas Cavalheri](https://lucascavalheri.com.br)**.

Learn more about the creator: [Portfolio](https://lucascavalheri.com.br) · [GitHub](https://github.com/LucasCavalheri) · [LinkedIn](https://linkedin.com/in/lucas-cavalheri)

License
-------

[](#license)

The MIT License (MIT). Please see `LICENSE` for more information.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance97

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

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 ~0 days

Total

5

Last Release

18d ago

Major Versions

v1.0.14 → v2.x-dev2026-05-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc9512de33226eedbf2597a3136c41dad3f0ddac10bb6b10d0a917f0876b257f?d=identicon)[LucasCavalheri](/maintainers/LucasCavalheri)

---

Top Contributors

[![LucasCavalheri](https://avatars.githubusercontent.com/u/104279631?v=4)](https://github.com/LucasCavalheri "LucasCavalheri (29 commits)")

---

Tags

abacatepaylaravelphppixsdk

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/cavalheri-laravel-abacatepay/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9732.3M121](/packages/roots-acorn)[laravel/cashier-paddle

Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.

268880.7k3](/packages/laravel-cashier-paddle)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1232.2k16](/packages/fleetbase-core-api)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1348.1k1](/packages/jasara-php-amzn-selling-partner-api)

PHPackages © 2026

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