Create Subscription
subscriptions.create(SubscriptionCreateParams**kwargs) -> SubscriptionCreateResponse
/subscriptions
Create Subscription
Parameters
rate_card_id: str
The ID of the rate card to use for the subscription.
subject_id: str
The ID or external ID of the subject to create the subscription for.
metadata: Optional[Dict[str, str]]
Additional metadata about the subscription. You may use this to store any custom data about the subscription.
subscription_timeline_id: Optional[str]
The ID of the subscription timeline to use for the subscription.
Returns
Create Subscription
import os
from lark import Lark
client = Lark(
api_key=os.environ.get("LARK_API_KEY"), # This is the default and can be omitted
)
subscription = client.subscriptions.create(
rate_card_id="rc_AJWMxR81jxoRlli6p13uf3JB",
subject_id="subj_VyX6Q96h5avMho8O7QWlKeXE",
checkout_callback_urls={
"cancelled_url": "https://example.com/try-again",
"success_url": "https://example.com/welcome",
},
fixed_rate_quantities={
"seats": "2",
"addon_storage": "0",
},
metadata={},
rate_price_multipliers={
"seats": "0.5"
},
)
print(subscription.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"
}
}