POST
/
v1
/
subscriptions
curl --request POST \
  --url https://api.hyperline.co/v1/subscriptions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "renews_at": "2023-01-20T16:04:11Z",
  "starts_at": "2023-01-20T16:04:11Z",
  "trial_ends_at": "2023-01-20T16:04:11Z",
  "billing_plan_id": "<string>",
  "customer_id": "<string>",
  "billing_items": [
    {
      "id": "<string>",
      "count": 123
    }
  ],
  "checkout_session": {
    "available_payment_methods": [
      "card"
    ],
    "redirect_url": "<string>"
  },
  "coupons": [
    {
      "id": "<string>",
      "repeat": "once",
      "expires_at": "2023-01-20T16:04:11Z",
      "apply_at": "2023-01-20T16:04:11Z",
      "billing_item_ids": [
        "<string>"
      ]
    }
  ],
  "interval": "monthly",
  "start_automatically": true,
  "status": "active"
}'
{
  "id": "<string>",
  "cancel_at": "2023-01-20T16:04:11Z",
  "created_at": "2023-01-20T16:04:11Z",
  "current_period_ends_at": "2023-01-20T16:04:11Z",
  "current_period_started_at": "2023-01-20T16:04:11Z",
  "next_payment_at": "2023-01-20T16:04:11Z",
  "paused_at": "2023-01-20T16:04:11Z",
  "renews_at": "2023-01-20T16:04:11Z",
  "starts_at": "2023-01-20T16:04:11Z",
  "trial_ends_at": "2023-01-20T16:04:11Z",
  "purchase_order": "<string>",
  "updated_at": "2023-01-20T16:04:11Z",
  "billing_plan_id": "<string>",
  "billing_scenario_id": "<string>",
  "checkout_session_id": "<string>",
  "customer_id": "<string>",
  "last_invoice_id": "<string>",
  "currency": "EUR",
  "interval": "weekly",
  "invoice_schedule": "period_start",
  "start_automatically": true,
  "status": "active",
  "billing_items": [
    {
      "id": "<string>",
      "name": "<string>",
      "type": "flat_fee",
      "count": 123,
      "prices": [
        {
          "id": "<string>",
          "from": 123,
          "to": 123,
          "amount": 123,
          "unit_count": 123,
          "billing_item_id": "<string>",
          "currency": "EUR"
        }
      ],
      "attached_at": "2023-01-20T16:04:11Z",
      "detached_at": "2023-01-20T16:04:11Z"
    }
  ],
  "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"
  },
  "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",
      "billing_item_ids": [
        "<string>"
      ],
      "expires_at": "2023-01-20T16:04:11Z",
      "apply_at": "2023-01-20T16:04:11Z"
    }
  ],
  "payment_method_type": "card",
  "payment_method": {
    "id": "pm_1xMpj5bwRqN7LM",
    "type": "card",
    "last_4_digits": 2718,
    "expiration_date": "2026-11",
    "brand": "visa"
  },
  "plan": {
    "id": "<string>",
    "name": "<string>",
    "description": "<string>"
  },
  "scenario": {
    "id": "<string>",
    "name": "<string>",
    "description": "<string>"
  }
}

Authorizations

Authorization
string
headerrequired

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

Body

application/json
renews_at
string | null

UTC date time string in the ISO 8601 format.

starts_at
string
required

UTC date time string in the ISO 8601 format.

trial_ends_at
string | null

UTC date time string in the ISO 8601 format.

billing_plan_id
string
required
customer_id
string
required
billing_items
object[]
checkout_session
object
coupons
object[]
interval
enum<string>
required
Available options:
monthly,
quarterly,
yearly
start_automatically
boolean
default: true

Subscription will automatically start at the starts_at date. Use false to prevent auto start.

status
enum<string>
Available options:
active

Response

201 - application/json
id
string
required
cancel_at
string | null
required

UTC date time string in the ISO 8601 format.

created_at
string
required

UTC date time string in the ISO 8601 format.

current_period_ends_at
string | null
required

UTC date time string in the ISO 8601 format.

current_period_started_at
string | null
required

UTC date time string in the ISO 8601 format.

next_payment_at
string | null
required

UTC date time string in the ISO 8601 format.

paused_at
string | null
required

UTC date time string in the ISO 8601 format.

renews_at
string | null
required

UTC date time string in the ISO 8601 format.

starts_at
string | null
required

UTC date time string in the ISO 8601 format.

trial_ends_at
string | null
required

UTC date time string in the ISO 8601 format.

purchase_order
string | null
required
updated_at
string
required

UTC date time string in the ISO 8601 format.

billing_plan_id
string | null
required
billing_scenario_id
string | null
required
checkout_session_id
string | null
required
customer_id
string
required
last_invoice_id
string | null
required
currency
string
required

Currency code. See ISO 4217.

interval
enum<string> | null
required
Available options:
weekly,
monthly,
quarterly,
yearly,
once
invoice_schedule
enum<string> | null
required
Available options:
period_start,
period_end
start_automatically
boolean
required
status
enum<string>
required
Available options:
active,
cancelled,
draft,
errored,
paused,
pending,
trialing,
voided
billing_items
object[]
required
checkout_session
object | null
required
coupons
object[]
required
  • Option 1

  • Option 2

payment_method_type
enum<string> | null
required
Available options:
card,
direct_debit,
direct_debit_ach,
direct_debit_bacs,
transfer,
external
payment_method
object | null
required

Default payment method of the customer. Only applies to card and direct debit.

  • Option 1

  • Option 2

  • Option 3

plan
object | null
required
scenario
object
required