#toxiCity
1 messages · Page 1 of 1 (latest)
Can you rephrase your question? What are you trying to do exactly?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
What value should I use for the payment method parameter
The value should be a PaymentMethod ID, but you won't have that ID unless you've collected payment details from a customer and used these details to create a PaymentMethod object
Is there a particular reason why you're not confirming the SetupIntent client side? typically, integrations will collect payment details on the frontend and use confirmSetup to create a PaymentMethod and confirm the SetupIntent in one go
I need to add a card then delete the previous card so there will only be one payment method on the system programatically
Okay, understood. How are you collecting the customer's new card details?
Okay, good. In that case, I recommend following the steps in the guide I linked above.
I assume you're using the SetupIntent's client secret for this PaymentElement?
yes that's correct
In that case, you should use confirmSetup client side to confirm the SetupIntent: https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements#submit-payment-details
You'll want to pass in your Elements instance so the details that the customer provided in the PaymentElement are used to confirm the SetupIntent: https://stripe.com/docs/js/setup_intents/confirm_setup
The piece you want to pay close attention to is step 6: confirming the SetupIntent client side - https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements#submit-payment-details