Invoicing
An invoice represents a balance owed to you by a Customer. Each invoice has a collection of line items that detail the products or services that are now due. An invoice can be in one of many different states depending on the due date, payments, and whether it was sent to or viewed by the customer.
Invoices can be marked as paid with Payments. Once the sum of all payments for an invoice is greater than or equal to the total then the invoice will be considered paid in full.
Invoice Object
Attributes
{
"attempt_count": 0,
"autopay": false,
"balance": 51.15,
"closed": false,
"created_at": 1415229884,
"currency": "usd",
"customer": 15444,
"date": 1416290400,
"discounts": [],
"draft": false,
"due_date": 1417500000,
"id": 46225,
"items": [
{
"amount": 45,
"catalog_item": null,
"description": null,
"discountable": true,
"discounts": [],
"id": 7,
"metadata": [],
"name": "Copy Paper, Case",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "product",
"unit_cost": 45
},
{
"amount": 10,
"catalog_item": "delivery",
"description": null,
"discountable": true,
"discounts": [],
"id": 8,
"metadata": [],
"name": "Delivery",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "service",
"unit_cost": 10
}
],
"metadata": [],
"name": null,
"next_payment_attempt": null,
"notes": null,
"number": "INV-0016",
"object": "invoice",
"paid": false,
"payment_plan": null,
"payment_terms": "NET 14",
"payment_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/payment",
"pdf_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/pdf",
"purchase_order": null,
"ship_to": null,
"status": "not_sent",
"subscription": null,
"subtotal": 55,
"taxes": [
{
"amount": 3.85,
"id": 20554,
"object": "tax",
"tax_rate": null
}
],
"total": 51.15,
"updated_at": 1415229884,
"url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY"
}
Parameter | Type | Description |
---|---|---|
id | integer | The invoice's unique ID |
object | string | Object type, invoice |
customer | integer | Customer ID |
name | string | Invoice name for internal use, defaults to "Invoice" |
number | string | The reference number assigned to the invoice for use in the dashboard |
autopay | boolean | AutoPay enabled? |
currency | string | 3-letter ISO code |
draft | boolean | When false, the invoice is considered outstanding, or when true, the invoice is a draft |
closed | boolean | When true, an invoice is closed and considered bad debt. No further payments are allowed. |
paid | boolean | Indicates whether an invoice has been paid in full |
status | string | Invoice state, one of draft , not_sent , sent , viewed , past_due , pending , paid , voided |
attempt_count | integer | # of payment attempts |
next_payment_attempt | timestamp | Next scheduled charge attempt, when in automatic collection |
subscription | integer | Subscription ID if invoice came from subscription |
date | timestamp | Invoice date |
due_date | timestamp | Date payment is due by |
payment_terms | string | Payment terms for the invoice, i.e. "NET 30" |
purchase_order | string | The customer's purchase order number |
items | array | Collection of Line Items |
notes | string | Additional notes displayed on invoice |
subtotal | number | Subtotal |
discounts | array | Collection of Discounts |
taxes | array | Collection of Taxes |
total | number | Total |
balance | number | Balance owed |
ship_to | object | Shipping Detail object |
payment_plan | integer | Payment plan ID |
url | string | URL to view the invoice in the billing portal |
payment_url | string | URL for the invoice payment page |
pdf_url | string | URL to download the invoice as a PDF |
created_at | timestamp | Timestamp when created |
updated_at | timestamp | Timestamp when updated |
metadata | object | A hash of key/value pairs that can store additional information about this object. |
Line Item Object
Attributes
{
"amount": 10,
"catalog_item": "delivery",
"description": null,
"discountable": true,
"discounts": [],
"id": 8,
"metadata": [],
"name": "Delivery",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "service",
"unit_cost": 10,
"updated_at": 1616081811
}
Parameter | Type | Description |
---|---|---|
id | integer | The line item's unique ID |
object | string | Object type, line_item |
catalog_item | string | Optional ItemĀ ID. Fills the line item with the name and pricing of the Item. |
type | string | Optional line item type. Used to group line items by type in reporting |
name | string | Title |
description | string | Optional description |
quantity | number | Quantity |
unit_cost | number | Unit cost or rate |
amount | number | Computed from quantity x unit_cost |
discountable | boolean | Excludes amount from invoice discounts when false |
discounts | array | Line item Discounts |
taxable | boolean | Excludes amount from invoice taxes when false |
taxes | array | Line item Taxes |
plan | string | Plan ID, only present when type is plan |
metadata | object | A hash of key/value pairs that can store additional information about this object. |
Discount Object
Represents the application of a discount to an invoice or line item.
Attributes
{
"amount": 5,
"coupon": null,
"expires": null,
"id": 20553,
"object": "discount"
}
Parameter | Type | Description |
---|---|---|
id | integer | The discount's unique ID |
object | string | Object type, discount |
amount | number | Discount amount |
coupon | object | Coupon the discount was computed from, if any |
expires | timestamp | Time until discount expires, if any |
Tax Object
Represents the application of tax to an invoice or line item.
Attributes
{
"amount": 3.85,
"id": 20554,
"object": "tax",
"tax_rate": null,
"updated_at": 1616081811
}
Parameter | Type | Description |
---|---|---|
id | integer | The tax's unique ID |
object | string | Object type, tax |
amount | number | Tax amount |
tax_rate | object | Tax Rate the tax was computed from, if any |
Shipping Details Object
Represents the Shipping details of an invoice.
Attributes
{
"address1": "2548 Bottom Lane",
"address2": null,
"attention_to": null,
"city": "Monument Beach",
"country": "US",
"name": "Myron Williams",
"postal_code": "02553",
"state": "MA",
"updated_at": 1616081811
}
Parameter | Type | Description |
---|---|---|
name | string | Ship to name |
attention_to | string | Used for ATTN: address line |
address1 | string | First address line |
address2 | string | Optional second address line |
city | string | City |
state | string | State or province |
postal_code | string | Zip or postal code |
country | string | Two-letter ISO code |
Create an invoice
curl "https://api.invoiced.com/invoices" \
-u {API_KEY}: \
-d customer=15444 \
-d payment_terms="NET 14" \
-d items[0][name]="Copy paper, Case" \
-d items[0][quantity]=1 \
-d items[0][unit_cost]=45 \
-d items[1][catalog_item]="delivery" \
-d items[1][quantity]=1 \
-d taxes[0][amount]=3.85
invoiced.Invoice.create(
:customer => 15444,
:payment_terms => "NET 14",
:items => [
{
:name => "Copy paper, Case",
:quantity => 1,
:unit_cost => 45
},
{
:catalog_item => "delivery",
:quantity => 1
}
],
:taxes => [
{
:amount => 3.85
}
]
)
<?php
$invoice = $invoiced->Invoice->create([
'customer' => 15444,
'payment_terms' => "NET 14",
'items' => [
[
'name' => "Copy paper, Case",
'quantity' => 1,
'unit_cost' => 45
],
[
'catalog_item' => "delivery",
'quantity' => 1
]
],
'taxes' => [
[
'amount' => 3.85
]
]
]);
client.Invoice.create(
customer=15444,
payment_terms="NET 14",
items=[
{
'name': "Copy paper, Case",
'quantity': 1,
'unit_cost': 45
},
{
'catalog_item': "delivery",
'quantity': 1
}
],
taxes=[
{
'amount': 3.85
}
]
)
Invoice invoice = invoiced.newInvoice();
invoice.customer = 15444L;
invoice.paymentTerms = "NET 14";
LineItem[] items = new LineItem[2];
items[0] = new LineItem();
items[0].name = "Copy paper, Case";
items[0].quantity = 1D;
items[0].unitCost = 45D;
items[1] = new LineItem();
items[1].item = "delivery";
items[1].quantity = 1D;
Tax[] taxes = new Tax[1];
taxes[0] = new Tax();
taxes[0].amount = 3.85D;
invoice.items = items;
invoice.taxes = taxes;
invoice.create();
var invoice = invoiced.NewInvoice();
invoice.Customer = 15444;
invoice.PaymentTerms = "NET 14";
var items = new LineItem[2];
items[0] = new LineItem();
items[0].Name = "Copy paper, Case";
items[0].Quantity = 1;
items[0].UnitCost = 45;
items[1] = new LineItem();
items[1].Item = "delivery";
items[1].Quantity = 1;
var taxes = new Tax[1];
taxes[0] = new Tax();
taxes[0].Amount = 3.85;
invoice.Items = items;
invoice.Taxes = taxes;
invoice.Create();
invoice, err := invoice.Create(&invoiced.InvoiceRequest{
Customer: invoiced.Int64(15444),
PaymentTerms: invoiced.String("NET 14"),
Items: []*invoiced.LineItemRequest{
{
Name: invoiced.String("Copy paper, Case"),
Quantity: invoiced.Float64(1),
UnitCost: invoiced.Float64(45),
},
{
Item: invoiced.String("delivery"),
Quantity: invoiced.Float64(1),
},
},
Taxes: []*invoiced.TaxRequest{
{
Amount: invoiced.Float64(3.85),
},
},
})
The above command returns JSON structured like this:
{
"attempt_count": 0,
"autopay": false,
"balance": 51.15,
"closed": false,
"created_at": 1415229884,
"currency": "usd",
"customer": 15444,
"date": 1416290400,
"discounts": [],
"draft": false,
"due_date": 1417500000,
"id": 46225,
"items": [
{
"amount": 45,
"catalog_item": null,
"description": null,
"discountable": true,
"discounts": [],
"id": 7,
"metadata": [],
"name": "Copy Paper, Case",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "product",
"unit_cost": 45
},
{
"amount": 10,
"catalog_item": "delivery",
"description": null,
"discountable": true,
"discounts": [],
"id": 8,
"metadata": [],
"name": "Delivery",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "service",
"unit_cost": 10
}
],
"metadata": [],
"name": null,
"next_payment_attempt": null,
"notes": null,
"number": "INV-0016",
"object": "invoice",
"paid": false,
"payment_plan": null,
"payment_terms": "NET 14",
"payment_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/payment",
"pdf_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/pdf",
"purchase_order": null,
"ship_to": null,
"status": "not_sent",
"subscription": null,
"subtotal": 55,
"taxes": [
{
"amount": 3.85,
"id": 20554,
"object": "tax",
"tax_rate": null
}
],
"total": 51.15,
"updated_at": 1415229884,
"url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY"
}
Create a new invoice with this endpoint.
HTTP Request
POST /invoices
Attributes
Parameter | Type | Description |
---|---|---|
customer | integer | Customer ID - required |
name | string | Invoice name for internal use, defaults to "Invoice" |
number | string | The reference number assigned to the invoice, defaults to next # in auto-numbering sequence |
currency | string | 3-letter ISO code - defaults to account currency |
autopay | boolean | AutoPay enabled? - inherited from customer by default |
payment_terms | string | Payment terms for the invoice, i.e. "NET 30" - inherited from customer by default |
purchase_order | string | The customer's purchase order number |
date | timestamp | Invoice date - defaults to current timestamp |
due_date | timestamp | Due date - computed from payment_terms when not supplied |
draft | boolean | When false, the invoice is considered outstanding, or when true, the invoice is a draft |
closed | boolean | Marks an invoice as closed |
items | array | Collection of Line Items |
notes | string | Additional notes displayed on invoice |
discounts | array | Collection of Discounts |
taxes | array | Collection of Taxes |
ship_to | object | Shipping Detail object |
metadata | object | A hash of key/value pairs that can store additional information about this object. |
attachments | array | A list of File IDs to attach to the invoice. |
disabled_payment_methods | array | List of payment methods to disable for this invoice, i.e. ["credit_card", "wire_transfer"] . |
calculate_taxes | bool | Disables tax calculation, default is true |
Retrieve an invoice
curl "https://api.invoiced.com/invoices/:id" \
-u {API_KEY}:
invoice = invoiced.Invoice.retrieve("{INVOICE_ID}")
<?php
$invoice = $invoiced->Invoice->retrieve("{INVOICE_ID}");
invoice = client.Invoice.retrieve("{INVOICE_ID}")
Invoice invoice = invoiced.newInvoice().retrieve({INVOICE_ID});
var invoice = invoiced.NewInvoice().Retrieve({INVOICE_ID});
invoice, err := client.Invoice.Retrieve({INVOICE_ID})
The above command returns JSON structured like this:
{
"attempt_count": 0,
"autopay": false,
"balance": 51.15,
"closed": false,
"created_at": 1415229884,
"currency": "usd",
"customer": 15444,
"date": 1416290400,
"discounts": [],
"draft": false,
"due_date": 1417500000,
"id": 46225,
"items": [
{
"amount": 45,
"catalog_item": null,
"description": null,
"discountable": true,
"discounts": [],
"id": 7,
"metadata": [],
"name": "Copy Paper, Case",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "product",
"unit_cost": 45
},
{
"amount": 10,
"catalog_item": "delivery",
"description": null,
"discountable": true,
"discounts": [],
"id": 8,
"metadata": [],
"name": "Delivery",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "service",
"unit_cost": 10
}
],
"metadata": [],
"name": null,
"next_payment_attempt": null,
"notes": null,
"number": "INV-0016",
"object": "invoice",
"paid": false,
"payment_plan": null,
"payment_terms": "NET 14",
"payment_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/payment",
"pdf_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/pdf",
"purchase_order": null,
"ship_to": null,
"status": "not_sent",
"subscription": null,
"subtotal": 55,
"taxes": [
{
"amount": 3.85,
"id": 20554,
"object": "tax",
"tax_rate": null
}
],
"total": 51.15,
"updated_at": 1415229884,
"url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY"
}
This endpoint retrieves a specific invoice.
HTTP Request
GET /invoices/:id
If you set the Accept
header to application/pdf
then the invoice PDF will be returned.
Query Parameters
Parameter | Type | Description |
---|---|---|
expand | string | Properties to expand |
Update an invoice
curl "https://api.invoiced.com/invoices/:id" \
-u {API_KEY}: \
-X PATCH \
-d sent=1
invoice.name = "July Paper Delivery"
invoice.notes = "The order was delivered on Jul 20, 2015"
invoice.sent = true
invoice.save
<?php
$invoice->name = "July Paper Delivery";
$invoice->notes = "The order was delivered on Jul 20, 2015";
$invoice->sent = true;
$invoice->save();
invoice.name = "July Paper Delivery"
invoice.notes = "The order was delivered on Jul 20, 2015"
invoice.sent = True
invoice.save()
invoice.name = "July Paper Delivery";
invoice.notes = "The order was delivered on Jul 20, 2015";
invoice.sent = true;
invoice.save();
invoice.Name = "July Paper Delivery";
invoice.Notes = "The order was delivered on Jul 20, 2015";
invoice.Sent = true;
invoice.SaveAll();
invoice, err := invoice.Update({INVOICE_ID}, &invoiced.InvoiceRequest{
Name: invoiced.String("July Paper Delivery"),
Notes: invoiced.String("The order was delivered on Jul 20, 2015"),
Sent: invoiced.Bool(true),
})
The above command returns JSON structured like this:
{
"attempt_count": 0,
"autopay": false,
"balance": 51.15,
"closed": false,
"created_at": 1415229884,
"currency": "usd",
"customer": 15444,
"date": 1416290400,
"discounts": [],
"draft": false,
"due_date": 1417500000,
"id": 46225,
"items": [
{
"amount": 45,
"catalog_item": null,
"description": null,
"discountable": true,
"discounts": [],
"id": 7,
"metadata": [],
"name": "Copy Paper, Case",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "product",
"unit_cost": 45
},
{
"amount": 10,
"catalog_item": "delivery",
"description": null,
"discountable": true,
"discounts": [],
"id": 8,
"metadata": [],
"name": "Delivery",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "service",
"unit_cost": 10
}
],
"metadata": [],
"name": "July Paper Delivery",
"next_payment_attempt": null,
"notes": "The order was delivered on Jul 20, 2015",
"number": "INV-0016",
"object": "invoice",
"paid": false,
"payment_plan": null,
"payment_terms": "NET 14",
"payment_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/payment",
"pdf_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/pdf",
"purchase_order": null,
"ship_to": null,
"status": "sent",
"subscription": null,
"subtotal": 55,
"taxes": [
{
"amount": 3.85,
"id": 20554,
"object": "tax",
"tax_rate": null
}
],
"total": 51.15,
"updated_at": 1415229884,
"url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY"
}
Use this endpoint to update an invoice.
HTTP Request
PATCH /invoices/:id
Attributes
Parameter | Type | Description |
---|---|---|
name | string | Invoice name for internal use, defaults to "Invoice" |
number | string | The reference number assigned to the invoice, defaults to next # in auto-numbering sequence |
currency | string | 3-letter ISO code - defaults to account currency |
date | timestamp | Invoice date - defaults to current timestamp |
due_date | timestamp | Due date - computed from payment_terms when not supplied |
payment_terms | string | Payment terms for the invoice, i.e. "NET 30" - inherited from customer by default |
purchase_order | string | The customer's purchase order number |
draft | boolean | When false, the invoice is considered outstanding, or when true, the invoice is a draft |
sent | boolean | Marks an invoice as sent |
closed | boolean | Marks an invoice as closed |
items | array | Collection of Line Items |
notes | string | Additional notes displayed on invoice |
discounts | array | Collection of Discounts |
taxes | array | Collection of Taxes |
ship_to | object | Shipping Detail object |
metadata | object | A hash of key/value pairs that can store additional information about this object. |
attachments | array | A list of File IDs to attach to the invoice. Replaces existing attachments. Not providing this keeps existing attachments. |
disabled_payment_methods | array | List of payment methods to disable for this invoice, i.e. ["credit_card", "wire_transfer"] . |
calculate_taxes | bool | Recalculate taxes, default is false |
Send an invoice email
curl "https://api.invoiced.com/invoices/:id/emails" \
-u {API_KEY}: \
-X POST
emails = invoice.send
<?php
$emails = $invoice->send();
emails = invoice.send()
EmailRequest emailRequest = new EmailRequest();
EmailRecipient[] emailRecipients = new EmailRecipient[1];
emailRecipients[0] = new EmailRecipient();
emailRecipients[0].name = "Client";
emailRecipients[0].email = "client@example.com";
emailRequest.to = emailRecipients;
emailRequest.subject = "New Invoice from Dunder Mifflin, Inc.: INV-0016";
emailRequest.message = "Dear Client, a new invoice for $51.15 has been created on your account. [View and Pay Invoice button] Thank you!";
Email[] emails = invoice.send(emailRequest);
var emailRequest = new EmailRequest();
var emailRecipients = new EmailRecipient[1];
emailRecipients[0] = new EmailRecipient();
emailRecipients[0].Name = "Client";
emailRecipients[0].Email = "client@example.com";
emailRequest.To = emailRecipients;
emailRequest.Subject = "New Invoice from Dunder Mifflin, Inc.: INV-0016";
emailRequest.Message = "Dear Client, a new invoice for $51.15 has been created on your account. [View and Pay Invoice button] Thank you!";
var emails = invoice.SendEmail(emailRequest);
err := client.Invoice.SendEmail({INVOICE_ID}, &invoiced.SendEmailRequest{
To: []*invoiced.EmailRecipient{
Name: invoiced.String("Client"),
Email: "client@example.com",
},
Subject: invoiced.String("New Invoice from Dunder Mifflin, Inc.: INV-0016"),
Message: invoiced.String("Dear Client, a new invoice for $51.15 has been created on your account. [View and Pay Invoice button] Thank you!"),
})
The above command returns JSON structured like this:
[
{
"created_at": 1436890047,
"email": "client@example.com",
"id": "f45382c6fbc44d44aa7f9a55eb2ce731",
"message": "Dear Client, a new invoice for $51.15 has been created on your account. [View and Pay Invoice button] Thank you!",
"object": "email",
"opens": 0,
"opens_detail": [],
"reject_reason": null,
"state": "sent",
"subject": "New Invoice from Dunder Mifflin, Inc.: INV-0016",
"template": "new_invoice_email",
"updated_at": 1436890047
}
]
This endpoint sends an invoice to your customer.
HTTP Request
POST /invoices/:id/emails
Request Parameters
Parameter | Type | Description |
---|---|---|
to | array | Optional array of recipients like:[{"name": "Client", "email": "client@example.com"}] |
bcc | string | Optional comma-separated list of email addresses to be blind carbon copied |
template | string | Optional email template ID, otherwise a standard email template is selected |
subject | string | Optional subject to override the template |
message | string | Optional message body to override the template |
Send an invoice SMS
curl "https://api.invoiced.com/invoices/:id/text_messages" \
-u {API_KEY}: \
-d to[0][phone]="11234567890" \
-d to[0][name]="Bob Loblaw" \
-d message="{% verbatim %}{{company_name}}: You have a new invoice {{invoice_number}} {{url}}" \
-X POST
text_messages = invoice.send_text(
:to => [{"phone" => "11234567890", "name" => "Bob Loblaw"}],
:message => "{{company_name}}: You have a new invoice {{invoice_number}} {{url}}")
<?php
$textMessages = $invoice->sendText([
'to' => [['phone' => "11234567890", 'name' => "Bob Loblaw"]],
'message' => "{{company_name}}: You have a new invoice {{invoice_number}} {{url}}"]);
text_messages = invoice.send_text(
type="open_item",
to=[{"phone": "11234567890", "name": "Bob Loblaw"}],
message="{{company_name}}: You have a new invoice {{invoice_number}} {{url}}")
TextRequest textRequest = new TextRequest();
TextRecipient recipient = new TextRecipient();
recipient.name = "Bob Loblaw";
recipient.phone = "11234567890";
textRequest.to = new TextRecipient[]{recipient};
textRequest.message = "{{company_name}}: You have a new invoice {{invoice_number}} {{url}}";
TextMessage[] textMessages = invoice.sendText(textRequest);
var textRequest = new TextRequest();
var recipient = new TextRecipient();
recipient.Name = "Bob Loblaw";
recipient.Phone = "11234567890";
textRequest.To = new TextRecipient[]{recipient};
textRequest.Message = "{{company_name}}: You have a new invoice {{invoice_number}} {{url}}";
var textMessages = invoice.SendText(textRequest);
textRequest.To = textRecipients
textRequest.
texts, err := client.Invoice.SendText({INVOICE_ID}, &invoiced.SendTextMessageRequest{
To: []*invoiced.TextMessageRecipient{
Name: invoiced.String("Bob Loblaw"),
Phone: invoiced.String("11234567890"),
},
Message: invoiced.String("{{company_name}}: You have a new invoice {{invoice_number}} {{url}}"),
})
The above command returns JSON structured like this:
[
{
"created_at": 1571086718,
"id": "f96fc863e58300167a252af8eeef158b",
"message": "Acme Inc.: You have a new invoice https://acme.invoiced.com/invoices/5fTsO6LPXVNNmpuViVy4VQOg",
"state": "sent",
"to": "+15125551212",
"updated_at": 1571086718
}
]
This endpoint sends an invoice by SMS to a customer using Twilio. Twilio must be connected to Invoiced for requests to succeed.
Text messages can only be sent to customer contacts marked as sms_enabled
.
HTTP Request
POST /invoices/:id/text_messages
Request Parameters
Parameter | Type | Description |
---|---|---|
message | string | Full text of message |
to | array | Array of recipients like:[{"phone": "11234567890", "name": "Bob Loblaw"}] |
Send an invoice letter
curl "https://api.invoiced.com/invoices/:id/letters" \
-u {API_KEY}: \
-X POST
letters = invoice.send_letter
<?php
$letters = $invoice->sendLetter();
letters = invoice.send_letter()
LetterRequest letterRequest = new LetterRequest();
Letter letters = invoice.sendLetter(letterRequest);
var letterRequest = new LetterRequest();
var letter = invoice.SendLetter(letterRequest);
letter, err := client.Invoice.SendLetter({INVOICE_ID})
The above command returns JSON structured like this:
{
"created_at": 1571070112,
"expected_delivery_date": 1571674912,
"id": "995503c4fc2c853b23de3023e84bba72",
"num_pages": 1,
"state": "queued",
"to": "Acme Inc.\n5301 Southwest Pkwy\nAustin, TX 78735",
"updated_at": 1571070112
}
This endpoint sends an invoice by mail to a customer using Lob. Lob must be connected to Invoiced for requests to succeed.
There are no request parameters; the letter will automatically be sent to the customer's billing address.
HTTP Request
POST /invoices/:id/letters
Pay an invoice
curl "https://api.invoiced.com/invoices/:id/pay" \
-u {API_KEY}: \
-X POST
invoice.pay
<?php
$invoice->pay();
invoice.pay()
invoice.pay();
invoice.Pay();
err := client.Invoice.Pay({INVOICE_ID})
The above command returns JSON structured like this:
{
"attempt_count": 1,
"autopay": true,
"balance": 228.85,
"closed": false,
"created_at": 1415229885,
"currency": "usd",
"customer": 15446,
"date": 1416290402,
"discounts": [],
"draft": false,
"due_date": null,
"id": 46226,
"items": [
{
"amount": 225,
"catalog_item": null,
"description": null,
"discountable": true,
"discounts": [],
"id": 9,
"metadata": [],
"name": "Copy Paper, Case",
"object": "line_item",
"quantity": 5,
"taxable": true,
"taxes": [],
"type": "product",
"unit_cost": 45
}
],
"metadata": [],
"name": null,
"next_payment_attempt": null,
"notes": null,
"number": "INV-0017",
"object": "invoice",
"paid": true,
"payment_plan": null,
"payment_terms": "AutoPay",
"payment_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfDasdfGPBmyd6FwXZ/payment",
"pdf_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfDasdfGPBmyd6FwXZ/pdf",
"purchase_order": null,
"ship_to": null,
"status": "paid",
"subscription": null,
"subtotal": 225,
"taxes": [
{
"amount": 3.85,
"id": 20554,
"object": "tax",
"tax_rate": null
}
],
"total": 228.85,
"updated_at": 1415229885,
"url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfDasdfGPBmyd6FwXZ"
}
When an invoice is automatically collected we will perform the charge automatically. If a payment attempts fails then another attempt will be scheduled according to your retry settings. Or, you can trigger a charge attempt manually using this endpoint.
HTTP Request
POST /invoices/:id/pay
List invoice attachments
curl "https://api.invoiced.com/invoices/:id/attachments" \
-u {API_KEY}:
attachments, metadata = invoice.attachments
<?php
list($attachments, $metadata) = $invoice->attachments();
attachments, metadata = invoice.attachments()
Attachment[] attachments = invoice.listAttachments();
var attachments = invoice.ListAttachments();
files, err := client.Invoice.ListAttachments({INVOICE_ID})
The above command returns JSON structured like this:
[
{
"created_at": 1464625855,
"file": {
"created_at": 1464625854,
"id": 13,
"name": "logo-invoice.png",
"object": "file",
"size": 6936,
"type": "image/png",
"updated_at": 1464625854,
"url": "https://invoiced.com/img/logo-invoice.png"
},
"id": 13,
"object": "attachment",
"updated_at": 1464625855
}
]
This endpoint retrieves a list of files attached to a specific invoice.
HTTP Request
GET /invoices/:id/attachments
Create a consolidated invoice
curl "https://api.invoiced.com/customers/:id/consolidate_invoices" \
-u {API_KEY}: \
customer.consolidate_invoices
<?php
$customer->consolidateInvoices();
customer.consolidate_invoices()
customer.consolidateInvoices();
customer.ConsolidateInvoices();
invoice, err := client.Customer.ConsolidateInvoices({CUSTOMER_ID})
The above command returns JSON structured like this:
{
"attempt_count": 0,
"autopay": false,
"balance": 51.15,
"closed": false,
"created_at": 1415229884,
"currency": "usd",
"customer": 15444,
"date": 1416290400,
"discounts": [],
"draft": false,
"due_date": 1417500000,
"id": 46225,
"items": [
{
"amount": 45,
"catalog_item": null,
"description": null,
"discountable": true,
"discounts": [],
"id": 7,
"metadata": [],
"name": "Copy Paper, Case",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "product",
"unit_cost": 45
},
{
"amount": 10,
"catalog_item": "delivery",
"description": null,
"discountable": true,
"discounts": [],
"id": 8,
"metadata": [],
"name": "Delivery",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "service",
"unit_cost": 10
}
],
"metadata": [],
"name": "Consolidated Invoice",
"next_payment_attempt": null,
"notes": null,
"number": "INV-0017",
"object": "invoice",
"paid": false,
"payment_plan": null,
"payment_terms": "NET 14",
"payment_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/payment",
"pdf_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/pdf",
"purchase_order": null,
"ship_to": null,
"status": "not_sent",
"subscription": null,
"subtotal": 55,
"taxes": [
{
"amount": 3.85,
"id": 20554,
"object": "tax",
"tax_rate": null
}
],
"total": 51.15,
"updated_at": 1415229884,
"url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY"
}
Consolidate all of a customer's open invoices to a single invoice with this endpoint.
Requests will fail if there are no invoices to consolidate, or if the customer does not have consolidation enabled.
HTTP Request
POST /customers/:id/consolidate_invoices
Attributes
Parameter | Type | Description |
---|---|---|
cutoff_date | timestamp | Optional cutoff date |
Void an invoice
curl "https://api.invoiced.com/invoices/:id/void" \
-u {API_KEY}: \
invoice.void
<?php
$invoice->void();
invoice.void()
invoice.voidInvoice();
invoice.Void();
invoice, err := client.Invoice.Void({INVOICE_ID})
The above command returns JSON structured like this:
{
"attempt_count": 0,
"autopay": false,
"balance": 51.15,
"closed": false,
"created_at": 1415229884,
"currency": "usd",
"customer": 15444,
"date": 1416290400,
"discounts": [],
"draft": false,
"due_date": 1417500000,
"id": 46225,
"items": [
{
"amount": 45,
"catalog_item": null,
"description": null,
"discountable": true,
"discounts": [],
"id": 7,
"metadata": [],
"name": "Copy Paper, Case",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "product",
"unit_cost": 45
},
{
"amount": 10,
"catalog_item": "delivery",
"description": null,
"discountable": true,
"discounts": [],
"id": 8,
"metadata": [],
"name": "Delivery",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "service",
"unit_cost": 10
}
],
"metadata": [],
"name": "July Paper Delivery",
"next_payment_attempt": null,
"notes": "The order was delivered on Jul 20, 2015",
"number": "INV-0016",
"object": "invoice",
"paid": false,
"payment_plan": null,
"payment_terms": "NET 14",
"payment_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/payment",
"pdf_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/pdf",
"purchase_order": null,
"ship_to": null,
"status": "voided",
"subscription": null,
"subtotal": 55,
"taxes": [
{
"amount": 3.85,
"id": 20554,
"object": "tax",
"tax_rate": null
}
],
"total": 51.15,
"updated_at": 1415229884,
"url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY"
}
Use this endpoint to void an invoice.
HTTP Request
POST /invoices/:id/void
Delete an invoice
curl "https://api.invoiced.com/invoices/:id" \
-u {API_KEY}: \
-X DELETE
invoice.delete
<?php
$invoice->delete();
invoice.delete()
invoice.delete();
invoice.Delete();
err := client.Invoice.Delete({INVOICE_ID})
The above command returns
204 No Content
This endpoint deletes a specific invoice.
HTTP Request
DELETE /invoices/:id
List all invoices
curl "https://api.invoiced.com/invoices" \
-u {API_KEY}:
invoices, metadata = invoiced.Invoice.list(:per_page => 3)
<?php
list($invoices, $metadata) = $invoiced->Invoice->all(['per_page' => 3]);
invoices, metadata = client.Invoice.list(per_page=3)
EntityList<Invoice> invoices = conn.newInvoice().listAll();
var invoices = invoiced.NewInvoice().ListAll();
invoices, err := client.Invoice.ListAll(nil, nil)
The above command returns JSON structured like this:
[
{
"attempt_count": 0,
"autopay": false,
"balance": 51.15,
"closed": false,
"created_at": 1415229884,
"currency": "usd",
"customer": 15444,
"date": 1416290400,
"discounts": [],
"draft": false,
"due_date": 1417500000,
"id": 46225,
"items": [
{
"amount": 45,
"catalog_item": null,
"description": null,
"discountable": true,
"discounts": [],
"id": 7,
"metadata": [],
"name": "Copy Paper, Case",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "product",
"unit_cost": 45
},
{
"amount": 10,
"catalog_item": "delivery",
"description": null,
"discountable": true,
"discounts": [],
"id": 8,
"metadata": [],
"name": "Delivery",
"object": "line_item",
"quantity": 1,
"taxable": true,
"taxes": [],
"type": "service",
"unit_cost": 10
}
],
"metadata": [],
"name": null,
"next_payment_attempt": null,
"notes": null,
"number": "INV-0016",
"object": "invoice",
"paid": false,
"payment_plan": null,
"payment_terms": "NET 14",
"payment_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/payment",
"pdf_url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY/pdf",
"purchase_order": null,
"ship_to": null,
"status": "not_sent",
"subscription": null,
"subtotal": 55,
"taxes": [
{
"amount": 3.85,
"id": 20554,
"object": "tax",
"tax_rate": null
}
],
"total": 51.15,
"updated_at": 1415229884,
"url": "https://dundermifflin.invoiced.com/invoices/IZmXbVOPyvfD3GPBmyd6FwXY"
}
]
This endpoint retrieves all invoices.
HTTP Request
GET /invoices
Query Parameters
Parameter | Description |
---|---|
sort string | Column to sort by, i.e. name asc |
filter object | Filter object |
metadata object | Metadata filter object |
start_date timestamp | Restricts the results to invoices on or after the given timestamp |
end_date timestamp | Restricts the results to invoices on or before the given timestamp |
updated_after timestamp | Only gets records updated after the given timestamp |