UNPKG

@vue-stripe/vue-stripe

Version:

Vue Stripe elements and composables for Stripe.js

62 lines 1.84 kB
import { StripeElements } from '@stripe/stripe-js'; import { UseSetupIntentReturn } from '../types'; /** * Options for confirming a setup */ export interface ConfirmSetupOptions { /** Client secret from the SetupIntent */ clientSecret: string; /** Additional confirmation parameters */ confirmParams?: { return_url?: string; payment_method_data?: { billing_details?: { name?: string; email?: string; phone?: string; address?: { line1?: string; line2?: string; city?: string; state?: string; postal_code?: string; country?: string; }; }; }; }; /** Whether to redirect (defaults to 'if_required') */ redirect?: 'if_required' | 'always'; /** Optional elements override (uses injected elements if not provided) */ elements?: StripeElements; /** Skip elements.submit() validation (not recommended, defaults to false) */ skipSubmit?: boolean; } /** * Composable for handling setup intents * Provides a convenient way to save payment methods for future use * * @example * ```vue * <script setup> * import { useSetupIntent } from '@vue-stripe/vue-stripe' * * const { confirmSetup, loading, error } = useSetupIntent() * * const handleSaveCard = async () => { * const result = await confirmSetup({ * clientSecret: setupIntent.clientSecret, * confirmParams: { * return_url: 'https://example.com/account/cards', * }, * }) * * if (result.error) { * // Handle error * } * } * </script> * ``` */ export declare function useSetupIntent(): UseSetupIntentReturn; //# sourceMappingURL=useSetupIntent.d.ts.map