List Invoices

List invoices with pagination and status filtering
View as Markdown

List invoices

1import { Gwop } from "@gwop/sdk";
2
3const gwop = new Gwop({
4 merchantApiKey: process.env.GWOP_MERCHANT_API_KEY,
5});
6
7const { result } = await gwop.invoices.list();
8
9for (const invoice of result.invoices) {
10 console.log(invoice.publicInvoiceId, invoice.status, invoice.amountUsdc);
11}
12
13console.log(result.pagination); // { total, limit, offset, hasMore }

Response

1{
2 "invoices": [
3 {
4 "id": "b86a7705-894f-4440-a9b7-5825e0d4e90d",
5 "publicInvoiceId": "inv_9cdcc39d096a4c249e2fd3fb729ffcf7",
6 "status": "EXPIRED",
7 "amountUsdc": 102500,
8 "currency": "USDC",
9 "metadata": {
10 "fee_usdc": 2500,
11 "base_amount_usdc": 100000,
12 "fee_basis_points": 250,
13 "total_amount_usdc": 102500
14 },
15 "expiresAt": "2026-03-25T01:43:46.451Z",
16 "createdAt": "2026-03-25T01:42:46.485Z"
17 }
18 ],
19 "pagination": {
20 "total": 79,
21 "limit": 20,
22 "offset": 0,
23 "hasMore": true
24 }
25}

Parameters

FieldTypeRequiredDefaultDescription
limitnumberNo20Number of invoices per page (max 100)
offsetnumberNo0Number of invoices to skip
statusstringNoFilter by status: OPEN, PAYING, PAID, EXPIRED, CANCELED

Pagination

Results are ordered newest-first. Use offset and limit to page through results:

1let offset = 0;
2const limit = 20;
3const allInvoices = [];
4
5while (true) {
6 const { result } = await gwop.invoices.list({ limit, offset });
7 allInvoices.push(...result.invoices);
8
9 if (!result.pagination.hasMore) break;
10 offset += limit;
11}

The pagination object tells you where you are:

FieldTypeDescription
totalnumberTotal invoices matching the filter
limitnumberPage size used
offsetnumberCurrent offset
hasMorebooleantrue if more pages exist

Filter by status

Pass status to return only invoices in a specific state:

1// Get all paid invoices
2const { result: paid } = await gwop.invoices.list({ status: "PAID" });
3
4// Get open invoices (awaiting payment)
5const { result: open } = await gwop.invoices.list({ status: "OPEN" });

Valid statuses:

StatusMeaning
OPENAwaiting payment
PAYINGPayment detected, confirming on-chain
PAIDPayment confirmed and settled
EXPIREDInvoice TTL reached without payment
CANCELEDMerchant canceled the invoice

Invoice list item shape

Each item in the invoices array is a summary — lighter than the full invoice from get().

FieldTypePresentDescription
idstringAlwaysMerchant-side UUID
publicInvoiceIdstringAlwaysPayer-facing inv_* identifier
statusstringAlwaysCurrent status
amountUsdcnumberAlwaysTotal amount including fees (6 decimals)
currencystringAlwaysAlways "USDC"
descriptionstringIf setInvoice description
metadataobjectIf setIncludes fee breakdown
createdAtDateAlwaysCreation timestamp
expiresAtDateAlwaysExpiry timestamp
paidAtDatePaid onlySettlement timestamp
paidTxHashstringPaid onlyTransaction hash (Base58 for Solana, hex for Base)
paymentChainstringPaid only"solana" or "base"

Payment fields (paidAt, paidTxHash, paymentChain) are only present on paid invoices. They are undefined for open, expired, and canceled invoices.

Next step