API ReferenceLast reviewed: Fri Dec 12 2025 00:00:00 GMT+0000 (Coordinated Universal Time)

Invoices

Create and manage invoices

Invoices

Create and manage invoices.

GET Get All Invoices

GET /query?action=invoice

Returns a paginated list of invoices. Supports optional filters:

FilterDescription
customer_idLimit to a specific customer
statusInvoice status (e.g., Pending, Sent, Paid)
due_beforeInvoices due before date (YYYY-MM-DD)
due_afterInvoices due after date (YYYY-MM-DD)

GET Get Single Invoice

GET /query/invoice/{id}

Returns a single invoice by unique ID. If not found, returns 404.

POST Create Invoice

POST /query?action=invoice

Body:

json
1{
2  "x_login": "...",
3  "x_tran_key": "...",
4  "invoice": {
5    "invoice_number": "INV-2024-001",
6    "due_date": "2024-12-31",
7    "notes": "Thank you for your business",
8    "discount": 0,
9    "tax": 10.50,
10    "shipping": 5.00,
11    "amount": 635.50,
12    "customer_id": 123,
13    "items": [
14      {
15        "title": "Web Design",
16        "description": "Homepage design",
17        "quantity": 1,
18        "unit_price": 500.00
19      },
20      {
21        "title": "Hosting",
22        "quantity": 12,
23        "unit_price": 10.00
24      }
25    ]
26  }
27}

Note:

  • Provide customer_id to associate the invoice with an existing customer.
  • If customer_id is omitted, include a full customer object to create a new customer.

Create Invoice

POST /query?action=invoice

Body:

json
1{
2  "x_login": "...",
3  "x_tran_key": "...",
4  "invoice": {
5    "invoice_number": "INV-2024-001",
6    "due_date": "2024-12-31",
7    "notes": "Thank you for your business",
8    "discount": 0,
9    "tax": 10.50,
10    "shipping": 5.00,
11    "amount": 635.50,
12    "customer_id": 123, // Optional: use existing customer
13    // Alternatively provide full customer payload to create new
14    // "customer": {
15    //   "customer_information": {
16    //     "firstname": "John",
17    //     "lastname": "Doe",
18    //     "email": "john@example.com"
19    //   }
20    // },
21    "items": [
22      {
23        "title": "Web Design",
24        "description": "Homepage design",
25        "quantity": 1,
26        "unit_price": 500.00
27      },
28      {
29        "title": "Hosting",
30        "quantity": 12,
31        "unit_price": 10.00
32      }
33    ]
34  }
35}

Note: Provide customer_id to associate with an existing customer. If customer_id is omitted, include a full customer object to create a new customer.

PUT Update Invoice

PUT /query?action=invoice

Body:

json
1{
2  "x_login": "...",
3  "x_tran_key": "...",
4  "_method": "PUT",
5  "invoice": {
6    "uniqueID": 456,
7    "notes": "Updated notes",
8    "status": "Sent"
9  }
10}

DELETE Delete Invoice

DELETE /query?action=invoice&invoiceID={id}

Example:

bash
1DELETE /query?action=invoice&invoiceID=456

Ready to design your custom plan?

Join the fastest-growing companies using Troute to scale their payments infrastructure.

Talk to sales