I managed to get a step forward following this newer documentation marked as beta release:
The key was to add subscription_plan_variations to my SUBSCRIPTION_PLAN object. I then needed to use the subscription_variation_id in the Create Payment Link API Post. Confusingly the field is named subscription_plan_id so watch out for that one!
I previewed the payment link but noticed there’s nothing to indicate to the user that it’s a monthly payment. Am I doing something wrong? I’ve tried using the quick pay and order sections but get the same result.
Here’s the body for my batch upsert for the catalog objects:
“batches” : [
{
“objects”: [
{
“id”: “#1”,
“type”: “ITEM”,
“item_data”: {
“product_type”: “DIGITAL”,
“name”: “My Subscription”,
“variations”: [
{
“id”: “#var”,
“type”: “ITEM_VARIATION”,
“item_variation_data”: {
“name”: “Subscription”,
“price_money”: {
“amount”: 1000,
“currency”: “USD”
}
}
}
]
}
},
{
“type”: “SUBSCRIPTION_PLAN”,
“id”: “#plan”,
“subscription_plan_data”: {
“name”: “My Subscription”,
“all_items”: False,
“subscription_plan_variations”: [
{
“id”: “#2”,
“type”: “SUBSCRIPTION_PLAN_VARIATION”,
“subscription_plan_variation_data”: {
“name”: “Starter”,
“phases”: [
{
“cadence”: “DAILY”,
“ordinal”: 0,
“periods”: 14,
“pricing”: {
“type”: “STATIC”,
“price”: {
“amount”: 0,
“currency”: “USD”
}
}
},
{
“cadence”: “MONTHLY”,
“ordinal”: 1,
“pricing”: {
“type”: “STATIC”,
“price”: {
“amount”: 2000,
“currency”: “USD”
}
}
}
]
}
}]
}
}
]
}
Here’s the body for my create payment link call:
{
“idempotency_key”: str(uuid4()),
“checkout_options”: {
“subscription_plan_id”: subscription_variation_id,
“redirect_url”: ‘https://my.website’,
},
“order”: {
“location_id”: “XXXXXXX”,
“line_items”: [
{
“quantity”: ‘1’,
“catalog_object_id” : catalog_object_variation_id,
},
],
}
}