Why Provider Abstraction?
Multi-Provider Support
Support multiple payment processors simultaneously for different markets
Vendor Independence
Switch providers without rewriting your entire billing stack
Unified API
One consistent API across all providers - no provider-specific quirks
Feature Parity
Graceful degradation when providers don’t support specific features
Provider Architecture
Revstack uses a plugin-based provider system: All providers implement the sameIProvider interface, ensuring consistent behavior.
Available Providers
Official Providers
Revstack maintains these production-ready providers:- Stripe
- Polar
Stripe - The most popular payment processor for SaaS.Capabilities:
- Checkout:
redirect(Stripe Checkout) ornative_sdk(Stripe Elements) - Subscriptions: Native billing engine with proration
- Payments: Full support including refunds, partial refunds, auth/capture
- Catalog: Inline pricing (no pre-creation needed)
- Webhooks: HMAC signature verification
Community Providers
Build your own provider for:- Regional payment gateways (Razorpay, Mercado Pago, etc.)
- Crypto payment processors (Coinbase Commerce, BTCPay)
- Custom billing systems
See the Custom Providers guide to build your own.
Provider Capabilities
Providers declare their capabilities via amanifest object:
Checkout Strategies
redirect: User is redirected to provider’s hosted checkout page (e.g., Stripe Checkout)- Easiest integration, full PCI compliance
- User leaves your domain
native_sdk: Embed provider’s payment form in your app (e.g., Stripe Elements)- User stays on your domain, seamless UX
- Requires client-side SDK integration
sdui: Server-Driven UI - provider returns JSON primitives, Revstack renders natively- Use case: Crypto payments, bank transfers (Pix, Boleto)
- No external scripts required
Subscription Modes
native: Provider acts as the billing engine- Provider handles recurring charges, retries, and proration
- Revstack mirrors state via webhooks
- Example: Stripe Billing, Polar Subscriptions
virtual: Revstack acts as the billing engine- Revstack runs the scheduler and triggers one-time payments
- Use case: Providers without native subscription support (e.g., simple gateways)
Configuring Providers
Providers are configured in your Revstack Cloud dashboard or via environment variables:.env
Provider Selection
For multi-provider setups, specify which provider to use:Provider Interface
All providers implement theIProvider interface:
BaseProvider Class
ExtendBaseProvider to inherit default implementations:
Error Handling
Providers returnAsyncActionResult for consistent error handling:
Webhook Handling
Providers translate webhook events to Revstack’s normalized event format:Testing Providers
Revstack provides a smoke test runner for validating provider implementations:- Webhook signature verification
- Event parsing
- Checkout session creation
- Subscription lifecycle (if supported)
- Refund processing (if supported)
Provider Comparison
| Feature | Stripe | Polar | Custom |
|---|---|---|---|
| Checkout Strategy | Redirect + Native SDK | Redirect | Varies |
| Subscription Mode | Native | Native | Virtual (Revstack-managed) |
| Proration | ✅ Automatic | ✅ Automatic | ❌ Manual |
| Pause/Resume | ✅ Yes | ❌ No | Depends |
| Refunds | ✅ Full + Partial | ✅ Full only | Depends |
| Auth/Capture | ✅ Yes | ❌ No | Depends |
| Billing Portal | ✅ Yes | ✅ Yes | ❌ No |
Next Steps
Custom Providers
Build your own provider for regional gateways
Billing as Code
Define your pricing model in TypeScript