stripe/stripe-js

[BUG]: Mismatch between Stripe docs for DefaultValuesOption and Type DefaultValuesOption

kdurgatp opened this issue · 5 comments

What happened?

const paymentOptions: StripePaymentElementOptions = {
  defaultValues: {
    paymentMethods: customerState?.paymentMethod
  }
}

Error Type '{ paymentMethods: Stripe.PaymentMethod | undefined; }' is not assignable to type 'DefaultValuesOption'.

Here the docs say paymentMethods is a valid child of defaultValues but here the type doesn't include paymentMethods (or card, which the docs also say is allowed)

Environment

No response

Reproduction

No response

+1 ran into this today!

What is the value you're trying to set here? I agree the type definition doesn't appear to include paymentMethods at all, but from the context of your customerState?.paymentMethod variable, that doesn't sound like it would match the shape in the docs { ideal: { bank: 'abn_amro' }}. Can you clarify so I can confirm I understand what's needed here?

Hey Brendan! Can't speak for OP, but I was looking to pre-populate a user's existing payment method information in the form to build a "modify payment method" feature. From looking at the docs again though, it looks like the paymentMethods setting that's missing from the type definitions only controls basic card and iDEAL settings as opposed to the actual payment information itself. I did some better Googling and learned that this isn't possible to do though 😆

oh whoops, somehow didn't notice that paymentMethods only includes ideal 🙃 I was trying to do the same thing as williamrobertson13

Thanks for the replies @williamrobertson13 @kdurgatp. This sounds like an integration issue, and Stripe Support can provide more help with this if you need it.