Expressive by default
Create checkouts, PIX charges, subscriptions, and webhooks in one or two lines — without hiding the full v2 API.
A typed, expressive SDK for AbacatePay v2. Less boilerplate, more Laravel — with full v2 API coverage.
Compare the same flow without and with the package.
use Illuminate\Support\Facades\Http;
$response = Http::withToken(config('abacatepay.api_key'))
->post('https://api.abacatepay.com/v2/transparents/create', [
'method' => 'PIX',
'data' => [
'amount' => 10000,
'description' => 'Order #123',
'expires_in' => 3600,
'metadata' => ['order_id' => 'ORDER-123'],
],
]);
if ($response->failed()) {
throw new RuntimeException($response->json('error.message') ?? 'AbacatePay error');
}
$brCode = $response->json('data.brCode');use Cavalheri\LaravelAbacatePay\Facades\AbacatePay;
$charge = AbacatePay::transparentCheckouts()->pix(10000, [
'description' => 'Order #123',
'metadata' => ['order_id' => 'ORDER-123'],
]);
$brCode = $charge->brCode;use Illuminate\Support\Facades\Http;
Http::withToken(config('abacatepay.api_key'))
->post('https://api.abacatepay.com/v2/webhooks/create', [
'name' => 'Payments',
'endpoint' => route('webhooks.abacatepay'),
'secret' => config('abacatepay.webhook_secret'),
'events' => ['checkout.completed', 'checkout.expired'],
]);
$secret = $request->query('webhookSecret');
$signature = $request->header('X-Webhook-Signature');
$expected = hash_hmac('sha256', $request->getContent(), $secret);
if (! hash_equals($expected, (string) $signature)) {
abort(401);
}use Cavalheri\LaravelAbacatePay\Facades\AbacatePay;
AbacatePay::webhooks()
->checkoutEvents()
->at(route('webhooks.abacatepay'))
->named('Payments')
->create();
$isValid = AbacatePay::webhooks()->verify(
rawBody: $request->getContent(),
signature: $request->header('X-Webhook-Signature'),
secret: $request->query('webhookSecret'),
);| Requirement | Version |
|---|---|
| PHP | 8.3+ |
| Laravel | 13.x |
| AbacatePay API | v2 |
composer require cavalheri/laravel-abacatepay
php artisan vendor:publish --tag=abacatepay-configThen set ABACATEPAY_API_KEY in your .env and you're ready.
Open source created and maintained by Lucas Cavalheri.