Checkouts

Cobrança hosted (página /c/[id]) ou transparent (API direta). Métodos: Pix, boleto, cartão e crypto.

Hosted — create

curl -s https://api.aporta.cc/v1/checkouts/create \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 4990,
    "methods": ["PIX", "BOLETO", "CARD"],
    "customerId": "cust_…",
    "returnUrl": "https://loja.com/voltar",
    "completionUrl": "https://loja.com/pago"
  }'
  • Informe amount ou items[] (catálogo: { id, quantity })
  • methods obrigatório (mín. 1)
  • Resposta: url, rails por método (brCode, barCode, …), status: PENDING
  • Opcional: couponCode, upSellProductId, boleto dueDate / interest / fine

Transparent — create

curl -s https://api.aporta.cc/v1/transparents/create \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "PIX",
    "amount": 1990,
    "customerId": "cust_…",
    "expiresIn": 3600
  }'

Um método por chamada. Pix devolve brCode; boleto barCode; card/crypto rails específicos. Exemplos por método em /docs/payments.

Consultar

  • GET /v1/checkouts/one?id=chk_…
  • GET /v1/checkouts/check?id=chk_… — status (auto-expira PENDING vencido → EXPIRED)
  • GET /v1/checkouts/list — paginação cursor

Simulate-payment (sandbox)

curl -s https://api.aporta.cc/v1/checkouts/simulate-payment \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{ "id": "chk_…", "method": "PIX" }'

Só sandbox (sk_test_). Emite checkout.completed. Também existe simulate em transparent / crypto receive.

Refunds

curl -s https://api.aporta.cc/v1/checkouts/refund \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{ "id": "chk_…" }'
  • PAID → REFUNDED + webhook checkout.refunded
  • PENDING → CANCELLED
  • EXPIRED / já refunded → INVALID_STATE

Payment links

Links reutilizáveis: POST /v1/payment-links/create → URL pública /l/[id].