Co-authored by
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.
This guide is for Paddle Billing, which is the latest version of Paddle. It doesn’t include Paddle Classic.
1. Swap out the required dependencies
First, uninstall the existing dependencies from the Payments package…Terminal
Terminal
2. Update the Payment keys
Update the required Payment keys in thepackages/payments/keys.ts
file:
packages/payments/keys.ts
3. Update the environment variables
Next, update the environment variables across the project, replacing the existing Stripe keys with the new Paddle keys:apps/app/.env
4. Update the payments client
Initialize the payments client in thepackages/payments/index.ts
file with the new API key.
packages/payments/index.ts
5. Update the payments webhook handler
Remove the Stripe webhook handler from the API package…Terminal
apps/api/app/webhooks/paddle/route.ts
Webhooks Overview
Learn how to handle webhooks from Paddle Billing
Signature Verification
Learn how to verify webhooks from Paddle Billing
Simulate Webhooks
Learn how to send test webhooks from Paddle Billing
6. Create a Checkout hook
Create a new file forcheckout
and install paddle-js
:
Terminal
packages/payments/checkout.tsx
file:
packages/payments/checkout.tsx
7. Use the Checkout hook
Finally, open a checkout on your pricing page:apps/web/app/pricing/page.tsx