Get invoice
https://api.triport.io/v1/billing/invoices/inv_8f2c1a7e9b3d4e6fFetch a single invoice you own, including its payment address, QR payment URI, and how much has been received so far.
Returns the full state of one invoice belonging to the authenticated user. Use it
to render an invoice/checkout screen: the response carries the canonical
status, the deposit address for the chosen rail, a ready-to-render qr_uri,
and payments_received_micro so you can show progress toward the amount due.
This is the snapshot endpoint. For a live feed of status changes (payment
detected, paid, expired, cancelled) open the SSE stream at
GET /v1/billing/invoices/{id}/events instead of polling
this route.
Invoices are scoped to their owner. Requesting an id that does not exist — or
one that belongs to another user — returns 404 (the API does not distinguish
the two cases, so it never leaks the existence of someone else's invoice).
Parameters
Path parameters
idstringrequiredPOST /v1/billing/invoices or GET /v1/billing/invoices).Response
200 OK
idstringuser_idstringamount_micronumber1_000_000 = 1.00 USD).statusstringpending, paid, expired, cancelled.descriptionstringchannelstringcrypto-onchain or crypto-inapp.railstringbill_actionobject{ type, plan, months } where type is subscription_purchase, subscription_renew, or topup.client_request_idstringfx_rate_micro_per_atomicnumberreference_pubkeystringcreated_atstringexpires_atstringpending invoice is swept to expired.paid_atstringprocessed_atstringamount_usdstringamount_micro formatted as a decimal USD string, e.g. "49.00".addressobjectqr_uristringpayments_received_micronumberErrors
| Code | Meaning | When it happens |
|---|---|---|
401 | auth required | No valid nl_session cookie on the request. |
404 | not found | The invoice does not exist, or it is not owned by the requesting user. |
All errors share the standard envelope { "error": "<message>" }. See
errors.md for the full error model.
Examples
JavaScript (fetch)
async function getInvoice(id) {
const r = await fetch(`https://api.triport.io/v1/billing/invoices/${id}`, {
headers: { 'Content-Type': 'application/json' },
credentials: 'include', // send the nl_session cookie
});
if (!r.ok) {
const body = await r.json().catch(() => ({}));
throw new Error(body.error || `HTTP ${r.status}`);
}
return r.json();
}
const invoice = await getInvoice('inv_8f2c1a7e9b3d4e6f');
console.log(invoice.status, invoice.amount_usd, invoice.address?.address);TypeScript SDK (@triport/sdk)
import { Triport } from '@triport/sdk';
const triport = new Triport({ apiKey: process.env.TRIPORT_API_KEY! });
const invoice = await triport.billing.invoices.get('inv_8f2c1a7e9b3d4e6f');
console.log(invoice.status); // "pending"
console.log(invoice.amountUsd); // "49.00"
console.log(invoice.address?.address); // "0x3a1F9C7b..."
console.log(invoice.paymentsReceivedMicro); // 0Python (triport-sdk)
import os
from triport import Triport
triport = Triport(api_key=os.environ["TRIPORT_API_KEY"])
invoice = triport.billing.invoices.get("inv_8f2c1a7e9b3d4e6f")
print(invoice.status, invoice.amount_usd, invoice.address.address)Notes
- Snapshot, not a stream. To react to payment in real time, subscribe to
GET /v1/billing/invoices/{id}/eventsrather than polling this endpoint. amount_usdvsamount_micro.amount_microis the precise integer amount in micro-units;amount_usdis the same value pre-formatted for display. Compute progress from the*_microfields, not the string.- Address availability.
addressandqr_uriare present for a normal per-rail invoice. If they are missing, the rail/address has not been resolved yet — re-fetch shortly or check the invoice was created against a valid rail. - Related endpoints: list invoices, create invoice, cancel invoice, pay from balance.