Skip to content

Get Customer Invoices

About

The customerInvoices query retrieves a paginated list of invoices belonging to the authenticated customer's orders. This is a read-only API — customers can only view their own invoices. Use this query to:

  • Display invoice history in the customer's account dashboard
  • Show invoice list with state, totals, and dates
  • Filter invoices by order ID or payment state
  • Implement pagination for customers with many invoices
  • Build invoice tracking interfaces

Invoices are automatically scoped to the authenticated customer via the order relationship.

Authentication

This query requires customer authentication:

  • Authenticated customers: Provide a valid customer authentication token in the Authorization header. Obtain this token via the Customer Login API.
Authorization: Bearer <accessToken>
X-STOREFRONT-KEY: <storefrontKey>

Arguments

ArgumentTypeRequiredDescription
firstInt❌ NoNumber of items to return (forward pagination). Max: 100.
afterString❌ NoCursor for forward pagination. Use endCursor from previous response.
lastInt❌ NoNumber of items for backward pagination. Max: 100.
beforeString❌ NoCursor for backward pagination. Use startCursor from previous response.
orderIdInt❌ NoFilter invoices by order ID.
stateString❌ NoFilter by invoice state: pending, pending_payment, paid, overdue, refunded.

Possible Returns

FieldTypeDescription
edges[CustomerInvoiceEdge!]Array of invoice edges with cursor and node.
edges.cursorString!Cursor for this edge, used in pagination.
edges.nodeCustomerInvoice!The customer invoice object.
edges.node._idInt!Numeric invoice ID.
edges.node.incrementIdString!Human-readable invoice number (e.g. INV-001).
edges.node.stateString!Invoice state: pending, pending_payment, paid, overdue, refunded.
edges.node.totalQtyInt!Total quantity of items in the invoice.
edges.node.emailSentBooleanWhether the invoice email was sent.
edges.node.grandTotalFloat!Grand total.
edges.node.baseGrandTotalFloat!Base grand total.
edges.node.subTotalFloat!Sub total.
edges.node.baseSubTotalFloat!Base sub total.
edges.node.shippingAmountFloatShipping amount.
edges.node.baseShippingAmountFloatBase shipping amount.
edges.node.taxAmountFloatTax amount.
edges.node.baseTaxAmountFloatBase tax amount.
edges.node.discountAmountFloatDiscount amount.
edges.node.baseDiscountAmountFloatBase discount amount.
edges.node.shippingTaxAmountFloatShipping tax amount.
edges.node.baseShippingTaxAmountFloatBase shipping tax amount.
edges.node.subTotalInclTaxFloatSub total including tax.
edges.node.baseSubTotalInclTaxFloatBase sub total including tax.
edges.node.shippingAmountInclTaxFloatShipping amount including tax.
edges.node.baseShippingAmountInclTaxFloatBase shipping amount including tax.
edges.node.baseCurrencyCodeString!Base currency code (e.g. USD).
edges.node.channelCurrencyCodeStringChannel currency code.
edges.node.orderCurrencyCodeString!Order currency code.
edges.node.transactionIdStringPayment transaction ID.
edges.node.remindersIntNumber of reminders sent.
edges.node.nextReminderAtDateTimeNext reminder scheduled date.
edges.node.createdAtDateTime!Invoice creation timestamp.
edges.node.updatedAtDateTime!Invoice last update timestamp.
pageInfoPageInfo!Pagination metadata.
pageInfo.hasNextPageBoolean!Whether more pages exist forward.
pageInfo.hasPreviousPageBoolean!Whether more pages exist backward.
pageInfo.startCursorStringCursor for first item in page.
pageInfo.endCursorStringCursor for last item in page.
totalCountInt!Total invoices matching filters.

Invoice State Values

StateDescription
pendingInvoice created, awaiting action
pending_paymentPayment initiated but not yet confirmed
paidPayment received and confirmed
overduePayment past due date
refundedInvoice has been refunded

Use Cases

1. Invoice History Dashboard

Fetch all customer invoices to display in the account dashboard with pagination.

2. Order-Specific Invoices

Filter by orderId to show all invoices associated with a specific order.

3. Paid Invoices

Filter by state: "paid" to show confirmed payment history.

4. Pending Payments

Filter by state: "pending" or state: "pending_payment" to show outstanding invoices.

Best Practices

  1. Use Pagination — Always implement pagination for better performance
  2. Show State — Display the invoice state prominently so customers can track payment status
  3. Filter by Order — Use orderId filter when showing invoices within an order detail page
  4. Cache Results — Cache invoice lists for better performance
  5. Handle Empty States — Provide helpful UI when the customer has no invoices

Error Handling

Unauthenticated Request

json
{
  "errors": [
    {
      "message": "Customer is not logged in.",
      "locations": [{ "line": 2, "column": 3 }],
      "path": ["customerInvoices"]
    }
  ]
}

Released under the MIT License.