Skip to main content
POST
/
companies
/
{company_id}
/
checkout
Create Checkout Session
curl --request POST \
  --url https://api.maplebilling.com/api/v1/companies/{company_id}/checkout \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "auto_charges": null,
  "auto_renews": null,
  "bundle_pricing_id": null,
  "change_proration_type": null,
  "change_reset_billing_anchor": null,
  "change_timing": null,
  "config_items": [
    {
      "hide_at_checkout": null,
      "minimum_units": 1,
      "num_licenses": 1,
      "product_metric_pricing_id": null,
      "product_pricing_id": null,
      "quantity_config": {
        "allow_custom_quantity": true,
        "max_quantity": 123,
        "min_quantity": 123
      },
      "sort_order": null,
      "upsell_product_metric_pricing_id": null
    }
  ],
  "customer_id": "<string>",
  "discounts": [
    {
      "amount": {
        "currency": "<string>",
        "value_in_cents": 123
      },
      "cap": {
        "currency": "<string>",
        "value_in_cents": 123
      },
      "coupon_id": null,
      "customer_id": null,
      "expiration_date": null,
      "import_created_at_ref": null,
      "import_ref": null,
      "imported_from": null,
      "item_pricing_id": null,
      "name": "<string>",
      "onetime_billable_id": null,
      "percent": 0.5,
      "product_id": null,
      "product_pricing_id": null,
      "proposal_id": null,
      "state": null,
      "subscription_id": null,
      "type": "DISCOUNT_AMOUNT"
    }
  ],
  "metadata": {},
  "onetime_items": [
    {
      "aggregate": 123,
      "custom_price": {
        "amount": {
          "currency": "<string>",
          "value_in_cents": 123
        },
        "description": "<string>",
        "product_id": "<string>"
      },
      "product_pricing_id": null,
      "quantity_config": {
        "allow_custom_quantity": true,
        "max_quantity": 123,
        "min_quantity": 123
      },
      "sort_order": null
    }
  ],
  "options": {
    "allow_promo_code": null,
    "completion_action": null,
    "confirmation_message": null,
    "redirect_url": null,
    "requires_customer_address": null
  },
  "previous_subscription_id": null,
  "product_pricing_ids": [
    "<string>"
  ],
  "term": {
    "count": 1,
    "frequency": "HOUR"
  },
  "trial": null,
  "trial_term": {
    "count": 1,
    "frequency": "HOUR"
  },
  "type": "CHECKOUT_SESSION"
}'
{
  "id": "<string>",
  "url": null
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Idempotency-Key
string

The idempotency key that will be used to ensure the request is only performed once

Path Parameters

company_id
string
required

The company ID with the prefix 'cmp_'.

Body

application/json
config_items
object[]
required
customer_id
string
required

The customer attached to the checkout session

type
enum<string>
required

The type of the checkout session

Available options:
CHECKOUT_SESSION
auto_charges
boolean | null

Whether the subscription is automatically charged to the payment method after the checkout session

auto_renews
boolean | null

Whether this subscription auto renews at the end of the term. This is to be used without end date or renewal date

bundle_pricing_id
string | null

The bundle pricing that forms the checkout session

change_proration_type
enum<string> | null

The proration type of the existing subscription, if provided. This is one of NEXT, IMMEDIATE or NONE based on whether the proration is charged on the next invoice, immediately or no proration is applied respectively

Available options:
NEXT,
IMMEDIATE,
NONE
change_reset_billing_anchor
boolean | null

Whether to reset the billing anchor of the existing subscription, if provided

change_timing
enum<string> | null

The change timing of the existing subscription, if provided. This is one of IMMEDIATE, PERIOD_END or RENEWAL based on whether the change timing needs to be immediate, at the end of the current period, on renewal respectively

Available options:
IMMEDIATE,
PERIOD_END,
RENEWAL
discounts
object[] | null

The discounts attached to the checkout session

metadata
object

Any additional as key-value pairs that needs to be attached to the subscription after the checkout session

onetime_items
object[] | null

Any one time charges to be attached to the checkout session

options
object | null

The detailed options for the checkout session such as confirmation messages, redirect urls etc.

previous_subscription_id
string | null

The ID of an existing subscription whose plan will change with the checkout session

product_pricing_ids
string[] | null

The list of product pricings that form the checkout session

term
object

The term for the subscription created by the checkout session

trial
boolean | null

Whether the checkout session creates a subscription in a trial

trial_term
object

The trial term for the subscription after the checkout session

Response

200 - application/json

OK

id
string

The ID of the checkout session

url
string | null

The checkout link generated

I