interface PaymentProvider

Payment provider interface.

Each provider (Stripe, Square, etc.) implements this interface. Routes call these methods without knowing which provider is active.

Properties

Provider identifier

The webhook event type name that indicates a completed checkout

Methods

createCheckoutSession(
event: Event,
baseUrl: string,
): Promise<CheckoutSessionResult>

Create a checkout session for a single-event purchase. Returns a session ID and hosted checkout URL, or null on failure.

Create a checkout session for a multi-event purchase. Returns a session ID and hosted checkout URL, or null on failure.

retrieveSession(sessionId: string): Promise<ValidatedPaymentSession | null>

Retrieve and validate a completed checkout session by ID. Returns the validated session or null if not found / invalid.

verifyWebhookSignature(
payload: string,
signature: string,
webhookUrl: string,
payloadBytes: Uint8Array,
): Promise<WebhookVerifyResult>

Verify a webhook request's signature and parse the event payload.

refundPayment(paymentReference: string): Promise<boolean>

Refund a completed payment.

setupWebhookEndpoint(
secretKey: string,
webhookUrl: string,
existingEndpointId?: string | null,
): Promise<WebhookSetupResult>

Set up a webhook endpoint for this provider. Some providers (e.g. Stripe) support programmatic creation.

isPaymentRefunded(paymentReference: string): Promise<boolean>

Check if a payment has been refunded via the provider API. Used to refresh refund status from the edit attendee page.