Subscription billing is common practise, especially for SaaS applications. This guide should serve as a basic integration guide on getting started with subscription billing.
For a more in-depth integration, check out our Full Integration Guide.
We’ve split the Quick Start guide into 3 primary sections:
- Creating Plans
- Subscribing Customers to Plans
- Keeping Your System In-sync
1 Creating Plans
A ‘Subscription Plan’ as you’ll hear it referred to within this guide is a billing cycle that a user can be subscribed to. For example: $30 per month. These plans are defined within the Subscription Plans area of your Paddle Dashboard.
From within the Subscription Plans section of your Paddle Dashboard click
"New Subscription Plan".
Once you have defined / saved all of the subscription plans you will need, you can proceed to the next section.
2 Subscribing Customers to Plans
To remove your application from any PCI compliance scope, Paddle hosts the checkout / card entry pages for subscriptions.
You can direct these users to these pages by clicking on the
Step 1: Grab your Checkout Link/ Checkout ID:
"Checkout Link" button next to your subscription plan, a dialog will open and here you’ll be able to find the Checkout Link and Checkout ID. You’ll need these for the next section.
Step 2: Send the User to the Checkout
The example below uses our Overlay Checkout (and assumes you’ve already included JQuery and our Checkout.js file on your page). We recommend passing in a User ID from your system via the
passthrough variable, so you can identify this subscription and attach it to a user later.
<a href="#" class="paddle_button" data-product="496305" data-success="/thank-you/" data-passthrough="123">Subscribe!</a>
In the above example
496305 is the ‘Checkout Product ID’ from the ‘Checkout Link’ popup for my subscription plan, and
123 is the ID of the user in my database. This User ID will be passed back to me with my subscription events, so I can easily associate subscription events with my users.
I’ve also included the parameter
success, which is where the user will be redirected after a successful subscription. I’ve chosen to redirect to
3 Keeping Your System In-sync
Now that you’ve subscribed a user to a plan, you need to keep your database in-sync with their subscription status.
We recommend subscribing to all of the subscription events via webhook, from the ‘Alerts’ section within your Paddle Dashboard.
Upon new subscription signup the
subscription_created is fired. From this event you can use the
passthrough variable we set during the checkout to identify the user in your system and give them access to your website / application accordingly. You should then add handling for the other subscription events, listed here.
You can find full documentation, including field / parameter references for each event in the Subscription Event/ Alert documentation.