#andrewandyandy_best-practices

1 messages ¡ Page 1 of 1 (latest)

analog belfryBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1222986598367494190

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

granite windBOT
polar iris
#

What do you mean by threshold?

#

Can you describe an example scenario?

warm solstice
#

Threshold meaning the amount of times stripe will retry on a payment failure until it is a success. I was told by Customer Service, that if there was a payment failure, it would try again after 2 weeks, I would like to prevent that for new subscriptions

polar iris
#

Those retries don't normal apply to first invoices on new subscriptions

#

But it sounds like you're getting renewal invoice behaviour

#

Can you share an example subscription / invoice so i can see what you're doing with the schedules?

warm solstice
#

in_1OzOctDnkobEEnenW9nxsBGr

#

this is from live cus_PoIwVI2VcztUt4

#

now that i'm thinking about it, this issue might be on our end,

originally prior to creating a schedule, we would just create a subscription

#

and now that with a schedule, it would introduce the 1 hour delay

#

we wanted the 1 hour delay because of our integration partner listens to the payment_succeeded webhook

polar iris
#

Yea, he schedule is the reason for the 1hour draft window

night spruce
#

i need help for a problome settting up my account

warm solstice
#

I had some code to add metadata to the invoice, it was a race condition

analog belfryBOT
#

@night spruce looks like you're in the wrong place, this thread is for someone else's question.

Note that posting inappropriate messages in other people's threads is against the rules. No worries if this was just an honest mistake, but anyone who violates the rules multiple times will be removed from this server.

warm solstice
#

maybe i should listen to the webhook

polar iris
warm solstice
#

yes originally, the reason why I changed our code from creating a subscription to creating a schedule (to introduce the 1 hour delay) was to add metadata to the invoice

#

Yea our integration partner wanted the metadata to be at the root of the invoice object

polar iris
#

Ok, so what you've done is a workaround for that

warm solstice
#

yes, I tried to listen to the invoice created webhook but it was a race condition

polar iris
#

So now how does your question about retries and thresholds come into play?

#

race condition in what way? You can still update metadata after the invoice is finalized

#

what was the conflict?

warm solstice
#

the integration partner is listening to invoice.payment_succeeded

polar iris
#

So you already have payment details on file for these customers?

warm solstice
#

yup

polar iris
#

Have you tried using payment_behavior=default_incomplete?

warm solstice
#

i have not

#

let me see what it does

polar iris
#

So using that, you should get back an open invoice, even where the customer has a PM attached & set as default

#

then you can call the Invoice /pay API after you set the metadata you need

#

That parameter is for the subscription API btw, not schedule

#

sorry, canadian typo.

#

no u in payment_behavior

warm solstice
#

mhmm i'll take a look at this

#

i think it would require us to listen to a webhook

#

because for our code, based on the results of creating the subscription, we would set plans etc to our company object

#

allowing them to use the product

polar iris
#

Webhook for what?

#

but, maybe, depending on any existing logic you have

#

but you should be able to update the latest_invoice metadata before calling /pay for it

warm solstice
#

mhmmm

#

okay i think i understand now

#

create the subscription with payment_behavior, set the invoice metadata, then /pay, and based on that result, set sub info to company object

polar iris
#

exactly