Invoices
Create an invoice
Creates an invoice.
Authorization
bearerAuth AuthorizationBearer <token>
In: header
Request Body
application/json
Invoice payload
account_id*string
Account ID associated with the invoice.
currency*string
Currency of the invoice.
Match
^[A-Z]{3}$collection_method*string
Payment collection method for the invoice.
Value in
"automatic" | "manual"payment_method_id?string|null
Payment method ID to charge (required if collection_method is automatic).
due_at*string
Date the invoice is due.
Format
date-timeline_items*
Items in the invoice.
Response Body
application/json
curl -X POST "https://api.sandbox.billingrails.com/v1/invoices" \ -H "Content-Type: application/json" \ -d '{ "account_id": "acc_IhMUl3rrZ3", "currency": "USD", "collection_method": "manual", "due_at": "2025-02-14T17:33:40.843Z", "line_items": [ { "name": "Service", "quantity": 1, "unit_amount": 1000 } ] }'{
"invoice": {
"object": "invoice",
"id": "inv_IhMUl3rrZ3",
"number": "INV-0001",
"type": "adhoc",
"status": "draft",
"account_id": "acc_IhMUl3rrZ3",
"currency": "USD",
"collection_method": "manual",
"credit_amount": 0,
"outstanding_amount": 1000,
"paid_amount": 0,
"download_url": "https://billingrails.page/acme/i/inv_IhMUl3rrZ3/pdf",
"hosted_url": "https://billingrails.page/acme/i/inv_IhMUl3rrZ3",
"subscription_id": "sub_IhMUl3rrZ3",
"subtotal_amount": 1000,
"total_amount": 1000,
"created_at": "2025-02-14T17:33:40.843Z",
"due_at": "2025-02-14T17:33:40.843Z",
"issued_at": "2025-02-14T17:33:40.843Z",
"billing_start": "2025-02-14T17:33:40.843Z",
"billing_end": "2025-02-14T17:33:40.843Z",
"line_items": [
{
"object": "invoice_line_item",
"id": "invli_IhMUl3rrZ3",
"name": "Basic Plan",
"description": "Basic Plan.",
"quantity": 1,
"unit_amount": 1000,
"subtotal_amount": 1000,
"total_amount": 1000,
"billing_start": "2025-02-14T17:33:40.843Z",
"billing_end": "2025-02-14T17:33:40.843Z"
}
]
},
"meta": {
"request_id": "req_IhMUl3rrZ3"
}
}