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

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.

Show curl example

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

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.
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.
limited_discount_descriptionstringFor a recurring item with a discount that ends, a localized summary of its duration and the price afterwards, e.g. '15% off for 3 payments, then $40.00'. Null otherwise.
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.
amountstringEither 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.
cycles_remainingintegerOptional. For a discount that applies to a limited number of payments: how many payments it applies to, including this one.
ends_onstringOptional. For a discount that applies through a date: the last payment date it applies to, as YYYY-MM-DD.
sourceobject

Optional. The source of the invoice item adjustment

idintegerThe id of the source.
typestringThe type of the source.
initial_punchcard_countintegerOptional. The number of punches the card starts with. Only for the type 'ProrateAdjustment'.
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.
revenue_category_idintegerOptional. A Pike13 revenue category id.
external_product_idintegerOptional. The id for the external product if invoice is external.
third_party_product_idstringRequired. A product id from the external system if invoice is external.
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. Renewal invoices of a plan include the coupon whose discount they carry.

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 of the promotion, as applied on this invoice.
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.

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.

Show curl example

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.

Show curl example

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_eventstringThe next state to transition to. Can be “open”, “closed”, “canceled”, “cart”, “cart_hidden”, or “on_hold”
coupon_codestringThe code for the promotion.
POST /api/v2/front/invoices

Creates an invoice given a list of plan_products.

Show curl example

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.

Show curl example

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_methodstring

Required. The name of the payment method. It's either creditcard or credit.

amount_centsintegerRequired. 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_idintegerThe 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.

Show curl example

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.

Show curl example

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.

Show curl example

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

statecomma delimited stringThe state the invoice is in. Can be “open”, “closed”, “canceled”, “cart”, “cart_hidden”, or “on_hold”
person_idscomma delimited stringPerson id(s) to filter on.
created_sincetimestampFilter invoices created since the given timestamp.
updated_sincetimestampFilter invoices updated since the given timestamp.

Attributes

idintegerThe id of the invoice.
total_centsintegerThe total cost of the invoice in cents.
totalstringThe total cost of the invoice in localized currency.
state_eventsarrayAn array of strings showing state events.
send_receiptbooleanWas a receipt email sent?
receipt_emailstringThe email address the invoice was sent to, if any.
currencystringThe type of currency the invoice is charged in, i.e 'USD'.
person_idintegerThe person id the invoice is for.
statestringThe 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.

Show curl example

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_numberstringA unique bill identifer for this business, a.k.a. bill number.
invoice_datestringThis invoice's due date.
total_centsintegerThe total cost of the invoice in cents.
totalstringThe total cost of the invoice in localized currency.
outstanding_amount_centsintegerThe remaining cost of the invoice in cents.
outstanding_amountstringThe remaining cost of the invoice 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.
state_eventsarrayAn array of strings containing the valid state events when calling to update the invoice.
send_receiptbooleanWas a receipt email sent?
receipt_emailstringThe email address the invoice was sent to, if any.
idintegerThe id of the invoice.
currencystringThe type of currency the invoice is charged in, i.e 'USD'.
statestringThe current state of the invoice. Either 'open', 'closed', 'canceled', 'cart', 'cart_hidden', or 'on_hold.'
has_tipbooleanDoes this invoice include a tip?
has_commission_paybooleanDoes this invoice include commission pay?
can_adjust_tipbooleanIs the tip adjustable?
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.
limited_discount_descriptionstringFor a recurring item with a discount that ends, a localized summary of its duration and the price afterwards, e.g. '15% off for 3 payments, then $40.00'. Null otherwise.
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.
amountstringEither 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.
cycles_remainingintegerOptional. For a discount that applies to a limited number of payments: how many payments it applies to, including this one.
ends_onstringOptional. For a discount that applies through a date: the last payment date it applies to, as YYYY-MM-DD.
sourceobject

Optional. The source of the invoice item adjustment

idintegerThe id of the source.
typestringThe type of the source.
initial_punchcard_countintegerOptional. The number of punches the card starts with. Only for the type 'ProrateAdjustment'.
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
commissionablebooleanIs this invoice item commissionable?
compablebooleanIs this invoice item compable?
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_refundintegerThe 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.
amountintegerThe 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.
is_voidablebooleanCan the invoice be voided?
locationobject

Optional. Location information for this invoice

idintegerThe id for this location.
nameintegerThe name of this location.
slugintegerThe slug (unique string) for this location.
created_byobject

Optional. The person who created this invoice

idintegerThe id of the person who created this invoice.
namestringThe full name of the person who created this invoice.
emailstringThe email address of the person who created this invoice.
personobject

Optional. Information regarding the person who the invoice is for

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.
commission_recipientobject

Optional. Information regarding the commission recipient for this invoice, if any

idintegerThe id of the commission recipient for this invoice.
namestringThe full name of the commission recipient for this invoice.
emailstringThe email address of the commission recipient for this invoice.
tip_recipientobject

Optional. Information regarding the tip recipient for this invoice, if any

idintegerThe id of the tip recipient for this invoice.
namestringThe full name of the tip recipient for this invoice.
emailstringThe email address of the tip recipient for this invoice.
couponobject

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.

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 of the promotion in cents, as applied on this invoice.
discount_amountintegerOptional. The fixed amount discount of the promotion in localized currency.
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.
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.

