POST
/
v2
/
subscriptions
curl --request POST \
  --url https://api.hyperline.co/v2/subscriptions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "customer_id": "cus_QalW2vTAdkR6IY",
  "purchase_order": "<string>",
  "commitment_interval": {
    "period": "years",
    "count": 1
  },
  "renew_automatically": true,
  "minimum_invoice_fee": 250,
  "starts_at": "2023-01-20T16:04:11Z",
  "initial_billing_at": "2023-01-20T16:04:11Z",
  "invoicing_entity_id": "A description of the product.",
  "trial_ends_at": "2023-01-20T16:04:11Z",
  "trial_delay_first_invoice": true,
  "activation_strategy": "checkout",
  "payment_method_strategy": "current",
  "available_payment_method_types": [
    "card"
  ],
  "cancel_at": "2023-01-20T16:04:11Z",
  "cancellation_strategy": "refund_prorata",
  "cancellation_amount": 123,
  "checkout_session": {
    "send_to": {
      "email": "jsmith@example.com",
      "message": "<string>"
    },
    "redirect_url": "<string>"
  },
  "coupons": [
    {
      "id": "<string>",
      "repeat": "once",
      "expires_at": "2023-01-20T16:04:11Z",
      "apply_at": "2023-01-20T16:04:11Z",
      "product_ids": [
        "<string>"
      ]
    }
  ],
  "plan_id": "plan_zHmjoDee4ZRmQV",
  "products": [
    {
      "id": "itm_FJKlqUb8COXw55",
      "name": "Product name",
      "description": "A description of the product.",
      "description_display_interval_dates": true,
      "payment_interval": {
        "period": "months",
        "count": 1
      },
      "payment_schedule": "start",
      "price": {
        "type": "fee",
        "amount": 200
      },
      "count": 2,
      "unit_name": "user",
      "min_committed_count": 2,
      "min_amount": 123,
      "max_amount": 123,
      "metering_interval_type": "subscription_commitment",
      "metering_interval": {
        "period": "days",
        "count": 2
      },
      "metering_interval_start_at": "2023-01-20T16:04:11Z",
      "bill_usage_difference": true
    }
  ],
  "properties": {},
  "generate_draft_invoices": true
}'
{
  "id": "sub_B6ClkdqNqVNBgY",
  "currency": "EUR",
  "status": "active",
  "purchase_order": "<string>",
  "properties": {},
  "customer_id": "cus_QalW2vTAdkR6IY",
  "plan_id": "plan_zHmjoDee4ZRmQV",
  "minimum_invoice_fee": 250,
  "invoicing_entity_id": "ive_jerrb484RHn",
  "checkout_session_id": "<string>",
  "commitment_interval": {
    "period": "years",
    "count": 1
  },
  "renew_automatically": true,
  "activation_strategy": "checkout",
  "starts_at": "2023-01-20T16:04:11Z",
  "paused_at": "2023-01-20T16:04:11Z",
  "reactivate_at": "2023-01-20T16:04:11Z",
  "cancel_at": "2023-01-20T16:04:11Z",
  "cancellation_strategy": "refund_prorata",
  "cancellation_amount": 123,
  "estimated_arr": 123,
  "current_period_started_at": "2023-01-20T16:04:11Z",
  "current_period_ends_at": "2023-01-20T16:04:11Z",
  "next_payment_at": "2023-01-20T16:04:11Z",
  "next_payment_amount": 123,
  "renews_at": "2023-01-20T16:04:11Z",
  "trial_ends_at": "2023-01-20T16:04:11Z",
  "created_at": "2023-01-20T16:04:11Z",
  "products": [
    {
      "id": "itm_FJKlqUb8COXw55",
      "name": "Product name",
      "description": "A description of the product.",
      "description_display_interval_dates": true,
      "payment_interval": {
        "period": "months",
        "count": 1
      },
      "payment_schedule": "start",
      "type": "flat_fee",
      "count": 1,
      "prices": [
        {
          "type": "fee",
          "amount": 123
        }
      ]
    }
  ],
  "coupons": [
    {
      "id": "cou_DKL4Xcb5VSa8CQ",
      "name": "Partner discount",
      "description": "<string>",
      "expiration_date": "2023-11-07T05:31:56Z",
      "redemption_limit": 123,
      "created_at": "2023-01-20T16:04:11Z",
      "type": "amount",
      "discount_amount": 2000,
      "currency": "EUR",
      "repeat": "once",
      "product_ids": [
        "<string>"
      ],
      "expires_at": "2023-01-20T16:04:11Z",
      "apply_at": "2023-01-20T16:04:11Z"
    }
  ],
  "plan": {
    "id": "plan_zHmjoDee4ZRmQV",
    "name": "My example plan"
  },
  "checkout_session": {
    "id": "che_hEUPdVG7IgjpW1",
    "status": "opened",
    "available_payment_methods": [
      "card"
    ],
    "redirect_url": "https://app.hyperline.co/callback/checkout",
    "send_to": {
      "email": "josh@alpeak.com",
      "message": "<string>"
    },
    "url": "https://billing.hyperline.co/checkout/che_hEUPdVG7IgjpW1"
  },
  "payment_method_type": "card",
  "payment_method": {
    "id": "pm_1xMpj5bwRqN7LM",
    "type": "card",
    "last_4_digits": 2718,
    "expiration_date": "2026-11",
    "brand": "visa"
  },
  "generate_draft_invoices": true
}

