#andrewandyandy_best-practices
1 messages ¡ Page 1 of 1 (latest)
đ 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.
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
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?
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
Yea, he schedule is the reason for the 1hour draft window
i need help for a problome settting up my account
I had some code to add metadata to the invoice, it was a race condition
@night spruce looks like you're in the wrong place, this thread is for someone else's question.
- If you have your own thread please chat there.
- If you have a question or a followup to a closed thread use one of the buttons in https://discord.com/channels/841573134531821608/842637025524842496 to get help (we don't reopen closed threads).
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.
maybe i should listen to the webhook
Is your motivation here just about metadata?
Note that subscription metadata is automatically propagated to invoices created by that subscription and available within subscription_details:
https://docs.stripe.com/api/invoices/object#invoice_object-subscription_details
So that might be another option for you
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
Ok, so what you've done is a workaround for that
yes, I tried to listen to the invoice created webhook but it was a race condition
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?
the integration partner is listening to invoice.payment_succeeded
So you already have payment details on file for these customers?
yup
Have you tried using payment_behavior=default_incomplete?
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
sorry, canadian typo.
no u in payment_behavior
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
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
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
exactly