v3 syncs Vue Stripe with @stripe/react-stripe-js 6.8.1, which requires
Stripe.js v9.
npm install vue-stripe@^3 @stripe/stripe-js@^9.5.0
Stripe.js v9 removed stripe.initCheckout() and split it into two entry points.
That is what forces the checkout changes below. There is no way to keep the old
API working on v9.
Pick the provider that matches your integration.
| Before | After |
|---|---|
CheckoutProvider with individual Elements | CheckoutElementsProvider |
CheckoutProvider with a prebuilt form | CheckoutFormProvider |
-import { CheckoutProvider } from 'vue-stripe/checkout'
+import { CheckoutElementsProvider } from 'vue-stripe/checkout'
-<CheckoutProvider :stripe="stripePromise" :options="options">
+<CheckoutElementsProvider :stripe="stripePromise" :options="options">
useCheckout() still works under both providers and still returns the Elements
shaped result, so existing code keeps running. It is deprecated. Move to the
provider-specific composable, which returns the exact actions its SDK exposes.
| Provider | Composable |
|---|---|
CheckoutElementsProvider | useCheckoutElements() |
CheckoutFormProvider | useCheckoutForm() |
Calling the wrong one for your provider throws with a message telling you which to use instead.
-import { PaymentFormElement } from 'vue-stripe'
+import { CheckoutForm } from 'vue-stripe/checkout'
It also moved entry points, and its elementType is now reported as
checkoutForm rather than paymentForm. Update any handler that reads it.
-@loaderror="e => console.log(e.elementType) // 'paymentForm'"
+@loaderror="e => console.log(e.elementType) // 'checkoutForm'"
The types renamed alongside it, from PaymentFormElementProps and
PaymentFormElementEmits to CheckoutFormProps and CheckoutFormEmits.
CheckoutElementsProvider keeps appearance and fonts under elementsOptions,
matching the old CheckoutProvider. CheckoutFormProvider takes them at the
top level.
// CheckoutElementsProvider
const options = {
clientSecret,
elementsOptions: { appearance: { theme: 'night' } },
}
// CheckoutFormProvider
const formOptions = {
clientSecret,
appearance: { theme: 'night' },
}
Nothing here is breaking. These simply did not exist in v2.
Root entry point: CurrencySelectorElement, ContactDetailsElement,
ShippingAddressElement, TermsElement, IssuingCardNumberDisplayElement,
IssuingCardCvcDisplayElement, IssuingCardExpiryDisplayElement,
IssuingCardPinDisplayElement, IssuingCardCopyButtonElement.
Checkout entry point: CheckoutForm, ContactDetailsElement, TermsElement.
Elements now emit availablepaymentmethodschange, matching
onAvailablePaymentMethodsChange in React Stripe.js.
The checkout form element called createPaymentFormElement, which Stripe.js v9
renamed to createForm. If you were on a v9 prerelease, this was broken and now
works.