#Lucas974

1 messages · Page 1 of 1 (latest)

rare matrixBOT
lean moss
#

But if you're still intent on using it, a list of valid params are at that above link

livid basalt
#

Ok, so how can I convert this to the new version?

lean moss
#

Shows all the migrations you need to perform to move to the newer flow

livid basalt
#
import { loadStripe } from '@stripe/stripe-js';

export default function handlePayment(event){

  const stripeLoadedPromise = loadStripe(import.meta.env.VITE_STRIPE_API_KEY);

  stripeLoadedPromise.then(stripe => {
    stripe.redirectToCheckout({
      lineItems:[{
        price: import.meta.env.VITE_STRIPE_PRODUCT_ID,
        quantity: 1
      }],
      mode: "payment",
      invoice_creation: {enabled: true},
      successUrl: '/',
      cancelUrl: `${import.meta.env.VITE_URL_ROOT}/`,
      billingAddressCollection: 'required',
      locale: 'fr',
      submitType: 'pay'
    })
    .then(response => {
      console.log(response.error);
    })
    .catch(error => {
      console.log(error);
    });
  });
}
lean moss
#

yeah as you can see at the first link I sent you, invoice_creation isn't a valid param

livid basalt
#

ok and the rest of the file is so the old version ?

#

do you have an example like the one I posted but using the new syntax?

#

And I use it on the client side, not backend side

lean moss
#

With the new flow, you'll need to create the checkout session on the server. If you read the guide I sent, it explains everything

livid basalt
#

ok thank's