Payments
Supersaas comes with a unified payments componsable that works with both Stripe and Lemonsqueezy.
Users can create checkout links, manage their billing, cancel subscriptions, update payment methods etc.
Stripe
The most popular payment processor.
Lemonsqueezy
Payments platform that handles taxes as well.
Paddle
An alternative to Stripe and Lemonsqueezy.
The usePayments() composable
I thought a lot about how to make payments and billing easy for SaaS projects and I actually came up with a solution that I think is the best. It's a unified interface called usePayment().
I realised both Stripe and Lemonsqueezy do the same thing but with different APIs. I unified it into a single interface that you can use in your site.
All you have to do it just import the `usePayment()` composable and use it in your code and pass in the payment provider you want to use.
All you have to do it just import the `usePayment()` composable and use it in your code and pass in the payment provider you want to use.
Actions available
Method | Parameters | Returns |
---|---|---|
getAllPlans() | NA | Plans[] |
createCheckoutLink | options: { variantId: string; email?: string, name?: string, userId: string, redirectUrl?: string } | CheckoutLink |
createCustomerPortalLink | options: { id?: string | number, customerId: string, redirectUrl?: string, flowData?: FlowData, flow?: "update-plan" | "update-payment-info" | "cancel" } | CustomerPortalLink |
pauseSubscription | id: string | void |
cancelSubscription | id: string | void |
resumeSubscription | userId: string | void |
deleteOneTimePassword | id: string | void |
updateSubscription | id: string | void |
listAllTransactions | NA | Transaction[] |
getInvoice | invoiceId: string | InvoiceURL |