Show curl example

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_idintegerOptional. Associate the invoice with a location.
commission_recipient_idintegerOptional. Staff member who will recieve any commission.
tip_recipient_idintegerOptional. Staff member who will recieve any tip.
send_receiptbooleanOptional. Send an email receipt to the purchaser?
receipt_emailstringOptional. The email to send the receipt to.
state_eventstringOptional. The next state to transition to. Can be “open”, “closed”, “canceled”, “cart”, “cart_hidden”, or “on_hold”
coupon_codestringOptional. A code for a promotion.
invoice_datestringOptional. 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.

Show curl example

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_idintegerOptional. Tie this invoice to a booking. When the invoice is closed, the booking will be completed.
payer_idintegerRequired. The id of the person paying for the invoice (e.g. the parent of a dependent).
plan_productsarray

Array of plan_products for the invoice.

idintegerThe id of the products that have plan products.
recipient_idsarrayArray of the Person ids for the people who will receive the plan.
staff_member_idintegerThe id of the Staff Member the plan will be tied to. Required only for plans with staff-specific pricing.
event_idintegerThe event id of the course that this plan product will be used for. This is required for courses. Do not send event_id for classes or appointments.
start_datestringOptional. The start date of the plans for the products.
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.

Show curl example

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_methodsarray

Array of payment_methods for the invoice.

payment_type_idintegerThe type id of the available payment method.
keystring

The key of the available payment method. It's either ach, cash, check, credit, creditcard, external_number, paypal. You give this as a param: payment_method for POST /api/v2/desk/invoices/:invoice_id/payments.

descriptionstringThe description of the available payment method. e.g. Cash, Check
form_of_payment_idintegerThe id of this form of payment.
autobillbooleanWhether or not this form of payment is on autobillable.
payerobject

Optional. Information regarding the person attached to this form of 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.
detailsobjectAdditional details in key-value pairs.
POST /api/v2/desk/invoices/:invoice_id/payments

Create a payment for an invoice.

Show curl example

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_methodstring

Required. The name of the payment method. The current options are ach, cash, check, credit, creditcard, external_number, paypal. This is an attribute: key from GET /api/v2/desk/invoices/:invoice_id/payment_methods.

amount_centsintegerRequired. The amount in cents to be paid on this invoice.
form_of_payment_idintegerThe 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 checkout state, such as one started with GET /api/v2/desk/invoices/:invoice_id/payments/new but never completed. Payments in any other state return 403; use a refund or void instead. Requires permission to delete client payments.

Show curl example

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.

Show curl example

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

refundobject

Object of refund for the payment.

amount_centsintegerRequired. The fixed amount to be refunded. Negative numbers and Zero are not allowed.
payment_type_idintegerOptional. Allowed payment types are cash, account credit, and the original payment type. If not specified, it defaults to the original payment type.
invoice_item_ids_to_cancelarrayOptional. An array of invoice item ids that you want to cancel the associated plans. If not specified, no plans will be cancelled
send_receiptbooleanOptional. If not specified, it will not send a receipt.
receipt_emailstringRequired if send_receipt is true. Email address of recipient.

POST /api/v2/desk/payments/:payment_id/voids

Void a payment.

Show curl example

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

voidobject

Object of void.

invoice_item_ids_to_cancelarrayOptional. Pass an array of invoice item ids that you want to cancel. If not specified, it does not cancel any plans.

POST /api/v2/desk/refunds/:refund_id/voids

Void a refund.

Show curl example

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.

Show curl example

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_productobject

Object of plan_product for the invoice item.

idintegerThe id of the plan product.
recipient_idsarrayArray of the Person ids for the people who will receive the plan.
staff_member_idintegerThe id of the Staff Member the plan will be tied to. Required only for plans with staff-specific pricing.
event_idintegerThe event id of the course that this plan product will be used for. This is required for courses. Do not send event_id for classes or appointments.
start_datestringOptional. The start date of the plan for the product.

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.

Show curl example

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.

Show curl example

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

prorateobject

Object of prorate for the invoice item.

amount_centsintegerOptional. Used to prorate the price of a membership on the first invoice. The amount will be deducted from the invoice. Negative number is not allowed.
initial_punchcard_countintegerOptional. Used to prorate the number of visits issued on the first punchcard. Only allowed for limited memberships. Negative number is not allowed.

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.

Show curl example

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.

Show curl example

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.

Show curl example

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

discountobject

Object of discount for the invoice item.

amount_centsintegerOptional. Used for a fixed amount. The amount will be deducted from the invoice. Negative number is not allowed.
percentintegerOptional. Used for a percent amount. The amount will be deducted from the invoice. Negative number is not allowed.
oneoffbooleanOptional. Defaults to true, which applies the discount to this payment only. Set to false to apply it to every recurring payment while the plan is active, or for cycles_remaining payments. Setting it to false is only allowed for recurring plans; other items return 422. It cannot be true together with cycles_remaining.
cycles_remainingintegerOptional. Applies the discount to this payment and the following ones, for this many payments in total, instead of this payment only. Must be a whole number from 1 to 999. Only allowed for recurring plans; other items return 422.

DELETE /api/v2/desk/invoices/:invoice_id/invoice_items/:invoice_item_id/discounts

Removes the discount from the invoice item.

Show curl example

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