#ryancwalsh

1 messages · Page 1 of 1 (latest)

weak muralBOT
wary quartz
#

Hi 👋

#

Yes all of this is possible

#

Please note you will need to carefully read and implement the "Optional" steps

#

And there are a number of them

trim pollen
#

Thanks. I've been familiar with your first link and am still having trouble. And we want to avoid two-step.

It seems like it's impossible to avoid the concept of paymentIntent, right? paymentIntent is a requirement of PaymentElement?

So I figured I'd do the auto-confirm approach, which I thought I could do like this:

paymentIntents.create(
    {
    automatic_payment_methods: {
      enabled: true,
      allow_redirects: "never",
    },
    //setup_future_usage: "off_session",
    amount,
    currency,
    statement_descriptor_suffix,
    description,
    customer: stripeCustomerId,
    confirm: true,
  }
  );

But I get You cannot confirm this PaymentIntent because it's missing a payment method. You can either update the PaymentIntent with a payment method and then confirm it again, or confirm it again directly with a payment method.

(And also, I had to comment out setup_future_usage to even get that far.)

wary quartz
#

I don't know what you mean "avoid the concept of paymentIntent". Both flows explicitly say you don't create a payment intent until after you create the payment method

trim pollen
#

Ok, I'll try reverting back to calling const {error, paymentMethod} = await stripe.createPaymentMethod(... first.

And Google Pay users will still see the correct amount, right? I specify it in Elements options (type stripeJs.StripeElementsOptionsMode).

wary quartz
#

For that you will need to specify the amount when you instantiate the Stripe.elements, as our docs show, and update the elements with any changes to that amount

trim pollen
#

Yep, I instantiate it with the amount, and the amount won't change.

wary quartz
#
const options = {
  mode: 'payment',
  amount: 1099, // <- this part right here
  currency: 'usd',
  paymentMethodCreation: 'manual',
  // Fully customizable with appearance API.
  appearance: {/*...*/},
};

// Set up Stripe.js and Elements to use in checkout form
const elements = stripe.elements(options);