Authorizations

Authorization
string
headerrequired

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

Body

application/json
customer_id
string
required

ID of the customer.

purchase_order
string

Reference to the purchase order.

commitment_interval
object

Interval used to represent the commitment period of the subscription. Note that the commitment interval is different than the subscription duration (e.g. you can have a mandatory commitment of 1 year but an unlimited subscription).

renew_automatically
boolean
default: true

Indicates if the subscription should automatically renew.

minimum_invoice_fee
number

Minimum fee applied to each invoice outside of one time payments

starts_at
string
required

Subscription contract start date. UTC date time string in the ISO 8601 format.

initial_billing_at
string

Date when the subscription will start being billed. Must be after the startsAt date and will correspond to the startsAt date if not defined.UTC date time string in the ISO 8601 format.

invoicing_entity_id
string

Product description. This will appear on the final invoices.

trial_ends_at
string

End date of the trial period. UTC date time string in the ISO 8601 format.

trial_delay_first_invoice
boolean
default: false

Delay first invoice to the end of the trial period.

activation_strategy
enum<string>
required

Strategy used to activate the subscription.

  • start_date: The subscription will become active on the specified start date. If the start date is in the past, it will be activated immediately.
  • manually: The subscription requires activation through a manual action.
  • checkout: The subscription will be activated once the checkout is completed, but only if the start date is in the past. Otherwise, activation will occur later on the specified start date.
  • quote: The subscription will be activated depending on the configuration and the signature of the related quote.
Available options:
start_date,
manually,
checkout
payment_method_strategy
enum<string>
required

Payment method strategy used to bill the subscription.

  • new: Ask the customer for a new payment method. The customer can fill in their payment method either on the subscription's checkout session or on their portal page.
  • current: Use the current default payment method of the customer.
  • external: Manage the payments of the subscription outside of Hyperline.
Available options:
current,
external,
new
available_payment_method_types
enum<string>[]

Set the allowed types of payment methods for the customer. Only applies to the new payment method strategy.

Available options:
card,
direct_debit,
direct_debit_ach,
direct_debit_bacs,
transfer,
transfer_automated
cancel_at
string

Subscription cancel date. UTC date time string in the ISO 8601 format.

cancellation_strategy
enum<string>

Strategy used to cancel the subscription. If not specified do_nothing is used.

  • charge_prorata: Will charge the customer the unpaid amount for the prorated period up to the end of the current period.
  • charge_custom: Will charge the customer a custom amount.
  • refund_prorata: Will refund to the customer the overpaid subscription amount using prorated calculations on the cancellation date.
  • refund_custom: Will refund to the customer a custom amount.
  • end_of_period: Will cancel the subscription at the end date of the current billing period.
  • do_nothing: Will only cease the subscription without any additional actions.
Available options:
refund_prorata,
refund_custom,
charge_prorata,
charge_custom,
end_of_period,
do_nothing
cancellation_amount
number

Custom amount used when cancelling the subscription. Only applies to the charge_custom or the refund_custom cancellation strategy.

checkout_session
object
coupons
object[]
plan_id
string

ID of the plan used to create the subscription.

products
object[]

Products that make up the subscription.

properties
object

Key/value pairs to store any information you find useful.

generate_draft_invoices
boolean
default: false

Generate draft invoices for the subscription. Each invoice will need to be reviewed and validated manually before being sent

Response

201 - application/json
id
string
required

Subscription ID.

currency
string
required

Currency code. See ISO 4217.

status
enum<string>
required

