UNPKG

@vue-stripe/vue-stripe

Version:

Vue Stripe elements and composables for Stripe.js

45 lines 1.39 kB
import { ConfirmPaymentData, StripeElements } from '@stripe/stripe-js'; import { UsePaymentIntentReturn } from '../types'; /** * Options for confirming a payment */ export interface ConfirmPaymentOptions { /** Client secret from the PaymentIntent */ clientSecret: string; /** Additional confirmation parameters */ confirmParams?: ConfirmPaymentData; /** 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 payment intents * Provides a convenient way to confirm payments * * @example * ```vue * <script setup> * import { usePaymentIntent } from '@vue-stripe/vue-stripe' * * const { confirmPayment, loading, error } = usePaymentIntent() * * const handleSubmit = async () => { * const result = await confirmPayment({ * clientSecret: 'pi_xxx_secret_xxx', * confirmParams: { * return_url: 'https://example.com/checkout/complete', * }, * }) * * if (result.error) { * // Handle error * } * } * </script> * ``` */ export declare function usePaymentIntent(): UsePaymentIntentReturn; //# sourceMappingURL=usePaymentIntent.d.ts.map