#nadiya_code
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/1338961102330920980
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
You can set collection_method to send_invoice when you create the subscription and then update it after the first invoice gets paid by calling the API - https://docs.stripe.com/api/subscriptions/update#update_subscription-collection_method
i also want to know how stripe changes the status of subscription in case payment not completed for the invoice
You can specify this behavior via the dashboard under "Manage invoices sent to customers" - https://dashboard.stripe.com/settings/billing/automatic
https://docs.stripe.com/billing/collection-method#failed-subscription-payments
so, the subscription is not set to incomplete_expired even after 23 hours if i set
Subscription status: If an invoice is past due by 30 days, cancel the subscriptions
what's the difference between:
mark the subscription as unpaid and leave the subscription past-due?
so, the subscription is not set to incomplete_expired even after 23 hours if i set
I believe that only applies tocollection_method: charge_automatically
forcollection_method: send_invoice- the subscription will be marked differently when it crosses the due date
what's the difference between:
mark the subscription as unpaid and leave the subscription past-due?
We explain that here - https://docs.stripe.com/api/subscriptions/object#subscription_object-status
when a subscription has a status of unpaid, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.
is it possible to know if its the first invoice or not from the subscription / invoice object?
Yup, the invoice object would have billing_reason parameter set to subscription_create if it's the first invoice and subscription_cycle if subsequent invoice
https://docs.stripe.com/api/invoices/object#invoice_object-billing_reason
even if the the suscription has trial period for few days, the next invoice (the first non trial invoice) has billing_reason: subscription_create ?
Hmm not sure about the trial no.. With a trial we do generate a $0 invoice so I suspect we'd just use billing_reason => subscription_cycle for the first paid invoice
I'd recommend trying it out in test mode to be 100% certain of the outcome
its subscription_cycle for the first paid invoice (in case of a trial)
so, is there any other way , we can check they cycle number or something?
You can try listing all invoices associated with the subscription and see if there were any non-zero invoices for the subscription - https://docs.stripe.com/api/invoices/list
may be i could just listen for the invoice payment succeeded event, and if the subscription's collection method is still send_invoice, update it to charge_automatically.
is this step right?
yup invoice.payment_succeded or invoice.paid
either events would work
can you please share any doc showing the difference between those two events?
They're identical, the only difference being one is generated when the invoice is marked as paid (it's status changed to paid)
i'd this code for subscription schedule phases:
[
{
// Single phase with a trial ending on the target day.
trial_end: nextBillingDateUnix,
items: [{ price: stripePriceId, metadata }],
metadata,
},
]
and i changed to this one below
[
{
// Phase 1 : with a trial ending on the target day and manual payment for the first invoice.
trial_end: nextBillingDateUnix,
collection_method: 'send_invoice',
items: [{ price: stripePriceId, metadata }],
metadata,
},
{
// Phase 2: with an automatic charge for the subsequent invoices
items: [{ price: stripePriceId, metadata }],
metadata,
},
];
how about this?
since i'm already using scheduled subscription and phses, should i just add one more phase?
or should i need to do this one " listen for the invoice paid event, and if the subscription's collection method is still send_invoice, update it to charge_automatically."
Hi, taking over for a teammate who needs to step away. Let me catch up