Webhooks API Documentation
Invoice
Core API resource payload url:
Resource Attributes
| data.invoices[0] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | integer | The ID of the invoice. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| invoice_number | string | A unique bill identifier for this business, a.k.a. bill number. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| invoice_date | string | This invoice's due date. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| total_cents | integer | The amount total in cents for this invoice. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| total | string | The amount total in localized currency for this invoice. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outstanding_amount_cents | integer | The amount outstanding in cents. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outstanding_amount | string | The amount outstanding in localized currency. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| discount_total_cents | integer | The sum of all discounts in cents. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| discount_total | string | The sum of all discounts in localized currency. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| adjustment_total_cents | integer | The sum of all adjustments in cents. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| adjustment_total | string | The sum of all adjustments in localized currency. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| included_tax_total_cents | integer | The sum of all included taxes in cents. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| included_tax_total | string | The sum of all included taxes in localized currency. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| additional_tax_total_cents | integer | The sum of all additional taxes in cents. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| additional_tax_total | string | The sum of all additional taxes in localized currency. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| currency | string | The currency ISO code. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state | string | The current state of the invoice. Either 'open', 'closed', 'canceled', 'cart', 'cart_hidden', or 'on_hold.' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state_events | array | An array of strings containing the valid state events when calling to update the invoice. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| invoice_items | object | Information regarding the item the invoice is about
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| payments | array | The payments that have already been made on the invoice
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| person | object | Optional. Information regarding the person who the invoice is for
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| coupon | object | Optional. Information regarding a coupon for the invoice, if there is any
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| previous | object | Optional. If this an UPDATE payload - additional information about the changed attributes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A Special Note about Invoice Topics
The webhook topic 'invoice.new' is suggested for most uses instead of 'invoice.created'.
The 'invoice.new' topic shields users from being exposed to some of the internal state changes that invoices go through during their lifecycle. For instance, a new invoice object is created every time a shopping cart is created - but most people aren't really interested in an invoice until it is in a billable or paid state.
invoice.new
The 'invoice.new' webhook topic is recommended as the best way to get invoices when they are created from an end user's perspective. It will trigger whenever an invoice is created or updated so long as the state the invoice is entering is NOT CART. The possible states for an invoice are: OPEN, CLOSED, CANCELLED, CART, CART_HIDDEN, ON_HOLD.
Payload Example
{
"topic": "invoice.new",
"webhook_id": 4,
"business_id": 1,
"data": {
"invoices": [
{
"id": 51,
"invoice_number": "100059",
"invoice_date": "2018-12-12",
"total_cents": 11200,
"total": "112.00",
"outstanding_amount_cents": 0,
"outstanding_amount": "0.00",
"discount_total_cents": 0,
"discount_total": "0.00",
"adjustment_total_cents": -1200,
"adjustment_total": "-12.00",
"included_tax_total_cents": 0,
"included_tax_total": "0.00",
"additional_tax_total_cents": -200,
"additional_tax_total": "-2.00",
"state_events": [
"reopen"
],
"send_receipt": true,
"receipt_email": null,
"currency": "USD",
"state": "closed",
"has_tip": false,
"has_commission_pay": false,
"can_adjust_tip": false,
"invoice_items": [
{
"id": 19,
"name": "Class R",
"description": "Class R",
"discount_total_cents": 0,
"discount_total": "0.00",
"amount_cents": 10000,
"amount": "100.00",
"recipients": [
{
"name": "Apendaulla Dependable"
}
],
"adjustments": [
{
"id": 14,
"type": "TaxAdjustment",
"name": "Seattle",
"percent": -10,
"amount_cents": -1000,
"amount": "-10.00",
"source": {
"id": 1,
"type": "SalesTax"
},
"created_at": "2018-12-12T21:52:42Z"
},
{
"id": 15,
"type": "TaxAdjustment",
"name": "King County",
"percent": -2,
"amount_cents": -200,
"amount": "-2.00",
"source": {
"id": 2,
"type": "SalesTax"
},
"created_at": "2018-12-12T21:52:42Z"
}
],
"detail": {
"id": 20,
"type": "Pack",
"start_date": "2018-12-12",
"count_description": "1 visit per Week",
"extended_description": [
"Starts on Dec 12",
"for Apendaulla Dependable"
],
"has_terms": false,
"plan_product_id": 5,
"product_id": 5
},
"commissionable": false,
"compable": true
}
],
"payments": [
{
"id": 3,
"description": "Cash",
"state": "completed",
"amount_cents": 11200,
"amount": "112.00",
"maximum_refund_cents": 11200,
"maximum_refund": "112.00",
"created_at": "2018-12-12T21:53:17Z",
"voided_at": null,
"is_voidable": false
}
],
"location": {
"id": 1,
"name": "Raushire",
"slug": "raushire"
},
"created_by": {
"id": 1,
"name": "John Helpful",
"email": "john.helpful@pike13.com"
},
"person": {
"id": 56,
"name": "Apendaulla Dependable",
"email": null
}
}
]
}
}
invoice.created
The 'invoice.created' webhook topic is not recommended for most users. It triggers every time an internal invoice record is created. For example, if someone starts shopping you would get a notification even if the shopping cart is later abandoned and what we call an "invoice" is never actually created in a billable state. Instead we recommend you use the 'invoice.new' trigger.
Payload Example
Invoice Created Webhook Payload
{
"topic": "invoice.created",
"webhook_id": 4,
"business_id": 1,
"data": {
"invoices": [
{
"id": 58,
"invoice_number": "100045",
"invoice_date": "2012-09-03",
"total_cents": 0,
"total": "0.00",
"outstanding_amount_cents": 0,
"outstanding_amount": "0.00",
"discount_total_cents": 0,
"discount_total": "0.00",
"adjustment_total_cents": 0,
"adjustment_total": "0.00",
"included_tax_total_cents": 0,
"included_tax_total": "0.00",
"additional_tax_total_cents": 0,
"additional_tax_total": "0.00",
"state_events": [
"open",
"cancel",
"close"
],
"send_receipt": true,
"receipt_email": null,
"currency": "USD",
"state": "cart",
"has_tip": false,
"has_commission_pay": false,
"can_adjust_tip": false,
"invoice_items": [],
"payments": [],
"created_by": {
"id": 1,
"name": "Jane Doe",
"email": "jane.doe@example.com"
}
}
]
}
}
invoice.updated
| Changes to these fields trigger an "invoice.updated" notification. Payment changes are handled by the Transactions webhook topic. | ||
|---|---|---|
| state | string | Possible values: open, closed, cancelled, cart, cart_hidden, on_hold |
| person | person | The assigned person { id, name, email } |
| receipt_email | string | email@example.com |
| location | object | { id, name, slug } |
| commission_recipient | person | { id, name, email } |
| tip_recipient | person | { id, name, email } |
| Previous values supported by the "invoice.updated" topic | ||
|---|---|---|
| state | string | Possible values: open, closed, cancelled, cart, cart_hidden, on_hold |
| person | person | The assigned person { id, name, email } |
| receipt_email | string | email@example.com |
| location | object | { id, name, slug } |
| commission_recipient | person | { id, name, email } |
| tip_recipient | person | { id, name, email } |
Payload Example
Invoice Updated Webhook Payload
{
"topic": "invoice.updated",
"webhook_id": 3,
"business_id": 1,
"data": {
"invoices": [
{
"id": 58,
"invoice_number": "100045",
"invoice_date": "2012-09-03",
"total_cents": 1100,
"total": "11.00",
"outstanding_amount_cents": 0,
"outstanding_amount": "0.00",
"discount_total_cents": 0,
"discount_total": "0.00",
"adjustment_total_cents": -100,
"adjustment_total": "-1.00",
"included_tax_total_cents": 0,
"included_tax_total": "0.00",
"additional_tax_total_cents": -100,
"additional_tax_total": "-1.00",
"state_events": [
"reopen"
],
"send_receipt": false,
"receipt_email": null,
"currency": "USD",
"state": "closed",
"has_tip": false,
"has_commission_pay": false,
"can_adjust_tip": false,
"invoice_items": [
{
"id": 31,
"name": "t-shirt",
"description": "t-shirt - size medium",
"discount_total_cents": 0,
"discount_total": "0.00",
"amount_cents": 1000,
"amount": "10.00",
"recipients": [],
"adjustments": [
{
"id": 41,
"type": "TaxAdjustment",
"name": "Seattle",
"created_at": "2019-02-20T16:59:24Z",
"percent": -10.0,
"amount_cents": -100,
"amount": "-1.00",
"source": {
"id": 1,
"type": "SalesTax"
}
}
],
"detail": {
"id": 3,
"type": "Retail",
"extended_description": [
"size medium"
],
"has_terms": false,
"retail_product_id": 1
},
"commissionable": false,
"compable": true
}
],
"payments": [
{
"id": 9,
"description": "Cash",
"state": "completed",
"amount_cents": 1100,
"amount": "11.00",
"maximum_refund_cents": 1100,
"maximum_refund": "11.00",
"created_at": "2019-02-20T17:01:01Z",
"voided_at": null,
"is_voidable": true
}
],
"location": {
"id": 1,
"name": "Raushire",
"slug": "raushire"
},
"created_by": {
"id": 1,
"name": "Jane Doe",
"email": "jane.doe@example.com"
}
}
],
"previous": {
"state": "cart",
"updated_at": "2019-02-20T17:00:00Z"
}
}
}