Skip to content
Book a demoContact usGet started

Start Subscription Timeline

subscription_timelines.start(strsubscription_timeline_id, SubscriptionTimelineStartParams**kwargs) -> SubscriptionTimelineStartResponse
post/subscription-timelines/{subscription_timeline_id}/start

Start Subscription Timeline

ParametersExpand Collapse
subscription_timeline_id: str
checkout_callback_urls: CheckoutCallbackParam

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

cancelled_url: str

The URL to redirect to after the checkout is cancelled.

minLength1
formaturi
success_url: str

The URL to redirect to after the checkout is successful.

minLength1
formaturi
create_checkout_session: Optional[Literal["when_required", "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[Union[str, datetime]]

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

formatdate-time
ReturnsExpand Collapse
class SubscriptionTimelineStartResponse:
result: Result

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:
class ResultStartSubscriptionTimelineRequiresActionResponse:
action: ResultStartSubscriptionTimelineRequiresActionResponseAction

The action to take to complete the request.

checkout_url: str

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

requires_action_type: Literal["checkout"]
result_type: Literal["requires_action"]
class ResultStartSubscriptionTimelineSuccessResponse:
result_type: Literal["success"]
subscription_timeline: ResultStartSubscriptionTimelineSuccessResponseSubscriptionTimeline

The subscription timeline resource.

id: str
created_at: datetime
formatdate-time
rate_card_id: str
status: Literal["draft", "pending", "active", "completed"]
Accepts one of the following:
"draft"
"pending"
"active"
"completed"
subject_id: str
subscription_id: Optional[str]
updated_at: datetime
formatdate-time
Start Subscription Timeline
import os
from lark import Lark

client = Lark(
    api_key=os.environ.get("LARK_API_KEY"),  # This is the default and can be omitted
)
response = client.subscription_timelines.start(
    subscription_timeline_id="subscription_timeline_id",
    checkout_callback_urls={
        "cancelled_url": "https://example.com/callback",
        "success_url": "https://example.com/callback",
    },
)
print(response.result)
{
  "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"
  }
}