Skip to main content
ShadhinPay Docs

Invoices

Create invoices via the API, share the hosted payment page, and get notified when they're paid.

Invoices let you bill a customer without building your own checkout: ShadhinPay hosts a public payment page, and you get an invoice.paid webhook when it's settled. They're ideal for remote sales, quotes, and "pay this link" flows.

Create an invoice

POST /api/v1/invoices

Requires the auth headers. You provide:

  • Line items — each with a description, quantity (> 0), and unit price (≥ 0)
  • Discount and tax — optional; the total must equal subtotal − discount + tax
  • Total — between "10" and "200000" BDT (see Money)
  • Expiry — optional ISO-8601 date-time in the future; after it, the invoice can't be paid
  • Redirect URL — optional; where to send the payer after payment (HTTPS in live)
  • Note — optional message to the payer

Create it as a draft first, or send it immediately.

The response includes the invoice's human-readable number (INV-HB_71c4-00042) and its public payment URL.

Exact field names live in the API Reference

This page covers the concepts and the lifecycle. For the precise request and response schemas, see the generated API Reference once it's published from the backend OpenAPI specs.

Sharing

Each invoice has an unguessable public link:

https://com.shadhinpay.pay/i/{slug}

Share it as a link, render it as a QR code, or send it to the payer by email/SMS. The hosted page shows your logo, business name, the itemised total, and lets the payer pay with any enabled provider.

Invoice lifecycle

StatusMeaning
DRAFTCreated, not yet shared
SENTLive and payable
VIEWEDThe payer opened the link (still payable)
PAIDPayment received — terminal
CANCELLEDYou cancelled it — terminal
EXPIREDExpiry passed before payment — terminal

If a payment attempt fails, is cancelled, or expires, the invoice returns to SENT (provided it hasn't itself expired or been cancelled) so the payer can try again.

Getting notified

When the payer completes payment, the invoice flips to PAID and you receive an invoice.paid webhook. An invoice.expired webhook fires if it lapses. See Webhooks.

Refunding an invoice payment does not change the invoice status — it stays PAID, and the refund is tracked on the underlying payment.

Next steps

On this page