RASPAY

Pix: charges

Generate the QR code and copy and paste code, and track the payment.

Create

Create a charge with amount in cents. Use reference to store the order ID and Idempotency-Key to retry without duplicating. Full parameters in the reference.

curl -X POST "https://api.raspay.io/v1/charges" \
  -H "Authorization: Bearer $GATEWAY_API_KEY" \
  -H "Idempotency-Key: order-0001" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 15000,
    "reference": "ORDER-0001",
    "description": "Annual plan",
    "customer": {
      "name": "Ana Souza",
      "document": "12345678909",
      "email": "ana@example.com"
    }
  }'

Show the Pix to the payer

  • pix.copyPaste: code to paste in the bank app.
  • pix.qrCodeBase64: base64 PNG image, without prefix. To display it, put data:image/png;base64, before the value.
  • checkoutUrl: ready-made page, no screen to build. See Hosted checkout.

fee is zero and net equals the amount until payment. Both are set when the charge is paid.

Response 201
{
  "id": "7c1e4f2a-3b58-4e0d-9a6c-2f8d1b7e5a10",
  "object": "charge",
  "livemode": false,
  "status": "pending",
  "amount": 15000,
  "fee": 0,
  "net": 15000,
  "currency": "BRL",
  "reference": "ORDER-0001",
  "description": "Annual plan",
  "customer": {
    "name": "Ana Souza",
    "document": "12345678909",
    "email": "ana@example.com"
  },
  "metadata": {
    "order": "0001"
  },
  "pix": {
    "copyPaste": "00020126580014br.gov.bcb.pix0136...",
    "qrCodeBase64": "iVBORw0KGgoAAAANSUhEUg..."
  },
  "checkoutUrl": "https://dashboard.example.com/pay/7c1e4f2a-3b58-4e0d-9a6c-2f8d1b7e5a10",
  "payer": null,
  "beneficiary": null,
  "endToEndId": null,
  "ispb": null,
  "failureReason": null,
  "paidAt": null,
  "refundedAt": null,
  "createdAt": "2026-11-01T15:04:05.000Z"
}

Lifecycle

statusMeaning
pendingWaiting for payment.
paidPayment confirmed. Balance credited and charge.paid sent.
refundedPix returned to the payer. Balance debited and charge.refunded sent.
failedThe Pix could not be generated. See failureReason and create another charge.

Charges have no expiration status in the API, but the QR code may stop accepting payment after a while, depending on the institution. The charge then stays pending: create another one to charge again. If the sale was canceled, handle it in your system: a payment that arrives later will still be credited.

Refunds

In the sandbox, simulate it with POST /v1/sandbox/charges/{id}/refund.

MED: when the payer's bank opens a dispute, the full Pix amount moves from available to held and you receive charge.disputed. If the MED closes without a return, the amount goes back to available with charge.dispute_released. If the Pix is returned, you get charge.refunded and the amount leaves held. All three events carry the dispute block with the MED number (id), the reason (reason), who opened it (reportedBy), openedAt, closedAt and the returned amount (returnedAmount), when reported by the institution; otherwise null.

Retrieve

Use GET /v1/charges/{id} and GET /v1/charges. To be notified without polling, use webhooks.