Payment
Learn how to set up and use payment in ShipTanStarter
ShipTanStarter supports multiple payment providers, allowing you to choose the best payment solution for your needs.
Payment Providers
Stripe
The most popular global payment platform, supporting one-time payments and subscriptions
Creem
Payment platform for indie developers with built-in tax compliance and subscription management
Custom Payment Provider
ShipTanStarter supports extending with new payment providers:
- Create a new file in the
src/payment/providerdirectory - Implement the
PaymentProviderinterface fromtypes.ts - Register the new provider in the
providerRegistryinindex.ts
Example implementation for a new payment provider:
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:
import { MyProvider } from './provider/my-provider';
const providerRegistry: Record<PaymentProviderName, ProviderFactory> = {
stripe: () => new StripeProvider(),
creem: () => new CreemProvider(),
'my-provider': () => new MyProvider(),
};