ShipFree includes a flexible payment system that supports multiple payment providers through a unified adapter interface. Switch between providers without changing your application code.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/revokslab/shipfree/llms.txt
Use this file to discover all available pages before exploring further.
Supported Providers
Stripe
Industry-leading payment processor with global reach
Polar
Developer-friendly payment platform for digital products
Lemon Squeezy
Merchant of record platform handling taxes and compliance
Architecture Overview
The payment system uses an adapter pattern that provides a consistent interface across all providers:src/lib/payments/service.ts
Set
PAYMENT_PROVIDER in your .env file to choose your provider: stripe, polar, or lemonsqueezyPlans & Pricing
Plans are centrally configured insrc/config/payments.ts:
View Payment Configuration
View Payment Configuration
src/config/payments.ts
Accessing Plan Configuration
Database Schema
The payment system uses these tables (defined insrc/database/schema.ts):
- Customer
- Subscription
- Payment
src/database/schema.ts
Creating Checkout Sessions
Create a checkout session to accept payments:- Server Action
- API Route
- Client Component
src/app/actions/checkout.ts
Customer Portal
Let users manage their subscriptions via the provider’s hosted portal:src/app/actions/portal.ts
Webhook Handling
Configure Webhook Endpoint
Set up webhook endpoints in your payment provider dashboard pointing to:
- Stripe:
https://yourdomain.com/api/webhooks/stripe - Polar:
https://yourdomain.com/api/webhooks/polar - Lemon Squeezy:
https://yourdomain.com/api/webhooks/lemonsqueezy
Subscription Management
Check Active Subscription
Cancel Subscription
src/app/actions/subscription.ts
Payment Adapter Interface
All payment providers implement this interface:src/lib/payments/types.ts
Environment Variables
- Stripe
- Polar
- Lemon Squeezy
.env
Testing Payments
Use test mode credentials during development. Each provider offers test cards and environments.
Stripe Testing
Use test cards like
4242 4242 4242 4242Polar Testing
Polar provides a sandbox environment
Lemon Squeezy
Enable test mode in your store settings
Further Reading
Stripe Docs
Complete Stripe API documentation
Polar Docs
Polar developer documentation
Lemon Squeezy
Lemon Squeezy API reference
Webhook Best Practices
Learn about webhook security and reliability