04 invoices

Invoices are the core of Stablix. Create an invoice to accept a one-time payment.

Invoice Lifecycle

pending → paid → [buffer period] → released (auto)
                        ↘ disputed → resolved
         → expired
         → refunded
Status
Description

pending

Awaiting payment

paid

Payment received, funds in escrow

released

Funds auto-released to merchant after buffer

refunded

Funds returned to buyer

expired

Payment deadline passed

disputed

Under dispute resolution

resolved

Dispute resolved


Create Invoice

POST /invoices

Request

{
  "amount": 99.99,
  "currency": "USDC",
  "chain": "solana",
  "buffer_hours": 24,
  "expires_in_minutes": 60,
  "external_id": "order_12345",
  "customer_email": "[email protected]",
  "metadata": {
    "product": "Premium Plan",
    "order_id": "12345"
  },
  "redirect_url": "https://mystore.com/success",
  "splits": [
    {
      "address": "affiliate_wallet_address",
      "percentage": 10
    }
  ]
}

Parameters

Field
Type
Required
Description

amount

number

Payment amount in USD

currency

string

USDC or USDT

chain

string

solana or base

buffer_hours

number

Escrow period (0-720 hours, default: 24)

expires_in_minutes

number

Payment deadline (default: 60)

external_id

string

Your internal order ID

customer_email

string

Buyer's email for notifications

metadata

object

Custom data (max 10 keys)

redirect_url

string

Redirect after payment

splits

array

Revenue splits (affiliates, partners)

Response

Code Examples


Get Invoice

Response


List Invoices

Query Parameters

Parameter
Type
Description

status

string

Filter by status

chain

string

Filter by chain

currency

string

Filter by currency

external_id

string

Filter by external ID

startDate

ISO date

Created after

endDate

ISO date

Created before

page

number

Page number (default: 1)

limit

number

Items per page (default: 20, max: 100)

Example

Response


Fund Release

Funds are released to merchants automatically when the buffer period expires. This protects buyers from scams.

Who
Can Release?
Can Refund?

System

✅ Auto after buffer

-

Admin

✅ Manual if needed

Merchant

❌ No

✅ Yes

Security Note: Merchants cannot release funds to themselves. This prevents a merchant from taking payment and disappearing before delivery. Buyers have the buffer period to open a dispute if something goes wrong.


Refund Invoice

Refund a paid invoice back to the buyer.

Request

Response


Get Public Invoice

For payment pages. No authentication required.

Response


Invoice Stats

Get aggregate statistics for your invoices.

Query Parameters

Parameter
Type
Description

startDate

ISO date

Start of period

endDate

ISO date

End of period

Response


Revenue Splits

Split payments between multiple recipients (affiliates, partners, etc.).

When the invoice is released:

  • Affiliate receives: $10 (10%)

  • Partner receives: $5 (5%)

  • Merchant receives: $84.50 (85% minus 0.5% fee)


Idempotency

Prevent duplicate invoices using the Idempotency-Key header:

If you send the same request with the same idempotency key within 24 hours, you'll receive the original response instead of creating a duplicate invoice.

Last updated