Subscription status.

  • draft: The subscription is being created, this status is only used in the subscription assignation flow of the UI version of Hyperline.
  • pending: The subscription has been created and won't be charged until it is activated.
  • active: The subscription is running and will be invoiced at the next payment date.
  • paused: The subscription's payment collection is paused.
  • cancelled: The subscription has been canceled from an active state.
  • voided: The subscription has been voided directly from the pending state.
  • errored: We attempted 4 times (3 retries) and failed to charge a subscription's invoice, see Handling payment errors. We consider the subscription as inactive (as the customer failed to pay you) meaning that we won't invoice the customer in the future nor collect payment. You can choose to reactivate it manually.
Available options:
active,
cancelled,
draft,
errored,
paused,
pending,
voided
purchase_order
string | null
required

Reference to the purchase order.

properties
object | null
required

Key/value pairs to store any information you find useful.

customer_id
string
required

ID of the customer.

plan_id
string | null
required

ID of the plan used to create the subscription.

minimum_invoice_fee
number | null
required

Minimum fee applied to each invoice outside of one time payments

invoicing_entity_id
string
required

ID of the invoicing entity attached to the subscription

checkout_session_id
string | null
required

ID of the checkout session.

commitment_interval
object | null
required

Interval used to represent the commitment period of the subscription. Note that the commitment interval is different than the subscription duration (e.g. you can have a mandatory commitment of 1 year but an unlimited subscription).

renew_automatically
boolean
required

Indicates if the subscription should automatically renew.

activation_strategy
enum<string> | null
required

Strategy used to activate the subscription.

  • start_date: The subscription will become active on the specified start date. If the start date is in the past, it will be activated immediately.
  • manually: The subscription requires activation through a manual action.
  • checkout: The subscription will be activated once the checkout is completed, but only if the start date is in the past. Otherwise, activation will occur later on the specified start date.
  • quote: The subscription will be activated depending on the configuration and the signature of the related quote.
Available options:
start_date,
manually,
checkout,
quote
starts_at
string
required

Subscription contract start date. UTC date time string in the ISO 8601 format.

paused_at
string | null
required

Date when the subscription was paused. Only applies to paused status. UTC date time string in the ISO 8601 format.

reactivate_at
string | null
required

Date when the subscription was reactivated after the last pause event. UTC date time string in the ISO 8601 format.

cancel_at
string | null
required

Subscription cancel date. UTC date time string in the ISO 8601 format.

cancellation_strategy
enum<string> | null
required

Strategy used to cancel the subscription. If not specified do_nothing is used.

  • charge_prorata: Will charge the customer the unpaid amount for the prorated period up to the end of the current period.
  • charge_custom: Will charge the customer a custom amount.
  • refund_prorata: Will refund to the customer the overpaid subscription amount using prorated calculations on the cancellation date.
  • refund_custom: Will refund to the customer a custom amount.
  • end_of_period: Will cancel the subscription at the end date of the current billing period.
  • do_nothing: Will only cease the subscription without any additional actions.
Available options:
refund_prorata,
refund_custom,
charge_prorata,
charge_custom,
end_of_period,
do_nothing
cancellation_amount
number
required

Custom amount used when cancelling the subscription. Only applies to the charge_custom or the refund_custom cancellation strategy.

estimated_arr
number
required

Estimated Annual Recurring Revenue generated by the subscription.

current_period_started_at
string | null
required

Start date of the current billing period. UTC date time string in the ISO 8601 format.

current_period_ends_at
string | null
required

End date of the current billing period. UTC date time string in the ISO 8601 format.

next_payment_at
string | null
required

Date on which the next subscription payment will occur. UTC date time string in the ISO 8601 format.

next_payment_amount
number
required

The amount of the next subscription payment. The system will generate an invoice to pay on the next_payment_at.

renews_at
string | null
required

Next subscription commitment renewal date. UTC date time string in the ISO 8601 format.

trial_ends_at
string | null
required

End date of the trial period. UTC date time string in the ISO 8601 format.

created_at
string
required

Subscription creation date. UTC date time string in the ISO 8601 format.

products
object[]
required

Products that make up the subscription.

coupons
object[]
required

Coupons to be applied to the prices of subscription products.

plan
object | null
required
checkout_session
object | null
required

Checkout session of the subscription.

payment_method_type
enum<string> | null
required

Payment method type used to pay the subscription.

Available options:
card,
direct_debit,
direct_debit_ach,
direct_debit_bacs,
transfer,
transfer_automated,
external
payment_method
object | null
required

Payment method details used to pay the subscription.

generate_draft_invoices
boolean
required

Generate draft invoices for the subscription. Each invoice will need to be reviewed and validated manually before being sent