Paddle

SaaSBold comes with Paddle integration to manage subscriptions. This part of the documentation will show you how to integrate Paddle into your SaaS boilerplate.

Overview

Paddle provides a comprehensive solution for handling subscriptions and payments in your SaaS application. This guide will walk you through the steps to set up Paddle, including creating products, generating required tokens, and configuring webhooks.

Note: If you want to use another payment provider option for integration, skip this step. Instead, follow the LemonSqueezy guide or Stripe guide to integrate subscriptions.

Steps to Integrate Paddle

To integrate Paddle, you need a Paddle account. For testing purposes, you can create a Sandbox account. When you are done testing, replace the credentials with the live account's credentials.

Create Product

To begin integrating Paddle, you need to create a product:

  1. Login to Paddle: Log in to your Paddle account.

  2. Navigate to Catalog: Go to Catalog -> Products , and click on the "New Product" button and add the products.

Once you have created a product, you will see the product like this:

  1. Set Pricing: After creating the product, click the "View" button. Then click on the "New Price" button and add pricing details.

Copy Price ID: Once you are done, your product page should look like this.

Copy Price ID: Copy the price_id, update the pricingData.ts file, and update the unit_amount to your price.


Get The Seller ID

You need the Seller ID to enable checkout on the boilerplate.

Find Seller ID: To find the Seller ID, Log in to your account, click on the three dots, and you will see the Seller ID there.

Update Environment Variable: Go ahead and copy the Seller ID and update your environment variable:

NEXT_PUBLIC_PADDLE_VENDOR_ID="YOUR_SELLER_ID"

Generate Client Token

Now, we need a client-side token for authentication:

Generate Token: Navigate to Developer Tools -> Authentication -> Generate client-side-token. Generate a Client-side token if you donโ€™t have one.

Copy Token: Copy the generated token and update your environment variable:

NEXT_PUBLIC_PADDLE_CLIENT_TOKEN="YOUR_CLIENT_SIDE_TOKEN"

API Key

Now, we need the API token to perform API requests with the Paddle API.

Generate API Key: Go to Developer Tools -> Authentication -> API Keys and generate a key.

Copy API Key: Copy the API key and update your environment variable:

PADDLE_API_KEY="YOUR_API_KEY"

Webhook Integration

Now that we have all the keys, letโ€™s integrate Webhook to save the subscription data on the Database.

Add Webhook: Navigate to Developer Tools -> Notifications , and click on the "New Destination" button.

  1. Webhook Details: Provide a short description and add the Webhook URL, which is:

yoursite.com/api/paddle/webhook

Select Events: Finally, select the events, for now, you can select all. You can disable the one you donโ€™t need later. Once you are done, click on the Edit Destination button. You will see a Secret Key there.

Copy Secret Key: After saving, copy the Secret Key and update your environment variable:

PADDLE_WEBHOOK_SECRET="YOUR_WEBHOOK_SECRET"

Paddle API URL

Finally, we need the Paddle API URL.

Paddle provides separate APIs for live and sandbox ( for Testing) environments.

//Live API url
NEXT_PUBLIC_PADDLE_API_URL="https://api.paddle.com/"

//Sandbox API url
NEXT_PUBLIC_PADDLE_API_URL="https://sandbox-api.paddle.com"

Tips

  • Testing: Always test your integration thoroughly in the sandbox environment before switching to the live environment.

  • Documentation: Refer to Paddleโ€™s official documentation for detailed guidance and troubleshooting.

  • Security: Ensure all API keys and secrets are stored securely and not exposed.

  • Event Selection: Carefully select the webhook events relevant to your application to avoid unnecessary data processing.

Summary

By following these steps, you will have integrated Paddle into your SaaSBold boilerplate, enabling robust subscription management. Test the integration thoroughly using the sandbox environment before moving to the live environment.

Last updated