Create Subscription
Follow these steps in order. Each step names the API call it makes; open it in the API Reference to try it out in the API playground.
Subscription Management Guide
Introduction
This is a guided walkthrough showcasing Subscription Management in Maxio.
Learn how to create signups (also called subscriptions) by signing up customers to products on your site. Before proceeding, see the Subscription help article to learn the basics of how subscriptions work.
This guide walks you through the basics of creating subscriptions in Advanced Billing, though Advanced Billing can almost handle any scenario using API integration.
- Advanced Billing signup methods
- The payment methods available for subscriptions
- How to handle customers with multiple subscriptions
- Component quantities and how they can be used to customize billing
Step 1: Preview Subscription Order
First, let's preview the subscription order. This endpoint allows you to preview a subscription by POSTing the same JSON as used for subscription creation. A subscription will not be created by utilizing this endpoint; it is meant to serve as a prediction.
As a requirement, enter the \
API call: previewSubscription
Example arguments:
{
body: {
subscription: {
customer_attributes: {
first_name: "John",
last_name: "Doe",
email: "john.doe@example.com",
},
},
},
}Step 2: Create Subscription
Now it's time to create an actual Subscription.
Note that this time, payment information is mandatory. See the Payments Profile endpoint for details on payment parameters.
Never use real card information for testing. See the Sites articles that cover testing your site setup for more details on testing in your sandbox.
A customer record will be created together with the subscription, as you're providing the \
API call: createSubscription
Example arguments:
{
body: {
subscription: {
...step1State.requestData?.args?.body?.subscription,
customer_attributes: {
first_name: "John",
last_name: "Doe",
email: "John@example.com",
},
payment_collection_method: "remittance",
},
},
}Step 3: Pause Subscription
Next, explore more capabilities for managing the subscription lifecycle. You can put the subscription on hold so it won't renew. There is an option to set an automatic resumption date to a specific timestamp.
You have other options for managing the subscription lifecycle, including cancel, reactivate, and migrate.
After you successfully pause the subscription, notice the state changing to \
API call: pauseSubscription
Example arguments:
{
subscription_id: step2State?.data["subscription"]?.id,
body: {
hold: {
automatically_resume_at: null,
},
},
}You can resume a previously paused subscription. If the normal next renewal date has not passed, the subscription will return to active and will renew on that date. Otherwise, it will behave like a reactivation, setting the billing date to 'now' and charging the subscriber.
API call: resumeSubscription
Example arguments:
{
subscription_id: step2State?.data["subscription"]?.id,
}