#puttekool
1 messages · Page 1 of 1 (latest)
Once the setupIntent is confirmed successfully, the payment method will be attached to the customer that you specified in setupIntent. After that you can call update API to update the customer's invoice_settings.default_payment_method with the newly collect payment method.
great, ok but how do I forward the paymentMethod to the update call ? Earlier I did that with a confirmCardSetup where I could extract the setupIntent and then its payment_method like this: const { error, setupIntent } = await stripe.confirmCardSetup( setupIntentClientSecret, { payment_method: { card: cardElement } } ); and then use it in the update call by forwarding this: const paymentMethodId = setupIntent.payment_method; but now I only have extracter error and no setupIntent from confirmSetup instead of confirmCardSetup ?
What error? can you shall with me the details?
I cant do this: const { error, setupIntent } = await stripe.confirmSetup but with confirmCardSetup I could do this: const { error, setupIntent } = await stripe.confirmCardSetup and get the paymentMehod forward via the setupIntent.payment_method.
Like the stripe.customers.update does need a paymentMethod Id passed to it ?
Before I used a CardElement and confirmCardSetup now I want to update to PaymentElement
You haven't told me anything about the error. Can you share me the error message from your console log?
The error is that I can not add: const { error, setupIntent } = await stripe.confirmSetup TS error says: Property 'setupIntent' does not exist on type '{ error: StripeError; }'
https://stripe.com/docs/js/setup_intents/confirm_setup based on the API doc, the Promise will resolve with an {error} object that describes the failure, there's no setupIntent object here
exactly so any idea how I can get the paymentMethod to the stripe.customers.update ?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You can get the list of attached payment methods through this API
https://stripe.com/docs/api/setup_intents/object#setup_intent_object-payment_method You can also get it from a successfully confirme setupIntent.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.