Pike13 For Developers
Get Started
Authentication
Core API
Reporting API
Webhooks API
Announcements

Webhooks API Documentation

Invoice

Core API resource payload url:

Desk

GET /api/v2/desk/invoices/:id

See the core api doc

Resource Attributes

data.invoices[0]
idintegerThe ID of the invoice.
invoice_numberstringA unique bill identifier for this business, a.k.a. bill number.
invoice_datestringThis invoice's due date.
total_centsintegerThe amount total in cents for this invoice.
totalstringThe amount total in localized currency for this invoice.
outstanding_amount_centsintegerThe amount outstanding in cents.
outstanding_amountstringThe amount outstanding in localized currency.
discount_total_centsintegerThe sum of all discounts in cents.
discount_totalstringThe sum of all discounts in localized currency.
adjustment_total_centsintegerThe sum of all adjustments in cents.
adjustment_totalstringThe sum of all adjustments in localized currency.
included_tax_total_centsintegerThe sum of all included taxes in cents.
included_tax_totalstringThe sum of all included taxes in localized currency.
additional_tax_total_centsintegerThe sum of all additional taxes in cents.
additional_tax_totalstringThe sum of all additional taxes in localized currency.
currencystringThe currency ISO code.
statestringThe current state of the invoice. Either 'open', 'closed', 'canceled', 'cart', 'cart_hidden', or 'on_hold.'
state_eventsarrayAn array of strings containing the valid state events when calling to update the invoice.
invoice_itemsobject

Information regarding the item the invoice is about

idintegerThe ID of the item the invoice is for.
namestringThe name of the item the invoice is for.
descriptionstringThe full description of the item the invoice is for.
recipientsarray

Array of people who received this item.

idintegerThe ID of the person who the invoice is for.
namestringThe full name of the person who the invoice is for.
emailstringThe email address of the person who the invoice is for.
adjustmentsarray

Array of adjustments to the invoice item, documenting changes in the item within this invoice.

idintegerThe ID of the adjustment.
typestringPossible values include: 'Adjustment' for the price, 'CreditAdjustment' for credit, 'Discount' for discounts, 'PriceOverride' for overrides on the price, 'ProrateAdjustment' for proration, and 'TaxAdjustment' for taxes.
namestringThe name for the adjustment.
created_atstringThe date the adjustment was created.
amount_centsintegerEither the amount of the fixed price discount or the computed amount of the percent discount in cents.
amountintegerEither the amount of the fixed price discount or the computed amount of the percent discount in localized currency.
percentintegerOptional. The percentage, if it is a percent adjustment. This can be negative for TaxAdjustments.
sourceobject

Optional. The source of the invoice item adjustment

idintegerThe ID of the source.
typestringThe type of the source.
detailobject

Details regarding the item the invoice is for

idintegerThe ID the of details for the item.
typestringThe object type of the item, i.e 'Membership', 'SignupFee'.
start_datestringOptional. The start date of the item.
count_descriptionstringOptional. How often the item is used.
extended_descriptionarrayOptional. The extended description of the item.
initial_punchcard_count_descriptionstringOptional. How many punches the card starts with.
has_termsbooleanOptional. True if the item has terms.
plan_product_idintegerOptional. The ID for the product plan.
product_idintegerOptional. The ID for the product.
retail_product_idintegerOptional. The ID for the retail product.
serviceobject

Optional. The service the item falls under

idintegerThe ID of the service
paymentsarray

The payments that have already been made on the invoice

idintegerThe ID of the payment.
descriptionstringThe description of the payment.
statestringThe state of the payment.
amount_centsintegerThe amount in cents of the payment.
amountstringThe amount in localized currency of the payment.
maximum_refund_centsintegerThe maximum amount refundable in cents of the payment.
maximum_refundstringThe maximum amount refundable in localized currency of the payment.
created_atstringThe date the payment was created.
voided_atstringThe date the payment was voided.
error_messagestringOptional. The error message for the payment if it failed.
refundsobject

Optional. The refunds for the payments

idintegerThe ID of the refund.
amount_centsintegerThe amount in cents of the refund.
amountstringThe amount in localized currency of the refund.
statestringThe state of the refund.
payment_idintThe ID of the payment the refund is for.
descriptionstringThe description of the refund.
created_atstringThe date the refund was created.
voided_atstringThe date the refund was voided.
payerobject

Optional. The person who paid the payment

idintegerThe ID of the person who the invoice is for.
namestringThe full name of the person who the invoice is for.
emailstringThe email address of the person who the invoice is for.
personobject

Optional. Information regarding the person who the invoice is for

idintegerThe ID of the person attached to this invoice.
namestringThe name of the person attached to this invoice.
emailstringThe email of the person attached to this invoice.
couponobject

Optional. Information regarding a coupon for the invoice, if there is any

idintegerThe ID of the promotion.
codestringThe code for the promotion.
namestringThe name of the promotion.
descriptionstringThe description of the promotion.
discount_percentintegerOptional. The discount percent of the promotion, as applied on this invoice.
discount_amount_centsintegerOptional. The fixed amount discount in cents of the promotion, as applied on this invoice.
discount_amountintegerOptional. The fixed amount discount in localized currency of the promotion.
redeemedbooleanTrue when the coupon was redeemed on this invoice. False when a renewal carries the coupon's discount over from an earlier invoice.
editedbooleanTrue when staff changed the discount's value on this invoice from the coupon's. The discount_percent or discount_amount_cents then holds their value.
durationstringHow the coupon discounts a recurring plan, as applied on this invoice. Later edits to the coupon do not change it: 'first_payment' for the first payment only, 'limited' for a set number of payments (see duration_cycles), 'until_date' for every payment due through a date (see discount_ends_on), or 'all_payments' for every recurring payment while on an eligible plan. With 'all_payments', the plan keeps the discount after the coupon ends.
duration_cyclesintegerOptional. Only when duration is 'limited': the payments the coupon still discounts, counting this invoice. On the invoice the coupon was redeemed on, that is the total number of payments; on each renewal it is the payments left. The coupon resource's duration_cycles is always the total number of payments.
discount_ends_onstringOptional. Only when duration is 'until_date': the last payment date the coupon discounts, as YYYY-MM-DD.
previousobject

Optional. If this an UPDATE payload - additional information about the changed attributes

variesobjectVarious details about the changed attributes of the invoice.

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

Invoice New Webhook Payload

{
  "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.
statestringPossible values: open, closed, cancelled, cart, cart_hidden, on_hold
personpersonThe assigned person { id, name, email }
receipt_emailstringemail@example.com
locationobject{ id, name, slug }
commission_recipientperson{ id, name, email }
tip_recipientperson{ id, name, email }

Previous values supported by the "invoice.updated" topic
statestringPossible values: open, closed, cancelled, cart, cart_hidden, on_hold
personpersonThe assigned person { id, name, email }
receipt_emailstringemail@example.com
locationobject{ id, name, slug }
commission_recipientperson{ id, name, email }
tip_recipientperson{ 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"
    }
  }
}