Payment
ShipSaaS supports multiple payment providers, allowing you to choose the payment solution that best fits your needs.
Payment Providers
Section titled “Payment Providers”- Stripe - The world’s most popular payment platform, supporting both one-time payments and subscriptions.
- Creem - A payment platform designed for indie hackers, featuring built-in tax compliance and subscription management.
Customizing Payment Providers
Section titled “Customizing Payment Providers”ShipSaaS supports extending and integrating new payment providers:
- Create a new file in the
src/payment/providerdirectory. - Implement the
PaymentProviderinterface fromtypes.ts. - Register your new provider in the
providerRegistrywithinindex.ts.
Example implementation of a new payment provider:
src/payment/provider/my-provider.ts
import type { PaymentProvider, CreateCheckoutParams, CheckoutResult, CreatePortalParams, PortalResult,} from '../types';
export class MyProvider implements PaymentProvider { getProviderName(): string { return 'my-provider'; }
public async createCheckout(params: CreateCheckoutParams): Promise<CheckoutResult> { // Create checkout session implementation }
public async createCustomerPortal(params: CreatePortalParams): Promise<PortalResult> { // Create customer portal implementation }
public async handleWebhookEvent(payload: string, signature: string): Promise<void> { // Handle webhook events implementation }}Then register the new provider in the providerRegistry in index.ts:
src/payment/index.ts
import { MyProvider } from './provider/my-provider';
const providerRegistry: Record<PaymentProviderName, ProviderFactory> = { stripe: () => new StripeProvider(), creem: () => new CreemProvider(), 'my-provider': () => new MyProvider(),};