This API allows you to create and manage invoices for your account. Invoices represent billing documents sent to customers with line items for products and services.
The invoice object
Unique identifier with inv_ prefix (e.g., inv_abc123def456).
The customer’s ID associated with this invoice.
The associated subscription ID. null for standalone invoices.
Invoice status: pending, paid, overdue, or canceled.
The invoice due date (format: YYYY-MM-DD).
Total amount for the invoice.
Array of line items on the invoice. Show line item properties
Unique identifier for the line item.
The price ID referenced by this line item.
The product ID for this line item.
line_items[].product_name
The product name.
Total amount for this line item (unit_amount x quantity).
When the invoice was created (ISO 8601).
When the invoice was last updated (ISO 8601).
List invoices
Retrieves a paginated list of all invoices in your account.
Page number for pagination. Results are returned 25 items per page.
curl https://api.gettrxn.com/v1/invoices \
-H "Authorization: Bearer $TRXN_TOKEN "
{
"invoices" : [
{
"id" : "inv_abc123def456" ,
"customer_id" : "cus_xyz789" ,
"subscription_id" : null ,
"status" : "pending" ,
"due_date" : "2025-02-28" ,
"total_amount" : "199.98" ,
"created_at" : "2025-01-15T12:00:00Z" ,
"updated_at" : "2025-01-15T12:00:00Z" ,
"line_items" : [
{
"id" : "li_item123" ,
"price_id" : "pri_abc123" ,
"product_id" : "pro_xyz789" ,
"product_name" : "Premium Plan" ,
"quantity" : 2 ,
"unit_amount" : "99.99" ,
"amount" : "199.98"
}
]
}
],
"pagination" : {
"page" : 1 ,
"pages" : 3 ,
"count" : 67
}
}
Get invoice
Retrieves a specific invoice by ID with all line items.
The invoice’s ID (e.g., inv_abc123def456).
curl https://api.gettrxn.com/v1/invoices/inv_abc123def456 \
-H "Authorization: Bearer $TRXN_TOKEN "
{
"id" : "inv_abc123def456" ,
"customer_id" : "cus_xyz789" ,
"subscription_id" : "sub_def456" ,
"status" : "pending" ,
"due_date" : "2025-02-28" ,
"total_amount" : "99.99" ,
"created_at" : "2025-01-15T12:00:00Z" ,
"updated_at" : "2025-01-15T12:00:00Z" ,
"line_items" : [
{
"id" : "li_item123" ,
"price_id" : "pri_abc123" ,
"product_id" : "pro_xyz789" ,
"product_name" : "Premium Plan" ,
"quantity" : 1 ,
"unit_amount" : "99.99" ,
"amount" : "99.99"
}
]
}
Create invoice
Creates a new invoice with optional line items.
The customer’s ID (e.g., cus_xyz789). Must belong to your account.
The invoice due date (format: YYYY-MM-DD).
Invoice status. One of: pending, paid, overdue, canceled.
Associated subscription ID.
Array of line item objects. Show line item properties
The price ID for the line item. Must belong to your account.
Quantity for this line item.
Override amount for the line item.
curl -X POST https://api.gettrxn.com/v1/invoices \
-H "Authorization: Bearer $TRXN_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"customer_id": "cus_xyz789",
"due_date": "2025-02-28",
"line_items": [
{"price_id": "pri_abc123", "quantity": 2}
]
}'
{
"id" : "inv_new123invoice456" ,
"customer_id" : "cus_xyz789" ,
"subscription_id" : null ,
"status" : "pending" ,
"due_date" : "2025-02-28" ,
"total_amount" : "199.98" ,
"created_at" : "2025-01-15T14:30:00Z" ,
"updated_at" : "2025-01-15T14:30:00Z" ,
"line_items" : [
{
"id" : "li_new123" ,
"price_id" : "pri_abc123" ,
"product_id" : "pro_xyz789" ,
"product_name" : "Premium Plan" ,
"quantity" : 2 ,
"unit_amount" : "99.99" ,
"amount" : "199.98"
}
]
}
Error responses
{
"error" : "Customer not found"
}
{
"error" : "Price not found: pri_invalid123"
}
Update invoice
Updates an existing invoice’s status or due date.
Invoice status. One of: pending, paid, overdue, canceled.
The invoice due date (format: YYYY-MM-DD).
curl -X PATCH https://api.gettrxn.com/v1/invoices/inv_abc123def456 \
-H "Authorization: Bearer $TRXN_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"status": "paid"
}'
{
"id" : "inv_abc123def456" ,
"customer_id" : "cus_xyz789" ,
"status" : "paid" ,
"due_date" : "2025-02-28" ,
"total_amount" : "99.99" ,
"created_at" : "2025-01-15T12:00:00Z" ,
"updated_at" : "2025-01-16T10:00:00Z" ,
"line_items" : [ ... ]
}
Delete invoice
Deletes an invoice from your account.
curl -X DELETE https://api.gettrxn.com/v1/invoices/inv_abc123def456 \
-H "Authorization: Bearer $TRXN_TOKEN "
Returns 204 No Content on successful deletion.
Invoice status values
Status Description pendingInvoice has been created but not yet paid. paidInvoice has been fully paid. overdueInvoice is past its due date. canceledInvoice has been canceled.
Usage flow
Create a customer using the Customers API.
Create products and prices using the Products and Prices APIs.
Create an invoice with line items referencing your prices.
Send the invoice to your customer (via your application).
Update status to paid when payment is received.
Track overdue invoices and follow up as needed.
Integration example
# 1. Create a customer
curl -X POST https://api.gettrxn.com/v1/customers \
-H "Authorization: Bearer $TRXN_TOKEN " \
-H "Content-Type: application/json" \
-d '{"email": "[email protected] "}'
# Response: {"id": "cus_abc123", ...}
# 2. Create an invoice for the customer
curl -X POST https://api.gettrxn.com/v1/invoices \
-H "Authorization: Bearer $TRXN_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"customer_id": "cus_abc123",
"due_date": "2025-02-28",
"line_items": [
{"price_id": "pri_monthly_plan", "quantity": 1}
]
}'
# 3. Mark invoice as paid when payment received
curl -X PATCH https://api.gettrxn.com/v1/invoices/inv_xyz789 \
-H "Authorization: Bearer $TRXN_TOKEN " \
-H "Content-Type: application/json" \
-d '{"status": "paid"}'
Sandbox support
The API respects sandbox scoping. If your API token is associated with a sandbox, you can only access invoices created in that sandbox. Invoices created in sandbox mode will be isolated from production data.