#Nadiya

1 messages · Page 1 of 1 (latest)

thin owlBOT
short zephyr
#

hello! can you share your logic?

odd pulsar
#

sure

#

do i've to use off_session / something else which create the subscription immediately?

short zephyr
#

where is it infinitely looping at?

odd pulsar
#

from this event

#

let me share you the detils

short zephyr
#

to be specific, which section of code is causing it to infinitely loop?

#

you'd want to step through each line of your code to understand why

odd pulsar
#

the subscription create code is causing infinite loop i guess

#

it agains calls setup intent event, and this create the subscription again

short zephyr
#

can you paste the second SetupIntent id here?

odd pulsar
#

seti_1Mh4JeLoPcxaifRirht1HRsX

short zephyr
#

can you try not passing in payment_settings.save_default_payment_method when creating the Subscription

odd pulsar
#

sure, let me try that.
tbh, i've no idea what's that for. i found that from a guide, and i thought it adds the dafault pm from customer to subscription

#

it still loops

short zephyr
#

can you share the second SetupIntent id again for the new try?

odd pulsar
#

seti_1Mh53CLoPcxaifRiUDc53NoD

short zephyr
#

hmmm, gimme a while to think what's the best way to go about this

short zephyr
#

out of curiosity, if the user updates the PaymentMethod, that will likely trigger a setup_intent.succeeded event also. How were you planning to handle that since right now on you're always attempting to trigger subscription creation upon setup_intent.succeeded?

odd pulsar
#

when i comment out subscription created, it's not creating setuop intent again

#

let me share you the event list of the same

#

oh i got you, sorry

#

i guess i've to share some metadata on very first setupIntent.

short zephyr
#

that works

odd pulsar
#

then, i'll be checking with this metadata to decide whether to create subscription or not

short zephyr
#

yep, i think that will avoid the infinite loop during subscription creation also

#

cause creating the subscription with a trial also generates a SetupIntent

odd pulsar
#

i see

short zephyr
#

to answer your question about off_session / on_session when creating the subscription with a trial, you don't have to pass in anything

#

the subscription should still be successfully created