Skip to content

Payment

ShipSaaS supports multiple payment providers, allowing you to choose the payment solution that best fits your needs.

  • 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.

ShipSaaS supports extending and integrating new payment providers:

  1. Create a new file in the src/payment/provider directory.
  2. Implement the PaymentProvider interface from types.ts.
  3. Register your new provider in the providerRegistry within index.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(),
};