Skip to content
HisarPay

API reference

Invoices

Create, look up and cancel invoices, and simulate payments in test mode. Details in the guide →

POST/v1/invoices

Create an invoice

Scope: invoicesKey: live or test

Send price_usd, or token together with amount; price_usd cannot be combined with amount. A repeated order_id returns the existing invoice with 200.

Request body

  • price_usdstringoptional

    Price in USD, from the minimum (GET /v1/tokens) to 10,000,000. Without token the customer picks the coin.

    pattern ^(0|[1-9]\d{0,11})(\.\d{1,2})?$

  • tokenstringoptional

    Fix the coin: "TRX" or "USDT".

    Values:TRXUSDT

  • amountstringoptional

    Amount in the coin (with token). Cannot be combined with price_usd.

    pattern ^(0|[1-9]\d{0,11})(\.\d{1,6})?$

  • tokensarray<string>optional

    Coins the customer may choose from. Default: all.

    Values:TRXUSDT

    ≥ 1 items

  • order_idstringoptional

    Your order id. Repeating it returns the existing invoice.

    1–128 chars

  • descriptionstringoptional

    ≤ 500 chars

  • success_urlstring (url)optional

    ≤ 2048 chars

  • return_urlstring (url)optional

    ≤ 2048 chars

  • callback_urlstring (url)optional

    Extra webhook destination for this invoice (https; signed with your default endpoint secret).

    ≤ 2048 chars

  • expires_in_minutesintegeroptional

    5–1440

  • metadataobjectoptional
  • customer_emailstring (email)optional

    Where the payer gets their receipt, if your account sends receipts

    ≤ 200 chars · pattern ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$

  • fee_paid_by_customerbooleanoptional

Responses

Example request
curl -X POST https://hisarpay.com/v1/invoices \
  -H "Authorization: Bearer $HISARPAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "price_usd": "49.90",
    "order_id": "order_1001",
    "description": "Pro plan, 1 month",
    "success_url": "https://shop.example/thanks"
  }'

Details in the guide

GET/v1/invoices

List invoices (newest first)

Filters can be combined. q finds an invoice by its id or the beginning of it, its order id, payment address or transaction id, or by part of its description or customer e-mail.

Scope: invoicesKey: live or test

Query parameters

  • statusstringoptional

    Comma-separated: pending, partial, paid, overpaid, expired, cancelled

  • sourcestringoptional

    Comma-separated: api, panel, link, telegram

  • tokenstringoptional

    Coin: TRX or USDT.

    Values:TRXUSDT

  • created_fromstringoptional

    Created at or after. A day like 2026-12-01 (UTC) or a time like 2026-12-01T09:30:00Z

  • created_tostringoptional

    Created before. A day is taken in whole

  • qstringoptional

    Search text

    ≤ 100 chars

  • limitintegeroptional

    Page size.

    1–100

  • beforestring (uuid)optional

    next_before from the previous response, for the next page.

Responses

  • 200 OKJSON response
    2 fields
    • dataarray<Invoice>
    • next_beforestring | number· nullable
Example request
curl "https://hisarpay.com/v1/invoices?limit=20" \
  -H "Authorization: Bearer $HISARPAY_API_KEY"

Details in the guide

GET/v1/invoices/by-order/{order_id}

Get an invoice by your order id

Scope: invoicesKey: live or test

Path parameters

  • order_idstringrequired

    The order_id you set when creating the invoice.

    1–128 chars

Responses

Example request
curl https://hisarpay.com/v1/invoices/by-order/order_1001 \
  -H "Authorization: Bearer $HISARPAY_API_KEY"
GET/v1/invoices/{id}

Get an invoice with its payments

Scope: invoicesKey: live or test

Path parameters

  • idstring (uuid)required

    The record id.

Responses

Example request
curl https://hisarpay.com/v1/invoices/0b6a3f52-3c1d-4a7e-8f4b-1d2c3e4f5a6b \
  -H "Authorization: Bearer $HISARPAY_API_KEY"
POST/v1/invoices/{id}/cancel

Cancel a pending invoice with nothing received

Scope: invoicesKey: live or test

Path parameters

  • idstring (uuid)required

    The record id.

Responses

Example request
curl -X POST https://hisarpay.com/v1/invoices/0b6a3f52-3c1d-4a7e-8f4b-1d2c3e4f5a6b/cancel \
  -H "Authorization: Bearer $HISARPAY_API_KEY"

Details in the guide

POST/v1/invoices/{id}/simulate

Simulate a payment (test keys only)

Scope: invoicesKey: test only

Path parameters

  • idstring (uuid)required

    The record id.

Request body

  • outcomestringrequired

    Values:paidpartialoverpaidexpired

  • amountstringoptional

    pattern ^(0|[1-9]\d{0,11})(\.\d{1,6})?$

Responses

Example request
curl -X POST https://hisarpay.com/v1/invoices/0b6a3f52-3c1d-4a7e-8f4b-1d2c3e4f5a6b/simulate \
  -H "Authorization: Bearer $HISARPAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "outcome": "partial",
    "amount": "13"
  }'

Details in the guide