For developers
From zero to your first Pix in minutes
Install the SDK, create a test key and issue your first charge. No meeting, no waiting.
Free sandbox, no card to get started.
import { Ducavo } from '@ducavo/sdk';
const ducavo = new Ducavo(process.env.DUCAVO_SECRET_KEY);
const charge = await ducavo.pix.charges.create({
amount: 4990,
description: 'Plano Pro'
});
console.log(charge.brcode);
// → 00020126...5802BROne Pix charge, from install to brcode.
Quickstart
Three steps to your first webhook
Node here, but the flow is the same in any SDK. Copy it, paste your test key and run.
- 1
Install the SDK
One package, no heavy dependencies. Runs on Node 18 or newer.
terminalnpm install @ducavo/sdk - 2
Create a Pix charge
Amount in cents. The response already carries the brcode and QR Code ready to show.
charge.jsimport { Ducavo } from '@ducavo/sdk'; const ducavo = new Ducavo(process.env.DUCAVO_SECRET_KEY); // sk_test_... // Valor sempre em centavos: 4990 = R$ 49,90 const charge = await ducavo.pix.charges.create({ amount: 4990, description: 'Plano Pro', expiresIn: 3600 }); console.log(charge.brcode); // 00020126...5802BR console.log(charge.qrcode); // data URL do QR Code - 3
Receive the confirmation
Verify the signature, reply 2xx and release the order. The event arrives as soon as the Pix is paid.
webhook.jsimport express from 'express'; import { Ducavo } from '@ducavo/sdk'; const ducavo = new Ducavo(process.env.DUCAVO_SECRET_KEY); const app = express(); // A assinatura é validada sobre o corpo cru, então use express.raw aqui. app.post('/webhooks/ducavo', express.raw({ type: 'application/json' }), (req, res) => { let event; try { event = ducavo.webhooks.constructEvent( req.body, req.headers['ducavo-signature'], process.env.DUCAVO_WEBHOOK_SECRET ); } catch { return res.status(400).send('assinatura inválida'); } if (event.type === 'transaction.update' && event.data.status === 'approved') { // libere o pedido aqui } res.sendStatus(200); // responda 2xx para encerrar os retries });
Official SDKs
Your language, no workarounds
Libraries we maintain for the most used languages. Yours isn't here? The REST API talks to any stack.
Any other language talks straight to the REST API: it's just HTTP and JSON.
API reference
A predictable REST API
Resources with obvious names, the right HTTP verbs and the same patterns across every endpoint.
- POST
/v1/pix/chargesPix in & out - POST
/v1/card/chargesCredit and debit card - POST
/v1/boletosBoleto - POST
/v1/invoicesAutomated invoicing - POST
/v1/payment-linksPayment links - POST
/v1/subscriptionsRecurring subscriptions - POST
/v1/transfersTransfers and split - GET
/v1/balanceBalance and statement - GET
/v1/eventsEvents and webhooks
Webhooks
Events that arrive, signed
Every state change becomes a signed event. You check the HMAC, reply 2xx, and we stop resending.
- HMAC signature on every delivery, so you can trust the source
- Retry with exponential backoff until you reply 2xx
- Idempotent delivery: each event has an id to deduplicate
- Versioned event catalog, no silent breakage
Available events
transaction.updateWhenever a transaction is updated (the most used event).
subscription.createdA new subscription was created.
subscription.renewedA subscription was renewed.
subscription.expiredA subscription was not renewed.
application.connectedA new connection was made to an application (OAuth2).
application.disconnectedA connection to an application was removed (OAuth2).
Sandbox
Test without moving real money
Test keys isolated from production. Simulate an approved or expired payment with one call and watch the webhook arrive.
- sk_test keys separate from production
- Force the status: approved, expired or refused
- Test cards for every antifraud scenario
const ducavo = new Ducavo(process.env.DUCAVO_TEST_KEY); // sk_test_...
const charge = await ducavo.pix.charges.create({ amount: 4990 });
// Só no sandbox: força o pagamento e dispara o webhook.
await ducavo.testing.pix.pay(charge.id);
// → dispara o evento transaction.updateSimulate the payment of a test charge.
Tools
Everything within reach
Integrate in a few minutes
No card, no meeting. Start in the sandbox and move to production when you're ready.