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.

quickstart.js
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...5802BR

One 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. 1

    Install the SDK

    One package, no heavy dependencies. Runs on Node 18 or newer.

    terminal
    npm install @ducavo/sdk
  2. 2

    Create a Pix charge

    Amount in cents. The response already carries the brcode and QR Code ready to show.

    charge.js
    import { 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. 3

    Receive the confirmation

    Verify the signature, reply 2xx and release the order. The event arrives as soon as the Pix is paid.

    webhook.js
    import 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/charges
  • POST /v1/card/charges
  • POST /v1/boletos
  • POST /v1/invoices
  • POST /v1/payment-links
  • POST /v1/subscriptions
  • POST /v1/transfers
  • GET /v1/balance
  • GET /v1/events

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.update

    Whenever a transaction is updated (the most used event).

  • subscription.created

    A new subscription was created.

  • subscription.renewed

    A subscription was renewed.

  • subscription.expired

    A subscription was not renewed.

  • application.connected

    A new connection was made to an application (OAuth2).

  • application.disconnected

    A 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
sandbox.js
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.update

Simulate the payment of a test charge.

Integrate in a few minutes

No card, no meeting. Start in the sandbox and move to production when you're ready.