#kado-kaelan-subs

1 messages · Page 1 of 1 (latest)

small carbon
crimson yacht
#

gotcha, then from there, if they do have a subscription, how would i get the clientSecret?

languid junco
#

A Subscription does not have a client secret so it doesn't really make sense that way. Are you asking about the PaymentIntent's client secret? What's the context of your ask?

crimson yacht
#

so im creating a subscription, then confirming the the card setup

#

but confirmCardSetup requires clientSecret

#

I understand createSubscription returns pending_setup_intent.client_secret

#

but my issue is what if a user signs up, creates a subscription then say, for example, they type in wrong card number. the subscription is created already

#

so If they try to retype the card number in that session (or come back) I would want to use the same clientSecret as the subscription they previously created

languid junco
#

then you get the client secret the same way you would have on creation really

#

the client secret is inside the SetupIntent in pending_setup_intent which you need to expand like you do on creation

crimson yacht
#

so retrieving the subscription object would have that pending_setup_intent?

#

okay. So I would check if customer has subscriptions, retrieve subscription with that subscriptionId, then get clientSecret from retrieved subscription object

#

thanks!

languid junco
#

honestly you really should track this in your database instead

#

seems quite inefficient to make all those API requests

crimson yacht
#

thats what i was thinking

#

okay I'll do that instead

#

wasn't sure what id's were a no-go to store

languid junco
#

you can store everything from our API

crimson yacht
#

gotcha thanks for the help!

languid junco
#

Sure thing!