export interface CheckoutParams { orderId: string; amount: number; currency?: string; description?: string; successUrl: string; cancelUrl: string; webhookUrl?: string; metadata?: Record; /** For subscription billing */ customerId?: string; priceId?: string; trialDays?: number; } export interface CheckoutResult { url: string | null; sessionId: string; } export interface CustomerParams { email: string; name: string; metadata?: Record; } export interface SubscriptionParams { customerId: string; priceId: string; trialDays?: number; metadata?: Record; } export interface SubscriptionResult { id: string; status: string; customerId: string; currentPeriodEnd?: string; } export interface RefundParams { paymentId: string; amount?: number; reason?: string; metadata?: Record; } export interface RefundResult { id: string; amount: number; status: string; } export interface InvoiceResult { id: string; amount: number; currency: string; status: string; paidAt?: string; pdfUrl?: string; } export interface WebhookEvent { type: string; data: Record; raw?: unknown; } /** * PaymentProvider — contract for all payment providers. * Implemented by: Satim, PayPal, Chargily, Stripe, Manual */ export interface PaymentProvider { readonly name: string; readonly supportedCurrencies: string[]; readonly supportedMethods: string[]; /** Create a checkout session (redirect user to payment page) */ createCheckout(params: CheckoutParams): Promise; /** Verify and parse a webhook payload */ /** * Vérifie et normalise un webhook. * * ⚠️ `headers` est FACULTATIF, et c'est délibéré : la plupart des banques signent avec **un** * en-tête, que `signature` suffit à porter. **PayPal en exige CINQ** (`paypal-transmission-id`, * `-time`, `-sig`, `-cert-url`, `paypal-auth-algo`) et les fait vérifier par son API. Sans ce * paramètre, sa vérification était impossible — et elle avait été laissée à « on fait confiance * au JSON », ce qui permettait de forger un paiement. * * Facultatif pour ne rompre aucun dialecte existant : ceux qui n'en ont pas besoin l'ignorent. */ verifyWebhook(body: string, signature: string, headers?: Headers | Record): Promise; /** Create a customer (optional — not all providers support) */ createCustomer?(params: CustomerParams): Promise; /** Get customer details */ getCustomer?(customerId: string): Promise>; /** Update customer */ updateCustomer?(customerId: string, params: Partial): Promise>; /** Create a subscription */ createSubscription?(params: SubscriptionParams): Promise; /** Get subscription details */ getSubscription?(subscriptionId: string): Promise; /** Cancel a subscription */ cancelSubscription?(subscriptionId: string, immediate?: boolean): Promise; /** Change subscription plan */ changeSubscription?(subscriptionId: string, newPriceId: string): Promise; /** Pause subscription */ pauseSubscription?(subscriptionId: string): Promise; /** Resume subscription */ resumeSubscription?(subscriptionId: string): Promise; /** Create a refund */ createRefund?(params: RefundParams): Promise; /** List invoices for a customer */ listInvoices?(customerId: string, limit?: number): Promise; /** Get upcoming invoice */ getUpcomingInvoice?(customerId: string): Promise; /** Create a billing portal session (self-service) */ createPortal?(customerId: string, returnUrl: string): Promise<{ url: string; }>; } //# sourceMappingURL=provider.interface.d.ts.map