Skip to main content
Paddle Billing is a merchant of record for selling digital products and subscriptions. It takes care of payments, global tax compliance, fraud prevention, localization, and subscriptions. Here’s how to switch the default payment processor from Stripe to Paddle Billing.

Get the api key

After you have created your account for Paddle, you will need to get the API key. You can do this by going to the API page in the dashboard. Here you will find the Secret key and the Publishable key. You will need the Secret key for the integration to work.

Add environment variables

To use the Paddle integration, you need to define the following environment variables to your .env.local as well as your production environment:
.env.local

In-App Purchases

You can use Paddle anywhere in your application by importing a paddle object:
page.tsx

Creating a Checkout Session

We need to create a checkout session to charge your users , and you only need modify some code. It consists of two parts:
  • Client
It sends a request to create a session to the /api/paddle/checkout endpoint.
apps/web/[locale]/components/payment/price-form.tsx
  • Server
Implementing business logic in apps/web/api/paddle/checkout/route.ts.
If you want create a checkout session in client side, you can use the following code:
apps/web/[locale]/components/payment/price-form.tsx