import { OnModuleInit } from "@nestjs/common"; import type Stripe from "stripe"; /** * Stripe Service * * Core Stripe SDK initialization and configuration * * Features: * - Lazy Stripe SDK initialization * - Configuration validation * - Type-safe Stripe client access * - Webhook secret management * - Portal configuration * * @example * ```typescript * constructor(private readonly stripeService: StripeService) {} * * async createCustomer() { * const stripe = this.stripeService.getClient(); * return stripe.customers.create({ email: 'test@example.com' }); * } * ``` */ export declare class StripeService implements OnModuleInit { private stripe; private readonly stripeConfig; /** * Initialize Stripe SDK on module initialization * * Lazily loads the Stripe SDK and configures it with: * - API version: SDK default (pinned by the installed stripe package) unless STRIPE_API_VERSION is set * - TypeScript support enabled * - Max network retries: 3 * - Timeout: 30 seconds * * @remarks * If STRIPE_SECRET_KEY is not configured, logs a warning and disables Stripe features */ onModuleInit(): Promise; /** * Get the initialized Stripe client instance * * @returns Configured Stripe SDK instance * @throws Error if Stripe is not initialized (missing STRIPE_SECRET_KEY) * * @example * ```typescript * const stripe = this.stripeService.getClient(); * const customer = await stripe.customers.retrieve('cus_123'); * ``` */ getClient(): Stripe; /** * Check if Stripe SDK is initialized and configured * * @returns true if Stripe is configured and ready, false otherwise * * @example * ```typescript * if (this.stripeService.isConfigured()) { * // Stripe operations available * } * ``` */ isConfigured(): boolean; /** * Get the Stripe publishable key for frontend use * * Used to initialize Stripe.js on the frontend for collecting payment methods * * @returns Stripe publishable key (pk_test_... or pk_live_...) * @throws Error if Stripe configuration is not available * * @example * ```typescript * const publishableKey = this.stripeService.getPublishableKey(); * // Send to frontend for Stripe.js initialization * ``` */ getPublishableKey(): string; /** * Get the webhook signing secret for webhook verification * * Used to verify that webhook events are genuinely from Stripe * * @returns Webhook signing secret (whsec_...) * @throws Error if Stripe configuration is not available * * @example * ```typescript * const webhookSecret = this.stripeService.getWebhookSecret(); * const event = stripe.webhooks.constructEvent(payload, signature, webhookSecret); * ``` */ getWebhookSecret(): string; /** * Get the customer portal return URL * * URL where customers are redirected after using the Stripe Customer Portal * * @returns Return URL for customer portal sessions * @throws Error if Stripe configuration is not available * * @example * ```typescript * const returnUrl = this.stripeService.getPortalReturnUrl(); * // Use when creating portal sessions * ``` */ getPortalReturnUrl(): string; /** * Get the customer portal configuration ID (if configured) * * Optional portal configuration ID for customizing the Stripe Customer Portal appearance * * @returns Portal configuration ID or undefined if not configured * * @example * ```typescript * const configId = this.stripeService.getPortalConfigurationId(); * if (configId) { * // Use custom portal configuration * } * ``` */ getPortalConfigurationId(): string | undefined; } //# sourceMappingURL=stripe.service.d.ts.map