One credit ledger for Stripe, PayPal, Waffo and Dodo Payments
Stripe is where most SaaS starters begin, but one provider is rarely enough. Stripe doesn't accept merchants in every country, many buyers would rather pay with PayPal, and selling worldwide means collecting sales tax and VAT. A merchant of record such as Dodo Payments sells on your behalf and handles that tax for you. So most paid tools end up needing more than one provider, and each provider added is another set of webhooks, refunds and edge cases to get right.
SaaScaffold takes payments through Stripe, PayPal, Waffo and Dodo Payments. All four share one order flow and one credit ledger, so a refund, a renewal or a missing webhook looks the same whichever provider handled it.
From checkout to credits
Every provider goes through the same five steps:
- Snapshot the order. Product, price, currency, provider and environment are saved on the server before the checkout opens.
- Verify the notification. Webhooks are signature-checked and matched against the saved order.
- Apply each event once. An event is stored before it is applied, so a repeated notification is recognised and ignored.
- Pay and grant together. The payment and its credits are written in one atomic step.
- Never trust the return page. Coming back from checkout is not proof of payment; the site checks the order with the provider from the server.
Three payment modes
A site-wide mode decides who can buy, separately from each provider's test and live connection:
off: no new orders. Existing orders, renewals and refunds keep working.admin_test: only administrators can buy, through the test connection.live: customers buy for real. Administrators can still choose the test path.
Subscriptions on all four
Monthly and yearly plans work on all four channels. Renewals are booked from the provider's own billing records, and late notifications are matched to the right period. A whole billing period can be refunded through the provider.
Adding another provider
A provider SaaScaffold doesn't ship goes into your own site files, so base updates never touch it:
- Declare it in
apps/web/src/site/payment-channels.ts: an ID, a label and the format of its product IDs. - Write the adapter in
apps/web/src/site/payments/<id>.server.ts: create a checkout, read its status, verify and parse webhooks, and refund. Add the subscription methods only if the provider bills recurring plans itself. - Register the adapter in
apps/web/src/site/payment-channels.server.ts.
The new provider gets the same rules as the built-in four. A payment is granted only when it matches the order's price and currency. Each order is granted once. Lost webhooks are recovered by reading the checkout back from the provider. A refund or dispute made in the provider's dashboard holds the order for review. A contract check in the test suite lists any fact your adapter fails to report.
The order flow, the ledger and refunds need no changes. A coding agent can do the whole job from the runbook that ships with the code (agents/payments/add-a-payment-method.md).
More on payments in SaaScaffold.