Core API Documentation
Invoice
Represent an invoice, which consists of an order's details
Front
GET /api/v2/front/invoices/:id
Returns the details of the invoice. Only invoices owned by the authorized user making the request are available.
REQUEST
$ curl https://mybiz.pike13.com/api/v2/front/invoices/1?client_id=XXXXXXXXXXXXXX \
RESPONSE
{
"invoices": [
{
"id": 50,
"invoice_number": "10045",
"invoice_date": "2018-12-07",
"total_cents": 11200,
"total": "112.00",
"outstanding_amount_cents": 0,
"outstanding_amount": "0.00",
"currency": "USD",
"state": "closed",
"state_events": [],
"invoice_items": [
{
"id": 18,
"name": "Appointment A",
"description": "Appointment A",
"discount_total_cents": 0,
"discount_total": "0.00",
"amount_cents": 10000,
"amount": "100.00",
"recipients": [
{
"name": "John Doe"
}
],
"adjustments": [
{
"id": 12,
"type": "TaxAdjustment",
"name": "seattle",
"created_at": "2018-12-07T18:29:41Z",
"percent": -10,
"amount_cents": -1000,
"amount": "-10.00",
"source": {
"id": 1,
"type": "SalesTax"
}
},
{
"id": 13,
"type": "TaxAdjustment",
"name": "king county",
"created_at": "2018-12-07T18:29:41Z",
"percent": -2,
"amount_cents": -200,
"amount": "-2.00",
"source": {
"id": 2,
"type": "SalesTax"
}
}
],
"detail": {
"id": 19,
"type": "Pack",
"start_date": "2018-12-07",
"count_description": "1 visit per Week",
"extended_description": [
"Starts on Dec 7",
"for John Doe"
],
"has_terms": false,
"plan_product_id": 11,
"product_id": 11
}
}
],
"payments": [
{
"id": 2,
"description": "Cash",
"state": "completed",
"amount_cents": 11200,
"amount": "112.00",
"maximum_refund_cents": 11200,
"maximum_refund": "112.00",
"created_at": "2018-12-07T18:29:58Z",
"voided_at": null
}
],
"person": {
"id": 1,
"name": "John Doe",
"email": "john.doe@example.com"
}
}
]
}
Attributes
| 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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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. Renewal invoices of a plan include the coupon whose discount they carry.
|
GET /api/v2/front/invoices/:invoice_id/payment_methods
Lists the available payment methods for an invoice. This includes the available forms of payment and any extraneous options, like account credit.
REQUEST
$ curl https://mybiz.pike13.com/api/v2/front/invoices/1/payment_methods \
-H "Authorization: Bearer XXXXXXXXXXXXXXX"
RESPONSE
{
"payment_methods": [
{
"payment_type_id": 3,
"key": "creditcard",
"description": "Stored Visa 1111, 1/19",
"form_of_payment_id": 1,
"autobill": false,
"payer": {
"id": 1,
"name": "Jon Smith",
"email": "jonsmith@example.com"
}
},
{
"payment_type_id": 10,
"key": "credit",
"description": "Account credit",
"form_of_payment_id": 2,
"autobill": null,
"payer": {
"id": 1,
"name": "Jon Smith",
"email": "jonsmith@example.com"
},
"max_amount_cents": 1000
}
]
}
Attributes
See the attributes table below in the Desk section
PUT /api/v2/front/invoices/:invoice_id
Update the state or coupon_code of an invoice.
REQUEST
$ curl -X PUT https://mybiz.pike13.com/api/v2/front/invoices/1 \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "invoice": { "state_event": "close" } }'
RESPONSE
{
"invoices": [
{
"id": 1,
"person": {
"id": 1,
"name": "John Doe",
"email": "johndoe@example.com"
},
"state": "cart",
"state_events": [
"close"
],
"invoice_items": [
{
"id": 1,
"name": "Class R",
"description": "Class R",
"discount_total_cents": 0,
"discount_total": "0.00",
"amount_cents": 10000,
"amount": "100.00",
"recipients": [
{
"id": 1,
"name": "John Doe",
"email": "johndoe@example.com"
}
],
"adjustments": [],
"detail": {
"id": 1,
"type": "Pack",
"start_date": "2012-09-24",
"count_description": "1 visit per Week",
"extended_description": [
"Starts on Jun 27",
"for John Doe"
],
"has_terms": false,
"plan_product_id": 5,
"product_id": 5
}
}
],
"total_cents": 10000,
"total": "100.00",
"outstanding_amount_cents": 10000,
"outstanding_amount": "100.00",
"currency": "USD",
"payments": []
}
]
}
Parameters
| state_event | string | The next state to transition to. Can be “open”, “closed”, “canceled”, “cart”, “cart_hidden”, or “on_hold” |
|---|---|---|
| coupon_code | string | The code for the promotion. |
POST /api/v2/front/invoices
Creates an invoice given a list of plan_products.
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/front/invoices \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "invoice":{ "plan_products": [ {"id": 5, "recipient_ids": [ 1 ], "start_date": "2012-09-24"} ] } }'
RESPONSE
{
"invoices": [
{
"id": 1,
"person": {
"id": 1,
"name": "John Doe",
"email": "johndoe@example.com"
},
"state": "cart",
"state_events": [
"close"
],
"invoice_items": [
{
"id": 1,
"name": "Class R",
"description": "Class R",
"discount_total_cents": 0,
"discount_total": "0.00",
"amount_cents": 10000,
"amount": "100.00",
"recipients": [
{
"id": 1,
"name": "John Doe",
"email": "johndoe@example.com"
}
],
"adjustments": [],
"detail": {
"id": 1,
"type": "Pack",
"start_date": "2012-09-24",
"count_description": "1 visit per Week",
"extended_description": [
"Starts on Jun 27",
"for John Doe"
],
"has_terms": false,
"plan_product_id": 5,
"product_id": 5
}
}
],
"total_cents": 10000,
"total": "100.00",
"outstanding_amount_cents": 10000,
"outstanding_amount": "100.00",
"currency": "USD",
"payments": []
}
]
}
Parameters
See the parameters table below in the Desk section
POST /api/v2/front/invoices/:invoice_id/payments
Create a payment for an invoice.
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/front/invoices/1/payments \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "payments": [{ "payment_method": "creditcard", "amount_cents": 4999, "form_of_payment_id": 1 }]}'
RESPONSE
{
"payments": [
{
"id": 39,
"description": "Visa 1111, 1/20",
"state": "completed",
"amount_cents": 4999,
"amount": "49.99",
"maximum_refund_cents": 4999,
"maximum_refund": "49.99",
"created_at": "2018-11-29T19:08:24Z",
"voided_at": null,
"stripe_payment_intent_client_secret": "pi_XXXXXXXX_secret_XXXXXXXX",
"payer": {
"id": 1,
"name": "A Person",
"email": "aperson@example.com"
}
}
]
}
Parameters
| payment_method | string |
Required. The name of the payment method. It's either |
|---|---|---|
| amount_cents | integer | Required. The amount in cents to be paid on this invoice. If the payment_method is 'credit', the amount should be the total balance when possible. |
| form_of_payment_id | integer | The id of the vaulted form of payment being used on this invoice. |
POST /api/v2/front/invoices/:invoice_id/invoice_items
Add an invoice item to an existing invoice.
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/front/invoices/508/invoice_items \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "invoice_item": { "plan_product": { "id": 730, "recipient_ids": [56, 265], "start_date": "2020-10-16" }}}'
RESPONSE
{
"invoice_items": [
{
"id": 664,
"name": "FD-15180",
"description": "FD-15180 for 2 people",
"discount_total_cents": 0,
"discount_total": "0.00",
"amount_cents": 6000,
"amount": "60.00",
"limited_discount_description": null,
"recipients": [
{
"name": "Jane Doe"
},
{
"name": "John Doe"
}
],
"adjustments": [],
"detail": {
"id": 526,
"type": "Membership",
"start_date": "2020-10-16",
"count_description": "Unlimited visits",
"extended_description": [
"Starts on Oct 16",
"for group below"
],
"initial_punchcard_count_description": null,
"has_terms": false,
"plan_product_id": 730,
"product_id": 756
}
}
]
}
Parameters
See the parameters table below in the Desk section
DELETE /api/v2/front/invoices/:invoice_id/invoice_items/:id
Remove an invoice item from an existing invoice. The invoice won't be destroyed even if it has no invoice item after removing. If you don't want to keep it, you can simply abandon it and it will be automatically cleaned up. Invoice items for signup fee cannot be removed on its own. You need to remove an invoice item that a signup fee is associated with.
REQUEST
$ curl -X DELETE https://mybiz.pike13.com/api/v2/front/invoices/353/invoice_items/123 \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
RESPONSE
HTTP 204 if successful
HTTP 4xx if unsuccessful
Desk
GET /api/v2/desk/invoices/
Returns a list of invoices. Paginate using the page parameter.
REQUEST
$ curl https://mybiz.pike13.com/api/v2/desk/invoices?person_ids=9009 \
-H "Authorization: Bearer XXXXXXXXXXXXXXX"
RESPONSE
{
"invoices": [
{
"id": 50,
"total_cents": 11200,
"total": "112.00",
"person_id": 9009,
"currency": "USD",
"state": "closed",
"state_events": [
"reopen"
]
}
],
"total_count": 1
}
Parameters
| state | comma delimited string | The state the invoice is in. Can be “open”, “closed”, “canceled”, “cart”, “cart_hidden”, or “on_hold” |
|---|---|---|
| person_ids | comma delimited string | Person id(s) to filter on. |
| created_since | timestamp | Filter invoices created since the given timestamp. |
| updated_since | timestamp | Filter invoices updated since the given timestamp. |
Attributes
| id | integer | The id of the invoice. |
|---|---|---|
| total_cents | integer | The total cost of the invoice in cents. |
| total | string | The total cost of the invoice in localized currency. |
| state_events | array | An array of strings showing state events. |
| send_receipt | boolean | Was a receipt email sent? |
| receipt_email | string | The email address the invoice was sent to, if any. |
| currency | string | The type of currency the invoice is charged in, i.e 'USD'. |
| person_id | integer | The person id the invoice is for. |
| state | string | The current state of the invoice. Either 'open', 'closed', 'canceled', 'cart', 'cart_hidden', or 'on_hold.' |
GET /api/v2/desk/invoices/:id
Returns the details of a invoice.
REQUEST
$ curl https://mybiz.pike13.com/api/v2/desk/invoices/1 \
-H "Authorization: Bearer XXXXXXXXXXXXXXX"
RESPONSE
{
"invoices": [
{
"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": false,
"receipt_email": "john.doe@example.com",
"id": 50,
"invoice_number": "10045",
"invoice_date": "2018-12-07",
"currency": "USD",
"state": "closed",
"has_tip": false,
"has_commission_pay": false,
"can_adjust_tip": false,
"invoice_items": [
{
"id": 18,
"name": "Appointment A",
"description": "Appointment A",
"discount_total_cents": 0,
"discount_total": "0.00",
"amount_cents": 10000,
"amount": "100.00",
"recipients": [
{
"name": "John Doe"
}
],
"adjustments": [
{
"id": 12,
"type": "TaxAdjustment",
"name": "seattle",
"created_at": "2018-12-07T18:29:41Z",
"percent": -10,
"amount_cents": -1000,
"amount": "-10.00",
"source": {
"id": 1,
"type": "SalesTax"
}
},
{
"id": 13,
"type": "TaxAdjustment",
"name": "king county",
"created_at": "2018-12-07T18:29:41Z",
"percent": -2,
"amount_cents": -200,
"amount": "-2.00",
"source": {
"id": 2,
"type": "SalesTax"
}
}
],
"detail": {
"id": 19,
"type": "Pack",
"start_date": "2018-12-07",
"count_description": "1 visit per Week",
"extended_description": [
"Starts on Dec 7",
"for John Doe"
],
"has_terms": false,
"plan_product_id": 11,
"product_id": 11
},
"commissionable": false,
"compable": true
}
],
"payments": [
{
"id": 2,
"description": "Cash",
"state": "completed",
"amount_cents": 11200,
"amount": "112.00",
"maximum_refund_cents": 11200,
"maximum_refund": "112.00",
"created_at": "2018-12-07T18:29:58Z",
"voided_at": null,
"is_voidable": true
}
],
"location": {
"id": 1,
"name": "Raushire",
"slug": "raushire"
},
"created_by": {
"id": 1,
"name": "John Doe",
"email": "john.doe@example.com"
},
"person": {
"id": 1,
"name": "John Doe",
"email": "john.doe@example.com"
}
}
]
}
Attributes
| invoice_number | string | A unique bill identifer for this business, a.k.a. bill number. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| invoice_date | string | This invoice's due date. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| total_cents | integer | The total cost of the invoice in cents. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| total | string | The total cost of the invoice in localized currency. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outstanding_amount_cents | integer | The remaining cost of the invoice in cents. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outstanding_amount | string | The remaining cost of the invoice 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. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state_events | array | An array of strings containing the valid state events when calling to update the invoice. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| send_receipt | boolean | Was a receipt email sent? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| receipt_email | string | The email address the invoice was sent to, if any. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id | integer | The id of the invoice. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| currency | string | The type of currency the invoice is charged in, i.e 'USD'. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state | string | The current state of the invoice. Either 'open', 'closed', 'canceled', 'cart', 'cart_hidden', or 'on_hold.' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| has_tip | boolean | Does this invoice include a tip? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| has_commission_pay | boolean | Does this invoice include commission pay? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| can_adjust_tip | boolean | Is the tip adjustable? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| invoice_items | object | Information regarding the item the invoice is about
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| payments | array | The payments that have already been made on the invoice
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| location | object | Optional. Location information for this invoice
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| created_by | object | Optional. The person who created this invoice
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| person | object | Optional. Information regarding the person who the invoice is for
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| commission_recipient | object | Optional. Information regarding the commission recipient for this invoice, if any
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tip_recipient | object | Optional. Information regarding the tip recipient for this invoice, if any
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| coupon | object | Optional. Information regarding a coupon or promotion for the invoice, if there is any. Renewal invoices of a plan include the coupon whose discount they carry.
|
PUT /api/v2/desk/invoices/:invoice_id
Update the state, due date or coupon_code of an invoice, or connect it to a booking. In the curl example below, the invoice is being closed. If there is a booking associated with the invoice, closing the invoice will automatically complete the booking and its leases.
REQUEST
$ curl -X PUT https://mybiz.pike13.com/api/v2/desk/invoices/1 \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "invoice":{ "state_event": "close" } }'
RESPONSE
{
"invoices": [
{
"id": 1,
"person": {
"id": 1,
"name": "John Doe",
"email": "johndoe@example.com"
},
"state": "cart",
"state_events": [
"close"
],
"invoice_items": [
{
"id": 1,
"name": "Class R",
"description": "Class R",
"discount_total_cents": 0,
"discount_total": "0.00",
"amount_cents": 10000,
"amount": "100.00",
"recipients": [
{
"id": 1,
"name": "John Doe",
"email": "johndoe@example.com"
}
],
"adjustments": [],
"detail": {
"id": 1,
"type": "Pack",
"start_date": "2012-09-24",
"count_description": "1 visit per Week",
"extended_description": [
"Starts on Jun 27",
"for John Doe"
],
"has_terms": false,
"plan_product_id": 5,
"product_id": 5
}
}
],
"total_cents": 10000,
"total": "100.00",
"outstanding_amount_cents": 10000,
"outstanding_amount": "100.00",
"currency": "USD",
"payments": []
}
]
}
Parameters
| location_id | integer | Optional. Associate the invoice with a location. |
|---|---|---|
| commission_recipient_id | integer | Optional. Staff member who will recieve any commission. |
| tip_recipient_id | integer | Optional. Staff member who will recieve any tip. |
| send_receipt | boolean | Optional. Send an email receipt to the purchaser? |
| receipt_email | string | Optional. The email to send the receipt to. |
| state_event | string | Optional. The next state to transition to. Can be “open”, “closed”, “canceled”, “cart”, “cart_hidden”, or “on_hold” |
| coupon_code | string | Optional. A code for a promotion. |
| invoice_date | string | Optional. The invoice's due date, as an ISO-8601 date (YYYY-MM-DD). Must be today or later. Cannot be set on a closed or canceled invoice, or in the same request that closes a cart invoice. |
POST /api/v2/desk/invoices
Creates an invoice given a list of plan products.
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/invoices \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "invoice":{ "payer_id": 1, "plan_products": [ {"id": 5, "recipient_ids": [ 1 ], "start_date": "2012-09-24"} ] } }'
RESPONSE
{
"invoices": [
{
"id": 1,
"person": {
"id": 1,
"name": "John Doe",
"email": "johndoe@example.com"
},
"state": "cart",
"state_events": [
"close"
],
"invoice_items": [
{
"id": 1,
"name": "Class R",
"description": "Class R",
"discount_total_cents": 0,
"discount_total": "0.00",
"amount_cents": 10000,
"amount": "100.00",
"recipients": [
{
"id": 1,
"name": "John Doe",
"email": "johndoe@example.com"
}
],
"adjustments": [],
"detail": {
"id": 1,
"type": "Pack",
"start_date": "2012-09-24",
"count_description": "1 visit per Week",
"extended_description": [
"Starts on Jun 27",
"for John Doe"
],
"has_terms": false,
"plan_product_id": 5,
"product_id": 5
}
}
],
"total_cents": 10000,
"total": "100.00",
"outstanding_amount_cents": 10000,
"outstanding_amount": "100.00",
"currency": "USD",
"payments": []
}
]
}
Parameters
These apply to the Front and Desk version of the API. A plan_products array with one or more objects is required in the parameters. These objects can be plan, membership, prepaid, or pack products.
| booking_id | integer | Optional. Tie this invoice to a booking. When the invoice is closed, the booking will be completed. | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| payer_id | integer | Required. The id of the person paying for the invoice (e.g. the parent of a dependent). | |||||||||||||||
| plan_products | array | Array of plan_products for the invoice.
|
GET /api/v2/desk/invoices/:invoice_id/payment_methods
Lists the available payment methods for an invoice. This includes the available forms of payment and any extraneous options, like account credit.
REQUEST
$ curl https://mybiz.pike13.com/api/v2/desk/invoices/1/payment_methods \
-H "Authorization: Bearer XXXXXXXXXXXXXXX"
RESPONSE
{
"payment_methods": [
{
"payment_type_id": 4,
"key": "ach",
"description": " 0xxxxxxxx4321",
"form_of_payment_id": 6,
"autobill": true,
"payer": {
"id": 1,
"name": "A Person",
"email": "aperson@example.com"
}
},
{
"payment_type_id": 3,
"key": "creditcard",
"description": "Stored Visa 1111, 9/20",
"form_of_payment_id": 7,
"autobill": false,
"payer": {
"id": 1,
"name": "A Person",
"email": "aperson@example.com"
}
},
{
"payment_type_id": 15,
"key": "credit",
"description": "Account credit",
"form_of_payment_id": 1,
"autobill": null,
"payer": {
"id": 1,
"name": "A Person",
"email": "aperson@example.com"
},
"max_amount_cents": 1000
},
{
"payment_type_id": 1,
"key": "cash",
"description": "Cash",
"require_transaction_id": false
},
{
"payment_type_id": 2,
"key": "check",
"description": "Check",
"require_transaction_id": true
},
{
"payment_type_id": 14,
"key": "external_7",
"description": "external_200",
"require_transaction_id": true
},
{
"payment_type_id": 3,
"key": "creditcard",
"description": "Add a new credit card",
"swiper_enabled": false,
"required_fields": [
"cvv"
]
},
{
"payment_type_id": 4,
"key": "ach",
"description": "Enter new bank account",
"required_fields": []
}
]
}
Attributes
These apply to the Front and Desk version of the API.
| payment_methods | array | Array of payment_methods for the invoice.
|
|---|
POST /api/v2/desk/invoices/:invoice_id/payments
Create a payment for an invoice.
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/invoices/1/payments \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "payments": [{ "payment_method": "ach", "amount_cents": 4999, "form_of_payment_id": 1 }]}'
RESPONSE
{
"payments": [
{
"id": 205,
"description": " 0xxxxxxxx1111",
"state": "completed",
"amount_cents": 4999,
"amount": "49.99",
"maximum_refund_cents": 4999,
"maximum_refund": "49.99",
"created_at": "2020-09-14T23:46:25Z",
"voided_at": null,
"payer": {
"id": 1,
"name": "A Person",
"email": "aperson@example.com"
},
"is_voidable": true
}
]
}
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/invoices/1/payments \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "payments": [{ "payment_method": "cash", "amount_cents": 100 }]}'
RESPONSE
{
"payments": [
{
"id": 200,
"description": "Cash",
"state": "completed",
"amount_cents": 100,
"amount": "1.00",
"maximum_refund_cents": 100,
"maximum_refund": "1.00",
"created_at": "2020-09-15T00:24:21Z",
"voided_at": null,
"is_voidable": true
}
]
}
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/invoices/1/payments \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "payments": [{ "payment_method": "check", "amount_cents": 100, "transaction_id": "0198765432" }]}'
RESPONSE
{
"payments": [
{
"id": 206,
"description": "#0198765432",
"state": "completed",
"amount_cents": 100,
"amount": "1.00",
"maximum_refund_cents": 100,
"maximum_refund": "1.00",
"created_at": "2020-09-15T00:24:21Z",
"voided_at": null,
"is_voidable": true
}
]
}
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/invoices/1/payments \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "payments": [{ "payment_method": "credit", "amount_cents": 96, "form_of_payment_id": 1 }]}'
RESPONSE
{
"payments": [
{
"id": 213,
"description": "Account credit",
"state": "completed",
"amount_cents": 96,
"amount": "0.96",
"maximum_refund_cents": 96,
"maximum_refund": "0.96",
"created_at": "2020-09-15T22:24:33Z",
"voided_at": null,
"payer": {
"id": 1,
"name": "A Person",
"email": "aperson@example.com"
},
"is_voidable": false
}
]
}
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/invoices/1/payments \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "payments": [{ "payment_method": "creditcard", "amount_cents": 4999, "form_of_payment_id": 1 }]}'
RESPONSE
{
"payments": [
{
"id": 39,
"description": "Visa 1111, 1/20",
"state": "completed",
"amount_cents": 4999,
"amount": "49.99",
"maximum_refund_cents": 4999,
"maximum_refund": "49.99",
"created_at": "2018-11-29T19:08:24Z",
"voided_at": null,
"stripe_payment_intent_client_secret": "pi_XXXXXXXX_secret_XXXXXXXX",
"payer": {
"id": 1,
"name": "A Person",
"email": "aperson@example.com"
},
"is_voidable": true
}
]
}
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/invoices/1/payments \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "payments": [{ "payment_method": "external_7", "amount_cents": 100, "transaction_id": "12340004" }]}'
RESPONSE
{
"payments": [
{
"id": 20,
"description": "Name of external payment system",
"state": "completed",
"amount_cents": 100,
"amount": "1.00",
"maximum_refund_cents": 100,
"maximum_refund": "1.00",
"created_at": "2020-09-15T00:24:21Z",
"voided_at": null,
"is_voidable": true
}
]
}
Parameters
| payment_method | string |
Required. The name of the payment method. The current options are |
|---|---|---|
| amount_cents | integer | Required. The amount in cents to be paid on this invoice. |
| form_of_payment_id | integer | The id of the vaulted form of payment being used on this invoice. |
DELETE /api/v2/desk/invoices/:invoice_id/payments/:payment_id
Deletes a payment that is still in the
REQUEST
$ curl -X DELETE https://mybiz.pike13.com/api/v2/desk/invoices/600/payments/1299 \
-H "Authorization: Bearer XXXXXXXXXXXXXXX"
RESPONSE
HTTP 204 if successful
HTTP 403 if the payment is not in the checkout state
POST /api/v2/desk/invoices/:invoice_id/payments/:payment_id/refunds
Refunds a payment.
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/invoices/600/payments/749/refunds \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "refund": { "amount_cents": 5 }}'
RESPONSE
{
"refunds": [
{
"id": 258,
"amount_cents": 5,
"amount": "0.05",
"state": "completed",
"payment_id": 749,
"description": "Visa 9428, 10/25",
"created_at": "2020-12-03T21:03:00Z",
"voided_at": null
}
]
}
Parameters
| refund | object | Object of refund for the payment.
|
|---|
POST /api/v2/desk/payments/:payment_id/voids
Void a payment.
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/payments/1/voids \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "void": { "invoice_item_ids_to_cancel": [1, 2] } }'
RESPONSE
{
"payments": [
{
"id": 20,
"description": "Visa 1111, 1/20",
"state": "completed",
"amount_cents": 100,
"amount": "1.00",
"maximum_refund_cents": 100,
"maximum_refund": "1.00",
"created_at": "2020-09-15T00:24:21Z",
"voided_at": "2020-09-15T00:46:32Z",
"is_voidable": true
}
]
}
Parameters
| void | object | Object of void.
|
|---|
POST /api/v2/desk/refunds/:refund_id/voids
Void a refund.
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/refunds/1/voids \
-H "Authorization: Bearer XXXXXXXXXXXXXXX"
RESPONSE
{
"refunds": [
{
"id": 20,
"amount_cents": 100,
"amount": "1.00",
"state": "completed",
"description": "Visa 1111, 1/20",
"created_at": "2020-09-15T00:24:21Z",
"voided_at": "2020-09-15T00:46:32Z",
"is_voidable": false
}
]
}
POST /api/v2/desk/invoices/:invoice_id/invoice_items
Add a plan_product to an existing invoice.
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/invoices/353/invoice_items \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "invoice_item": { "plan_product": { "id": 730, "recipient_ids": [56, 265], "start_date": "2020-10-16" }}}'
RESPONSE
{
"invoice_items": [
{
"id": 664,
"name": "FD-15180",
"description": "FD-15180 for 2 people",
"discount_total_cents": 0,
"discount_total": "0.00",
"amount_cents": 6000,
"amount": "60.00",
"limited_discount_description": null,
"recipients": [
{
"name": "Jane Doe"
},
{
"name": "John Doe"
}
],
"adjustments": [],
"detail": {
"id": 526,
"type": "Membership",
"start_date": "2020-10-16",
"count_description": "Unlimited visits",
"extended_description": [
"Starts on Oct 16",
"for group below"
],
"initial_punchcard_count_description": null,
"has_terms": false,
"plan_product_id": 730,
"product_id": 756
}
}
]
}
Parameters
| plan_product | object | Object of plan_product for the invoice item.
|
|---|
DELETE /api/v2/desk/invoices/:invoice_id/invoice_items/:id
Remove an invoice item from an existing invoice. The invoice won't be destroyed even if it has no invoice item after removing. If you don't want to keep it, you can simply abandon it and it will be automatically cleaned up. Invoice items for signup fee cannot be removed on its own. You need to remove an invoice item that a signup fee is associated with.
REQUEST
$ curl -X DELETE https://mybiz.pike13.com/api/v2/desk/invoices/353/invoice_items/123 \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
RESPONSE
HTTP 204 if successful
HTTP 4xx if unsuccessful
POST /api/v2/desk/invoices/:invoice_id/invoice_items/:invoice_item_id/prorates
Prorate the first invoice and the first punchcard count. If the request is invalid, no proration is created. If a proration already exists, it updates it.
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/invoices/600/invoice_items/749/prorates \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "prorate": { "amount_cents": 10, "initial_punchcard_count": 5 }}'
RESPONSE
{
"prorates": [
{
"id": 475,
"type": "ProrateAdjustment",
"name": "Adjustment for reduced billing period of Oct 29 through Oct 31, 2020",
"amount_cents": 1000,
"amount": "10.00",
"created_at": "2020-10-29T18:18:53Z",
"initial_punchcard_count": 5
}
]
}
Parameters
| prorate | object | Object of prorate for the invoice item.
|
|---|
DELETE /api/v2/desk/invoices/:invoice_id/invoice_items/:invoice_item_id/prorates
Remove proration from memberships for both amount cents and initial punchcard count. The initial punchcard count will be set to the default count.
REQUEST
$ curl -X DELETE https://mybiz.pike13.com/api/v2/desk/invoices/600/invoice_items/749/prorates \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
RESPONSE
HTTP 204 if successful
HTTP 4xx if unsuccessful
GET /api/v2/desk/invoices/:invoice_id/invoice_items/:invoice_item_id/discounts
Returns the discount for the invoice item. If none exists, it returns 404.
REQUEST
$ curl -X GET https://mybiz.pike13.com/api/v2/desk/invoices/600/invoice_items/749/discounts \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
RESPONSE
{
"discounts": [
{
"id": 2750,
"type": "Discount",
"name": "Discount (5%)",
"percent": 5.0,
"amount_cents": 125,
"amount": "1,25",
"created_at": "2020-11-20T05:04:30Z"
}
]
}
POST /api/v2/desk/invoices/:invoice_id/invoice_items/:invoice_item_id/discounts
Creates the discount on the invoice item. If one already exists, it replaces the existing one.
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/invoices/600/invoice_items/749/discounts \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "discount": { "amount_cents": 5 }}'
RESPONSE
{
"discounts": [
{
"id": 2719,
"type": "Discount",
"name": "Discount",
"amount_cents": 5,
"amount": "0,05",
"created_at": "2020-11-20T05:04:30Z"
}
]
}
Parameters
| discount | object | Object of discount for the invoice item.
|
|---|
DELETE /api/v2/desk/invoices/:invoice_id/invoice_items/:invoice_item_id/discounts
Removes the discount from the invoice item.
REQUEST
$ curl -X DELETE https://mybiz.pike13.com/api/v2/desk/invoices/600/invoice_items/749/discounts \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
RESPONSE
HTTP 204 if successful
HTTP 4xx if unsuccessful