Fiat Orders
Fiat orders are card payments processed by us. This page covers:- List fiat orders (
GET /api/fiat/orders) — cursor pagination - Create a fiat order (
POST /api/fiat/orders) — returnspayUrl - Delete a fiat order by reference (
DELETE /api/fiat/orders?reference=...) — proxy-friendly safety delete - Fetch a fiat order by
orderKey(GET /api/fiat/orders/:orderKey) — includes pricing + fee snapshot - Cancel a fiat order by
orderKey(DELETE /api/fiat/orders/:orderKey) — cancels upstream PSP order - Cancel a fiat order by reference (
DELETE /api/fiat/orders/cancel?reference=...) - List refunds (
GET /api/fiat/orders/:orderKey/refunds) - Create a refund (
POST /api/fiat/orders/:orderKey/refunds) — supports partial/multiple refunds
Base URL
All examples use:https://www.niftipay.com
Authentication
These endpoints support two authentication methods:1) API Key (recommended for integrations)
Send your API key in thex-api-key header.
2) Session cookie (browser / dashboard usage)
If you are authenticated via the dashboard.Concepts
Amounts are stored in minor units
Fiat orders store monetary values as minor units (e.g. cents):amountCents— what the customer will pay (total)subtotalCents— the base subtotal (before service fee if customer pays)serviceFeeCents— total service maintenance fee (provider + platform), if applicable
Currency minor unit rules
This implementation supports currencies with:- 0 decimals (e.g. JPY)
- 2 decimals (most currencies)
- 3 decimals (e.g. BHD)
amount as a string/number, it is converted to minor units using the currency’s decimal rules and rejects too many decimals.
Service fee payer
The fiat checkout supports a service maintenance fee with two payer modes:-
serviceFeePayer = "customer"
Customer pays: total = subtotal + fee
The fee is shown as a line item in pricing. -
serviceFeePayer = "merchant"
Customer pays: total = subtotal
The fee is deducted from merchant earnings (not shown to customer as a separate line in pricing).
serviceFeePayer is not provided on create, the system falls back to the user’s default (GET /api/fiat/settings).
References and uniqueness
On creation, the route normalizes a reference from:reference(preferred)- else
merchantReference(fallback)
- cannot conflict with a crypto order reference
- cannot conflict with an existing fiat order reference
409.
Pricing and fee snapshots
Responses include:pricing
A stable, UI-friendly breakdown:
payer(customerormerchant)subtotalCents,serviceFeeCents,totalCentsserviceFeePercent(may be null)lines(Subtotal / Service maintenance fee / Total)
fees (order details endpoint only)
A stable snapshot structure (written by registerFiatOrderFees()), including:
- service fee split (provider vs platform)
- payout fee / retention hold
- vendor net / payable now after deductions
List Fiat Orders
Endpoint
GET /api/fiat/orders
Lists your fiat orders, newest first, using cursor pagination.
Query parameters
| Name | Type | Default | Notes |
|---|---|---|---|
status | string | — | Optional filter. |
limit | number | 20 | Min 1, max 100. |
cursor | number | — | Use nextCursor from the previous response to fetch older records. |
Example: list latest orders
Example response
Pagination example
IfnextCursor is not null, pass it back as cursor to fetch older results:
Create Fiat Order
Endpoint
POST /api/fiat/orders
Creates a fiat order and attempts to create the upstream NoPayn order. On success, returns:
order(DB row)pricing(decorated)display(decimal strings for UI)payUrl(where to redirect the customer)nopayninfo
Payment method gating
This endpoint enforces fiat availability for your account. If fiat card payments are disabled, it returns403.
Request body
Fields
| Field | Type | Required | Notes |
|---|---|---|---|
integrationId | string | ✅ | Must exist and belong to you. |
currency | string | ✅ | ISO currency code (e.g. EUR, GBP). |
amount | string/number | ⚠️ | Required unless amountCents is provided. |
amountCents | number | ⚠️ | Alternative to amount. Must be a positive integer. |
description | string | ❌ | Passed to PSP for display. |
reference | string | ❌ | Preferred merchant reference (normalized). |
merchantReference | string | ❌ | Legacy alias; used if reference is missing. |
serviceFeePayer | string | ❌ | "customer" or "merchant". Defaults to your fiat settings. |
Provide eitheramountoramountCents.
Example: create order with amount string
Example success response (201)
payUrl is what you should open/redirect the customer to.
Example: create order with amountCents
Common create errors
Invalid JSON (400)
Payment method disabled (403)
Missing required fields (400)
Invalid amount (400)
Invalid serviceFeePayer (400)
Reference conflict (409)
Integration not found (404)
Upstream PSP error (502)
If NoPayn fails, the order is markedstatus="error" locally and you get:
Delete Fiat Order (by reference)
Endpoint
DELETE /api/fiat/orders?reference=<reference>
This is a proxy-friendly delete that mirrors your crypto delete behavior.
Matching rules:
- first tries strict match:
fiatOrder.merchantReference === reference(newest first) - fallback: if reference is numeric, match by
fiatOrder.orderKey === Number(reference)
Safety rules
Deletion is conservative:- You cannot delete
completed,paid, orrefundedorders - If
pspOrderIdexists, the order must already becancelledbefore deletion
Example request
Success response
204 No Content
Error responses
Missing reference (400)Get Fiat Order (by orderKey)
Endpoint
GET /api/fiat/orders/:orderKey
Returns:
order(DB row)pricing(decorated)fees(snapshot breakdown)
Example request
Example response
Cancel Fiat Order (by orderKey)
Endpoint
DELETE /api/fiat/orders/:orderKey
This attempts to cancel the upstream PSP order (NoPayn) and then updates the local DB.
Behavior
- If already cancelled, returns current state (idempotent).
- If status is
completed, cancellation is blocked (safe default). - Requires
pspOrderIdto exist. - Only
psp="nopayn"is supported here.
Example request
Example response
Cancel error examples
Invalid orderKey (400)Cancel Fiat Order (by reference)
Endpoint
DELETE /api/fiat/orders/cancel?reference=<reference>
Cancel using the same matching rules as delete-by-reference:
- strict merchantReference match
- numeric fallback to orderKey
Example request
Responses
- Returns
order+pricing+nopaynon success - Same error patterns as cancel by orderKey
Refunds (Fiat)
Refunds are executed at the PSP level (NoPayn) and support partial / multiple refunds. Refund creation is conservative:- Only for
kind="order"(not payment links) - Only allowed when order is
paidorcompleted - Prevents over-refund by reading current refunds from NoPayn first
- If
serviceFeePayer="customer": refundable ceiling = total paid (amountCents) - If
serviceFeePayer="merchant": refundable ceiling = subtotal only (subtotalCents)
(Because the customer never paid the service fee)
List refunds
Endpoint
GET /api/fiat/orders/:orderKey/refunds
Returns:
refunds(from NoPayn)- computed meta:
maxRefundableCents,refundedCents,remainingRefundableCents
Example request
Example response
Common list-refunds errors
Invalid orderKey (400)Create refund
Endpoint
POST /api/fiat/orders/:orderKey/refunds
Request body
Fields
| Field | Type | Required | Notes |
|---|---|---|---|
amountCents | number | ✅ | Positive integer. Must not exceed remaining refundable. |
description | string | ❌ | Optional PSP description. |
orderLines | array/null | ❌ | If provided: must be a non-empty array with { merchantOrderLineId, quantity }, or null. |
orderLinesvalidation:
orderLinesmust be non-empty if provided as an array- each line requires a non-empty
merchantOrderLineIdquantitymust be a positive integer
Example request
Example response (201)
fiatOrder.status is updated to "refunded".
Common refund errors
Invalid JSON (400)Status notes
Fiat order status values come from the PSP status field in practice (e.g. NoPayn’sstatus), plus local states:
new— created locally (and usually also created upstream)cancelled— cancelled locally (and upstream when possible)completed/paid— successful paymentrefunded— fully refunded (local state set when refundable remaining reaches 0)error— upstream create failed