#Niek

1 messages · Page 1 of 1 (latest)

paper bridgeBOT
alpine sage
#

Hi there. Do you still need assistance with this/have any questions?

shell pond
#

Hi, yes please, the previous thread was closed as I had to travel home meanwhile, see the link

alpine sage
#

Pasting here for context (we try not to reopen threads):

#
Hi, I'm using a cardElement from Stripe.js to capture the credit card details for creating a trial subscription in a first step and then create the setup intent and confirmCardSetup in the final "Submit" step. When the user has initially entered a credit card that didnt work (e.g. insufficient funds) and then enters a second credit card it turns out that the payment method id for the second credit card is the same as for the first one. Should I reset somehow the cardElement so it generates a new payment method id?
Dingbot
 added 
bismarck
 to the thread.
 — Today at 1:29 PM
bismarck — Today at 1:29 PM
Hi there
You are creating the SetupIntent manually after the Subscription instead of using the pending_setup_intent?
To clarify: when you create a Subscription with a trial, we create a SetupIntent for you: https://stripe.com/docs/api/subscriptions/object#subscription_object-pending_setup_intent
You should be using that SetupIntent to collect card details for that customer```
#

What's your follow up question for this?

shell pond
#

Hi, see my question above: Hi, I'm using a cardElement from Stripe.js to capture the credit card details for creating a trial subscription in a first step and then create the setup intent and confirmCardSetup in the final "Submit" step. When the user has initially entered a credit card that didnt work (e.g. insufficient funds) and then enters a second credit card it turns out that the payment method id for the second credit card is the same as for the first one. Should I reset somehow the cardElement so it generates a new payment method id?

#

The suggestion of using setup intent created during the creation of the subscription is not an option for us as I described

alpine sage
#

"it turns out that the payment method id for the second credit card is the same as for the first one"

#

That part doesn't make sense

#

Can you share your code?

#

And a payment method id where you see this?

shell pond
#

Let me check...

#

pm_1LjlusKaD336Zt1WKzA63vYE

#

The customer supplied a credit card with insufficient funds, and the above pm was created. Once he saw the error message he entered another credit card number (I assume) and tried again. This second try my server received the same pm id

#

Hmm maybe my assumption is false, he could have used the same credit card number as the first time

alpine sage
#

I'd have to take a look at your code to see what you are doing to try to piece together what's happening here

shell pond
#

In my code I reuse the same cardElement for all credit cards that the user may supply (e.g. after the first one fails) during one subscription flow. Then, I create a new setup intent and confirmCardSetup, even if the credit card did not change. SO I would expect the pm id to be different. Could you share when exactly the pm id is created?

#

I did a quick test myself, even with the same credit card details the create setup intent/confirmCardSetup generates a new pm id, as I would expect so the issue is in my own code, sorry to bother you!