API Documentation v0.1.0

FinMarket payment API reference

Authentication

Include your API key in every request using the Authorization header.

Authorization: Bearer <your-api-key>
🔒 Endpoints marked with a lock require authentication. Requests without a valid key return 401 Unauthorized.

For sandbox/testing, use the test key: fm_test_key_acme_12345

Amounts

All monetary amounts are in cents (integer). R$ 100,00 = 10000.

Charges

POST
/charges🔒
Create a new charge (PIX, card, or boleto)
GET
/charges/:id🔒
Retrieve a charge by ID
POST
/charges/:id/cancel🔒
Cancel a charge
POST
/charges/:id/refund🔒
Refund a charge (full or partial)
GET
/charges/:id/journal-entries🔒
List double-entry journal entries for a charge
POST /charges — Request body

PIX

{
  "method": "pix",
  "amount": 10000,
  "customer": {
    "name": "João Silva",
    "document": "12345678900"
  }
}

Credit Card

{
  "method": "card",
  "amount": 25000,
  "installments": 3,
  "capture": true,
  "customer": { "name": "Maria Souza", "document": "98765432100" },
  "card": {
    "number": "4111111111111111",
    "holderName": "MARIA SOUZA",
    "expirationMonth": 12,
    "expirationYear": 2028,
    "cvv": "123"
  }
}

Boleto

{
  "method": "boleto",
  "amount": 5000,
  "dueDate": "2026-05-30",
  "customer": { "name": "Carlos Lima", "document": "11122233344" }
}
Pass Idempotency-Key: <uuid> header to safely retry requests without creating duplicates.
Charge status lifecycle
created → awaiting_payment → paid
         ↘ cancelled
                            → refunded
                            → chargeback
POST /charges/:id/refund — Request body (optional)
{
  "amount": 5000
}

Omit amount for a full refund.

Webhooks

POST
/webhooks/fake
Receive events from the fake gateway (internal use)

Webhook payloads are signed with HMAC-SHA256. Verify the x-webhook-signature header.

{
  "event": "payment.confirmed" | "payment.refunded" | "payment.chargeback",
  "gatewayId": "fake_...",
  "chargeId": "uuid",
  "amountCents": 10000,
  "timestamp": "2026-05-14T00:00:00.000Z"
}

Sandbox Admin Sandbox only

Simulate gateway events in the test environment without waiting for real payment confirmations.

POST
/admin/fake/pix/:chargeId/pay
Simulate PIX payment confirmation
POST
/admin/fake/boleto/:chargeId/pay
Simulate boleto payment confirmation
POST
/admin/fake/charges/:chargeId/advance
Advance charge to paid status
POST
/admin/fake/charges/:chargeId/refund
Simulate refund event
POST
/admin/fake/charges/:chargeId/chargeback
Simulate chargeback event
GET
/admin/fake/state
List recent fake gateway charges

Infrastructure

GET
/
This home page
GET
/status
Live system status dashboard
GET
/docs
This documentation page
GET
/healthz
Health check (used by load balancers)