import { QZPayPaymentCustomerAdapter, QZPayProviderCreateCustomerInput, QZPayProviderCustomer, QZPayPaymentSubscriptionAdapter, QZPayProviderCreateSubscriptionInput, QZPayProviderSubscription, QZPayUpdateSubscriptionInput, QZPayPaymentPaymentAdapter, QZPayCreatePaymentInput, QZPayProviderPayment, QZPayRefundInput, QZPayProviderRefund, QZPayPaymentCheckoutAdapter, QZPayProviderCreateCheckoutInput, QZPayProviderCheckout, QZPayPaymentPriceAdapter, QZPayCreatePriceInput, QZPayProviderPrice, QZPayPaymentWebhookAdapter, QZPayWebhookEvent, QZPayPaymentVendorAdapter, QZPayVendor, QZPayProviderPayout, QZPaySetupIntentAdapter, QZPayCreateSetupIntentInput, QZPayProviderSetupIntent, QZPayConfirmSetupIntentInput, QZPayPaymentAdapter, SavedCardServiceConfig, SavedCardService, SavedCardServiceStripeConfig, SaveCardInput, SavedCard } from '@qazuor/qzpay-core'; import Stripe from 'stripe'; export { Stripe } from 'stripe'; /** * Retry Utilities with Exponential Backoff * * Provides retry logic for transient errors with configurable exponential backoff. * Only retries on errors that are likely to succeed on retry (network, rate limiting, server errors). */ /** * Retry configuration options */ interface RetryConfig { /** * Enable or disable retry logic * @default true */ enabled: boolean; /** * Maximum number of retry attempts * @default 3 */ maxAttempts: number; /** * Initial delay in milliseconds before first retry * @default 1000 (1 second) */ initialDelayMs: number; /** * Maximum delay in milliseconds between retries * @default 8000 (8 seconds) */ maxDelayMs: number; /** * Backoff multiplier (delay doubles each retry by default) * @default 2 */ backoffMultiplier: number; /** * Custom logger function for retry attempts */ logger?: (message: string, context: Record) => void; } /** * Default retry configuration */ declare const DEFAULT_RETRY_CONFIG: RetryConfig; /** * Check if error is retriable (transient error that might succeed on retry) * * Retriable errors: * - Network errors / timeouts * - Rate limiting (429) * - Server errors (5xx) * * Non-retriable errors: * - Validation errors (400) * - Authentication (401, 403) * - Not found (404) * - Card errors */ declare function isRetriableError(error: unknown): boolean; /** * Execute operation with retry logic * * @param operation - Async operation to execute * @param config - Retry configuration * @param context - Context string for logging (e.g., "Create payment") * @returns Result of the operation * @throws Last error if all retries fail * * @example * ```typescript * const result = await withRetry( * () => stripe.paymentIntents.create(params), * { maxAttempts: 3, initialDelayMs: 1000 }, * "Create PaymentIntent" * ); * ``` */ declare function withRetry(operation: () => Promise, config?: Partial, context?: string): Promise; /** * Create a retry wrapper function with preset configuration * * @param config - Default retry configuration * @returns Function to execute operations with retry * * @example * ```typescript * const retryFn = createRetryWrapper({ maxAttempts: 5 }); * const result = await retryFn(() => apiCall(), "API Call"); * ``` */ declare function createRetryWrapper(config?: Partial): (operation: () => Promise, context?: string) => Promise; declare class QZPayStripeCustomerAdapter implements QZPayPaymentCustomerAdapter { private readonly stripe; private readonly retryConfig?; constructor(stripe: Stripe, retryConfig?: Partial | undefined); /** * Create a customer in Stripe */ create(input: QZPayProviderCreateCustomerInput): Promise; /** * Update a customer in Stripe */ update(providerCustomerId: string, input: Partial): Promise; /** * Delete a customer in Stripe */ delete(providerCustomerId: string): Promise; /** * Retrieve a customer from Stripe */ retrieve(providerCustomerId: string): Promise; } declare class QZPayStripeSubscriptionAdapter implements QZPayPaymentSubscriptionAdapter { private readonly stripe; private readonly retryConfig?; constructor(stripe: Stripe, retryConfig?: Partial | undefined); /** * Create a subscription in Stripe. * * Reads `providerCustomerId`, `providerPriceId`, and the original * `input.quantity` / `input.trialDays` / `input.metadata` from the * orchestrator-resolved input. Fields specific to MercadoPago preapprovals * (`backUrl`, `notificationUrl`, `freeTrialDays`, etc.) are intentionally * ignored — Stripe handles those differently (default payment method on * customer, webhook endpoints configured at account level, trial via * `trial_period_days`). */ create(providerInput: QZPayProviderCreateSubscriptionInput): Promise; /** * Update a subscription in Stripe */ update(providerSubscriptionId: string, input: QZPayUpdateSubscriptionInput): Promise; /** * Cancel a subscription in Stripe */ cancel(providerSubscriptionId: string, cancelAtPeriodEnd: boolean): Promise; /** * Pause a subscription in Stripe * Note: Stripe uses "pause_collection" to pause billing */ pause(providerSubscriptionId: string): Promise; /** * Resume a paused subscription in Stripe */ resume(providerSubscriptionId: string): Promise; /** * Reverse a period-end soft-cancel in Stripe: clear `cancel_at_period_end`. * * The exact inverse of {@link cancel}(id, true) (which sets * `cancel_at_period_end: true`), so Stripe no longer terminates the * subscription at period end. This is a DIFFERENT axis from * {@link pause}/{@link resume} (which use `pause_collection`), so `uncancel` * must not be conflated with `resume`. */ uncancel(providerSubscriptionId: string): Promise; /** * Retrieve a subscription from Stripe */ retrieve(providerSubscriptionId: string): Promise; /** * Map Stripe subscription to QZPay provider subscription */ private mapSubscription; } declare class QZPayStripePaymentAdapter implements QZPayPaymentPaymentAdapter { private readonly stripe; private readonly retryConfig?; constructor(stripe: Stripe, retryConfig?: Partial | undefined); /** * Create a payment (PaymentIntent) in Stripe */ create(providerCustomerId: string, input: QZPayCreatePaymentInput): Promise; /** * Capture a payment in Stripe */ capture(providerPaymentId: string): Promise; /** * Cancel a payment in Stripe */ cancel(providerPaymentId: string): Promise; /** * Create a refund in Stripe */ refund(input: QZPayRefundInput, providerPaymentId: string): Promise; /** * Retrieve a payment from Stripe */ retrieve(providerPaymentId: string): Promise; /** * Map Stripe PaymentIntent to QZPay provider payment */ private mapPaymentIntent; /** * Map Stripe PaymentIntent status to string */ private mapPaymentIntentStatus; /** * Map QZPay refund reason to Stripe reason */ private mapRefundReason; } declare class QZPayStripeCheckoutAdapter implements QZPayPaymentCheckoutAdapter { private readonly stripe; constructor(stripe: Stripe); /** * Create a Checkout Session in Stripe */ create(roro: QZPayProviderCreateCheckoutInput): Promise; /** * Retrieve a Checkout Session from Stripe */ retrieve(providerSessionId: string): Promise; /** * Expire a Checkout Session in Stripe */ expire(providerSessionId: string): Promise; /** * Map Stripe Checkout Session to QZPay provider checkout */ private mapSession; } declare class QZPayStripePriceAdapter implements QZPayPaymentPriceAdapter { private readonly stripe; constructor(stripe: Stripe); /** * Create a price in Stripe */ create(input: QZPayCreatePriceInput, providerProductId: string): Promise; /** * Archive a price in Stripe */ archive(providerPriceId: string): Promise; /** * Retrieve a price from Stripe */ retrieve(providerPriceId: string): Promise; /** * Create a product in Stripe */ createProduct(name: string, description?: string): Promise; /** * Map Stripe price to QZPay provider price */ private mapPrice; /** * Map QZPay interval to Stripe interval */ private mapInterval; } declare class QZPayStripeWebhookAdapter implements QZPayPaymentWebhookAdapter { private readonly stripe; private readonly webhookSecret; constructor(stripe: Stripe, webhookSecret: string, _retryConfig?: Partial); /** * Construct and verify a webhook event from Stripe * * Note: This method does not use retry logic because: * 1. Signature verification is deterministic (succeeds or fails immediately) * 2. Webhook payloads should be processed exactly once * 3. Stripe will retry failed webhooks automatically */ constructEvent(payload: string | Buffer, signature: string): QZPayWebhookEvent; /** * Verify webhook signature */ verifySignature(payload: string | Buffer, signature: string): boolean; } /** * Map Stripe webhook event type to QZPay billing event */ declare function mapStripeEventToQZPayEvent(stripeEventType: string): string | null; /** * Extract relevant data from Stripe webhook event */ declare function extractStripeEventData(event: QZPayWebhookEvent): { entityType: string; entityId: string; customerId?: string; subscriptionId?: string; invoiceId?: string; paymentIntentId?: string; }; /** * 3DS authentication status */ type QZPayStripe3DSStatus = 'not_required' | 'required' | 'succeeded' | 'failed' | 'processing' | 'unknown'; /** * 3DS authentication result */ interface QZPayStripe3DSResult { status: QZPayStripe3DSStatus; paymentIntentId: string; clientSecret?: string; nextActionUrl?: string; nextActionType?: string; authenticationFlow?: string; outcome?: { networkStatus?: string; riskLevel?: string; riskScore?: number; sellerMessage?: string; }; } /** * Check if a payment intent requires 3DS authentication */ declare function isPaymentRequires3DS(event: QZPayWebhookEvent): boolean; /** * Extract 3DS authentication details from payment intent event */ declare function extract3DSDetails(event: QZPayWebhookEvent): QZPayStripe3DSResult; /** * Dispute status */ type QZPayStripeDisputeStatus = 'warning_needs_response' | 'warning_under_review' | 'warning_closed' | 'needs_response' | 'under_review' | 'charge_refunded' | 'won' | 'lost'; /** * Dispute reason categories */ type QZPayStripeDisputeReason = 'bank_cannot_process' | 'check_returned' | 'credit_not_processed' | 'customer_initiated' | 'debit_not_authorized' | 'duplicate' | 'fraudulent' | 'general' | 'incorrect_account_details' | 'insufficient_funds' | 'product_not_received' | 'product_unacceptable' | 'subscription_canceled' | 'unrecognized'; /** * Dispute details extracted from webhook event */ interface QZPayStripeDisputeDetails { disputeId: string; chargeId: string; paymentIntentId?: string; amount: number; currency: string; status: QZPayStripeDisputeStatus; reason: QZPayStripeDisputeReason; isChargeRefundable: boolean; hasEvidence: boolean; evidenceDueBy?: Date; created: Date; metadata?: Record; } /** * Check if event is a dispute event */ declare function isDisputeEvent(event: QZPayWebhookEvent): boolean; /** * Extract dispute details from webhook event */ declare function extractDisputeDetails(event: QZPayWebhookEvent): QZPayStripeDisputeDetails; /** * Pending update details */ interface QZPayStripePendingUpdate { subscriptionId: string; expiresAt?: Date; subscriptionItems?: Array<{ id: string; priceId: string; quantity: number; }>; billingCycleAnchor?: Date; prorationBehavior?: 'create_prorations' | 'none' | 'always_invoice'; trialEnd?: Date; } /** * Check if event is a pending update event */ declare function isPendingUpdateEvent(event: QZPayWebhookEvent): boolean; /** * Extract pending update details from subscription event */ declare function extractPendingUpdateDetails(event: QZPayWebhookEvent): QZPayStripePendingUpdate | null; /** * Early fraud warning details */ interface QZPayStripeFraudWarning { warningId: string; chargeId: string; paymentIntentId?: string; fraudType: string; actionable: boolean; created: Date; } /** * Check if event is a fraud warning event */ declare function isFraudWarningEvent(event: QZPayWebhookEvent): boolean; /** * Extract fraud warning details */ declare function extractFraudWarningDetails(event: QZPayWebhookEvent): QZPayStripeFraudWarning; /** * Event categories for routing */ type QZPayStripeEventCategory = 'customer' | 'subscription' | 'payment' | 'invoice' | 'checkout' | 'dispute' | 'refund' | 'vendor' | 'fraud' | 'billing_portal' | 'other'; /** * Classify a webhook event into a category */ declare function classifyStripeEvent(eventType: string): QZPayStripeEventCategory; /** * Check if event requires immediate action */ declare function requiresImmediateAction(event: QZPayWebhookEvent): boolean; declare class QZPayStripeVendorAdapter implements QZPayPaymentVendorAdapter { private readonly stripe; constructor(stripe: Stripe); /** * Create a Connect account in Stripe */ createAccount(vendor: QZPayVendor): Promise; /** * Update a Connect account in Stripe */ updateAccount(providerAccountId: string, vendor: Partial): Promise; /** * Delete a Connect account in Stripe */ deleteAccount(providerAccountId: string): Promise; /** * Create a payout to a Connect account */ createPayout(providerAccountId: string, amount: number, currency: string): Promise; /** * Retrieve a payout from Stripe */ retrievePayout(providerPayoutId: string): Promise; /** * Create a transfer to a Connect account */ createTransfer(providerAccountId: string, amount: number, currency: string, paymentId: string): Promise; /** * Create an account link for onboarding */ createAccountLink(providerAccountId: string, refreshUrl: string, returnUrl: string, type?: 'account_onboarding' | 'account_update'): Promise; /** * Create a login link for an Express account */ createLoginLink(providerAccountId: string): Promise; /** * Retrieve account details */ retrieveAccount(providerAccountId: string): Promise<{ id: string; chargesEnabled: boolean; payoutsEnabled: boolean; detailsSubmitted: boolean; }>; } /** * Stripe Setup Intent Adapter * * Implements QZPaySetupIntentAdapter for Stripe. * Allows saving payment methods for future use without charging immediately. */ declare class QZPayStripeSetupIntentAdapter implements QZPaySetupIntentAdapter { private readonly stripe; constructor(stripe: Stripe); /** * Create a new Setup Intent in Stripe */ create(input: QZPayCreateSetupIntentInput): Promise; /** * Retrieve an existing Setup Intent from Stripe */ retrieve(setupIntentId: string): Promise; /** * Confirm a Setup Intent */ confirm(input: QZPayConfirmSetupIntentInput): Promise; /** * Cancel a Setup Intent */ cancel(setupIntentId: string): Promise; /** * Update a Setup Intent */ update(setupIntentId: string, updates: Partial>): Promise; /** * Map Stripe SetupIntent to QZPay provider setup intent */ private mapSetupIntent; } /** * Stripe adapter configuration types */ /** * Configuration options for the Stripe adapter */ interface QZPayStripeConfig { /** * Stripe secret key (sk_live_* or sk_test_*) * * @remarks * Must start with 'sk_' prefix. Validated at adapter initialization. * * @throws {Error} If key does not start with 'sk_' */ secretKey: string; /** * Webhook signing secret (whsec_*) * * @remarks * Must start with 'whsec_' prefix. Validated at adapter initialization. * * @throws {Error} If secret does not start with 'whsec_' */ webhookSecret: string; /** * Stripe API version to use */ apiVersion?: Stripe.LatestApiVersion; /** * Additional Stripe client options */ stripeOptions?: Stripe.StripeConfig; /** * Retry configuration for transient errors * * @remarks * Automatically retries operations that fail due to: * - Network errors / timeouts * - Rate limiting (429) * - Server errors (5xx) * * Does NOT retry: * - Validation errors (400) * - Authentication errors (401, 403) * - Not found errors (404) * - Card errors * * @default { enabled: true, maxAttempts: 3, initialDelayMs: 1000 } */ retry?: Partial; } /** * Stripe Connect configuration for marketplace */ interface QZPayStripeConnectConfig { /** * Platform account ID */ platformAccountId?: string; /** * Default application fee percentage (0-100) */ applicationFeePercent?: number; /** * Minimum payout amount in cents */ minPayoutAmount?: number; /** * Default payout schedule */ payoutSchedule?: 'daily' | 'weekly' | 'monthly'; } /** * Stripe webhook event types mapped to QZPay events */ type QZPayStripeWebhookEventType = 'customer.created' | 'customer.updated' | 'customer.deleted' | 'customer.subscription.created' | 'customer.subscription.updated' | 'customer.subscription.deleted' | 'customer.subscription.trial_will_end' | 'invoice.created' | 'invoice.finalized' | 'invoice.paid' | 'invoice.payment_failed' | 'invoice.payment_action_required' | 'payment_intent.succeeded' | 'payment_intent.payment_failed' | 'payment_intent.canceled' | 'charge.refunded' | 'checkout.session.completed' | 'checkout.session.expired' | 'account.updated' | 'payout.paid' | 'payout.failed'; /** * Mapped webhook event data */ interface QZPayStripeWebhookData { eventType: QZPayStripeWebhookEventType; stripeEventId: string; stripeObjectId: string; data: Record; createdAt: Date; } /** * Per-payment Connect/Marketplace options * * @remarks * These options allow specifying marketplace behavior on a per-payment basis. * Will be implemented in v2. * * @example * ```typescript * // v2 usage example: * const payment = await billing.payments.process({ * customerId: 'cust_123', * amount: 10000, * currency: 'USD', * connectOptions: { * destinationAccountId: 'acct_vendor123', * applicationFeeAmount: 500 // $5.00 platform fee * } * }); * ``` */ interface QZPayStripeConnectPaymentOptions { /** * Destination Connect account ID * The account that will receive the funds */ destinationAccountId?: string | undefined; /** * Application fee in cents * Amount collected by the platform */ applicationFeeAmount?: number | undefined; /** * On behalf of account * The Connect account that the payment is being made on behalf of */ onBehalfOf?: string | undefined; /** * Transfer data configuration * For more complex split scenarios */ transferData?: QZPayStripeTransferData | undefined; } /** * Transfer data for split payments */ interface QZPayStripeTransferData { /** * Destination account ID */ destination: string; /** * Specific amount to transfer (optional) * If not specified, the remaining amount after fees is transferred */ amount?: number | undefined; } /** * Stripe Payment Adapter for QZPay * * Provides full Stripe integration including: * - Customer management * - Subscription lifecycle * - One-time payments * - Checkout Sessions * - Products and Prices * - Webhook handling * - Connect/Marketplace (optional) * * @example * ```typescript * import { createQZPayStripeAdapter } from '@qazuor/qzpay-stripe'; * * const stripeAdapter = createQZPayStripeAdapter({ * secretKey: process.env.STRIPE_SECRET_KEY!, * webhookSecret: process.env.STRIPE_WEBHOOK_SECRET! * }); * * // Use with QZPay * const qzpay = new QZPay({ * paymentAdapter: stripeAdapter, * storage: storageAdapter * }); * ``` */ declare class QZPayStripeAdapter implements QZPayPaymentAdapter { readonly provider: "stripe"; readonly customers: QZPayStripeCustomerAdapter; readonly subscriptions: QZPayStripeSubscriptionAdapter; readonly payments: QZPayStripePaymentAdapter; readonly checkout: QZPayStripeCheckoutAdapter; readonly prices: QZPayStripePriceAdapter; readonly webhooks: QZPayStripeWebhookAdapter; readonly setupIntents: QZPayStripeSetupIntentAdapter; readonly vendors?: QZPayStripeVendorAdapter; private readonly stripe; constructor(config: QZPayStripeConfig, connectConfig?: QZPayStripeConnectConfig); /** * Get the underlying Stripe client for advanced operations */ getStripeClient(): Stripe; } /** * Create a QZPay Stripe adapter instance * * @param config - Stripe configuration options * @param connectConfig - Optional Stripe Connect configuration for marketplace * @returns Configured Stripe adapter * * @example * ```typescript * const adapter = createQZPayStripeAdapter({ * secretKey: 'sk_test_...', * webhookSecret: 'whsec_...' * }); * ``` */ declare function createQZPayStripeAdapter(config: QZPayStripeConfig, connectConfig?: QZPayStripeConnectConfig): QZPayStripeAdapter; /** * QZPay error codes */ declare enum QZPayErrorCode { CARD_DECLINED = "card_declined", INSUFFICIENT_FUNDS = "insufficient_funds", EXPIRED_CARD = "expired_card", INCORRECT_CVC = "incorrect_cvc", INCORRECT_NUMBER = "incorrect_number", INVALID_EXPIRY = "invalid_expiry", PROCESSING_ERROR = "processing_error", INVALID_REQUEST = "invalid_request", RESOURCE_NOT_FOUND = "resource_not_found", INVALID_PARAMETER = "invalid_parameter", RATE_LIMIT_EXCEEDED = "rate_limit_exceeded", API_ERROR = "api_error", CONNECTION_ERROR = "connection_error", TIMEOUT_ERROR = "timeout_error", AUTHENTICATION_REQUIRED = "authentication_required", AUTHENTICATION_FAILED = "authentication_failed", UNKNOWN_ERROR = "unknown_error" } /** * QZPay error class */ declare class QZPayError extends Error { code: QZPayErrorCode; statusCode: number; originalError?: unknown | undefined; constructor(code: QZPayErrorCode, message: string, statusCode?: number, originalError?: unknown | undefined); } /** * Map Stripe error to QZPay error */ declare function mapStripeError(error: unknown): QZPayError; /** * Wrap async function with error mapping */ declare function withErrorMapping Promise>(fn: T): (...args: Parameters) => Promise>; /** * Stripe Currency Utilities * * Validation utilities for Stripe-supported currencies */ /** * List of currencies supported by Stripe * * Reference: https://docs.stripe.com/currencies * Last updated: January 2025 */ declare const STRIPE_SUPPORTED_CURRENCIES: Set; /** * Validates if a currency code is supported by Stripe * * @param currency - The currency code to validate (e.g., 'USD', 'EUR') * @returns True if the currency is supported, false otherwise * * @example * ```ts * isValidStripeCurrency('USD') // true * isValidStripeCurrency('EUR') // true * isValidStripeCurrency('XYZ') // false * ``` */ declare function isValidStripeCurrency(currency: string): boolean; /** * Validates a currency and throws an error if not supported * * @param currency - The currency code to validate * @throws {Error} If the currency is not supported by Stripe * * @example * ```ts * validateStripeCurrency('USD') // No error * validateStripeCurrency('XYZ') // Throws error * ``` */ declare function validateStripeCurrency(currency: string): void; /** * Stripe Metadata Utilities * * Utilities for handling Stripe metadata with proper validation and limits * * STRIPE METADATA LIMITS: * - Maximum 50 keys per object * - Maximum 500 characters per value (after conversion to string) * - Keys must be strings * - Values are automatically converted to strings by Stripe * * Reference: https://docs.stripe.com/api/metadata */ /** * Stripe metadata constraints */ declare const STRIPE_METADATA_LIMITS: { readonly MAX_KEYS: 50; readonly MAX_VALUE_LENGTH: 500; }; /** * Converts QZPay metadata to Stripe-compatible format * * - Filters out undefined and null values * - Converts all values to strings * - Validates against Stripe metadata limits * * @param metadata - The metadata object to convert * @returns Stripe-compatible metadata object * @throws {Error} If metadata exceeds Stripe limits * * @example * ```ts * toStripeMetadata({ userId: 123, plan: 'premium' }) * // Returns: { userId: '123', plan: 'premium' } * * toStripeMetadata({ active: true, createdAt: new Date() }) * // Returns: { active: 'true', createdAt: '2025-01-15T...' } * ``` */ declare function toStripeMetadata(metadata: Record): Record; /** * Validates metadata against Stripe limits without conversion * * @param metadata - The metadata object to validate * @throws {Error} If metadata exceeds Stripe limits * * @example * ```ts * validateStripeMetadata({ userId: '123', plan: 'premium' }) // No error * validateStripeMetadata({ ...51 keys }) // Throws error * ``` */ declare function validateStripeMetadata(metadata: Record): void; /** * Stripe Saved Card Service Implementation * * Implements the unified SavedCardService interface for Stripe. * Uses Stripe's PaymentMethod API to save and manage cards. */ /** * Stripe implementation of SavedCardService */ declare class StripeSavedCardService implements SavedCardService { private readonly stripe; private readonly getProviderCustomerId; constructor(config: SavedCardServiceStripeConfig); /** * Save a payment method to a customer in Stripe */ save(input: SaveCardInput): Promise; /** * List all saved cards for a customer in Stripe */ list(customerId: string): Promise; /** * Remove a saved card from a customer in Stripe */ remove(customerId: string, cardId: string): Promise; /** * Set a card as the default payment method in Stripe */ setDefault(customerId: string, cardId: string): Promise; /** * Map Stripe PaymentMethod to SavedCard */ private mapToSavedCard; /** * Convert metadata to Stripe-compatible format */ private toStripeMetadata; } /** * Create a Stripe saved card service instance * * @param config - Stripe configuration * @returns SavedCardService instance for Stripe * * @example * ```typescript * const cardService = createSavedCardService({ * provider: 'stripe', * stripeSecretKey: 'sk_test_xxx', * getProviderCustomerId: async (customerId) => { * const customer = await db.customers.findById(customerId); * return customer.stripeCustomerId; * }, * }); * * // Save a card * const card = await cardService.save({ * customerId: 'local_cus_123', * paymentMethodId: 'pm_xxx', * setAsDefault: true, * }); * ``` */ declare function createSavedCardService(config: SavedCardServiceConfig): SavedCardService; export { DEFAULT_RETRY_CONFIG, QZPayError, QZPayErrorCode, type QZPayStripe3DSResult, type QZPayStripe3DSStatus, QZPayStripeAdapter, QZPayStripeCheckoutAdapter, type QZPayStripeConfig, type QZPayStripeConnectConfig, type QZPayStripeConnectPaymentOptions, QZPayStripeCustomerAdapter, type QZPayStripeDisputeDetails, type QZPayStripeDisputeReason, type QZPayStripeDisputeStatus, type QZPayStripeEventCategory, type QZPayStripeFraudWarning, QZPayStripePaymentAdapter, type QZPayStripePendingUpdate, QZPayStripePriceAdapter, QZPayStripeSetupIntentAdapter, QZPayStripeSubscriptionAdapter, type QZPayStripeTransferData, QZPayStripeVendorAdapter, QZPayStripeWebhookAdapter, type QZPayStripeWebhookData, type QZPayStripeWebhookEventType, type RetryConfig, STRIPE_METADATA_LIMITS, STRIPE_SUPPORTED_CURRENCIES, StripeSavedCardService, classifyStripeEvent, createQZPayStripeAdapter, createRetryWrapper, createSavedCardService, extract3DSDetails, extractDisputeDetails, extractFraudWarningDetails, extractPendingUpdateDetails, extractStripeEventData, isDisputeEvent, isFraudWarningEvent, isPaymentRequires3DS, isPendingUpdateEvent, isRetriableError, isValidStripeCurrency, mapStripeError, mapStripeEventToQZPayEvent, requiresImmediateAction, toStripeMetadata, validateStripeCurrency, validateStripeMetadata, withErrorMapping, withRetry };