Skip to content
Book a demoContact usGet started

Start Subscription Timeline

post/subscription-timelines/{subscription_timeline_id}/start

Start Subscription Timeline

Path ParametersExpand Collapse
subscription_timeline_id: string
Body ParametersExpand Collapse
checkout_callback_urls: CheckoutCallback { cancelled_url, success_url }

The URLs to redirect to after the checkout is completed or cancelled, if a checkout is required.

cancelled_url: string

The URL to redirect to after the checkout is cancelled.

minLength1
formaturi
success_url: string

The URL to redirect to after the checkout is successful.

minLength1
formaturi
create_checkout_session: optional "when_required" or "always"

Determines whether a checkout session is always required even if the subject has a payment method on file. By default, if the subject has a payment method on file, the subscription will be created and billed for immediately.

Accepts one of the following:
"when_required"
"always"
effective_at: optional string

When the subscription should become active. If not provided, the current date and time will be used.

formatdate-time
ReturnsExpand Collapse
result: object { action, result_type } or object { result_type, subscription_timeline }

The result of the request. If the request is successful, the subscription timeline resource will be returned. If the request is requires action, the action to take to complete the request will be returned.

Accepts one of the following:
RequiresAction = object { action, result_type }
action: object { checkout_url, requires_action_type }

The action to take to complete the request.

checkout_url: string

The URL of the checkout page to redirect to in order to complete the request.

requires_action_type: "checkout"
result_type: "requires_action"
Success = object { result_type, subscription_timeline }
result_type: "success"
subscription_timeline: object { id, created_at, rate_card_id, 4 more }

The subscription timeline resource.

id: string
created_at: string
formatdate-time
rate_card_id: string
status: "draft" or "pending" or "active" or "completed"
Accepts one of the following:
"draft"
"pending"
"active"
"completed"
subject_id: string
subscription_id: string
updated_at: string
formatdate-time
Start Subscription Timeline
curl https://api.uselark.ai/subscription-timelines/$SUBSCRIPTION_TIMELINE_ID/start \
    -H 'Content-Type: application/json' \
    -H "X-API-Key: $LARK_API_KEY" \
    -d '{
          "checkout_callback_urls": {
            "cancelled_url": "https://example.com/callback",
            "success_url": "https://example.com/callback"
          }
        }'
{
  "result": {
    "action": {
      "checkout_url": "checkout_url",
      "requires_action_type": "checkout"
    },
    "result_type": "requires_action"
  }
}
Returns Examples
{
  "result": {
    "action": {
      "checkout_url": "checkout_url",
      "requires_action_type": "checkout"
    },
    "result_type": "requires_action"
  }
}