Invoices API
Create and verify project invoices from your server.
For new hosted sessions, follow the v2 quick start. This page describes the existing v1 invoice contract.
Base URL: https://api.bramapay.com
POST /v1/invoices
Creates an invoice using the project associated with the secret key.
| Requirement | Value |
|---|---|
| Authentication | X-Api-Key with the project/mode secret |
| Idempotency | Idempotency-Key header, required |
| Content type | application/json |
| Body field | Type | Required | Rules |
|---|---|---|---|
amount | decimal string | Yes | Plain decimal, minimum 1 |
asset | string | Yes | An enabled asset on the requested route |
network | string | Yes | An available network for that asset |
externalId | string | Yes | 1–200 characters; unique durable order attempt |
Success returns HTTP 201 with invoiceId, externalId, status, checkoutUrl, and ISO-8601 expiresAt. This projection does not include amountCrypto or the receiving address — hosted checkout is the customer-facing authority for what to pay.
GET /v1/invoices/:invoiceId
Returns the same integration projection for server-side status verification. Use the same project's secret key. Malformed, absent, and cross-project IDs return 404 INVOICE_NOT_FOUND without leaking ownership.
Require status === "PAID" and match the stored externalId before fulfillment. Cancel is not part of the narrow /v1 contract; cancel pending invoices from the Dashboard or POST /invoices/:id/cancel.
Idempotency
Persist the idempotency key with your order. It must be 1–128 ASCII letters, digits, ., _, :, or -. Retry transient failures with the same key and identical body. Reusing the key for different input, or reusing an already-reserved external order identifier for a conflicting attempt, returns 409 IDEMPOTENCY_CONFLICT.
This is the existing standalone Legacy v1 contract. New hosted integrations should start with API v2. Explicit buyer pricing uses feePayer: "BUYER", pricingVersion: "BUYER_FEE_V1", baseAmountUsd and omits amount; project-managed buyer pricing preserves the integration order basis. See pricing contracts. Do not change existing request identity or reinterpret historical values.