#sajid_api
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/1290476849146892349
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- sajid_schedule-morequestions, 55 minutes ago, 37 messages
- sajid_api, 9 hours ago, 8 messages
- sajid_api, 4 days ago, 92 messages
- sajid_api, 4 days ago, 26 messages
- sajid_api, 5 days ago, 68 messages
- sajid_schedule-update, 5 days ago, 21 messages
and 1 more
Hi there, are you asking about how to get the end_date of the first phase of schedule?
I am asking to get the end date of upcoming invoice or (start date of next iteration you may say).
Sure, it's here https://docs.stripe.com/api/subscriptions/object?lang=curl#subscription_object-current_period_end
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I am implementing it. please be with me. I might need more help. dont close the thread.
When we switch the phase does subscription id change?
that is attached with subscription schedule
No, the ID stays the same
Can you please check when I update my subscription ends after one month.
req_gv0Rx2LyItSrDW
This is my request id of update. Please confirm is it updated correctly.
Hmm, so you want to automatically cancel the subscription one month later?
No, I want it to continue. but it ends after one month when i test it on simulation.
// Create the next phase starting at nextInvoiceDate
const nextPhase = {
start_date: nextInvoiceDate,
items: items,
iterations: 1, // One iteration for this phase (next invoice only)
};
// Create remaining phases with proper iterations
const remainingIterations = {
items: prevItems,
iterations: 9, // Specify remaining iterations
collection_method: "charge_automatically", // Default method for remaining iterations
proration_behavior: 'create_prorations', // Ensure proration behavior is set
};
To clarify, you want the subscription to continue, but you found it cancelled during test?
yes it show ended on (the date of very next month when next phase should start)
What's the subscription ID?
sub_1Q4uxXF6Gkk6c638fj59KBZm
Ok, that's because the invoices weren't paid successfully, and the subscriptoin is therefore automatically cancelled
but I dont want it to cancel. it should added upto next invoices if not paid.
Because I am creating it for the tenant who has rented a property from a landlord. so this scuedule is for rent.
https://docs.stripe.com/billing/subscriptions/overview#smart-retries then you should change your billing setting and make the subscription as unpaid, or leave the subscription past-due
ok i got it.
and i want when the invoice created it shoudl become the open to pay. I have implemeneted webhook for that purpose. is it correct:
const handleInvoiceCreated = async (event) => {
const invoiceId = event.data.object.id;
const invoice = await stripe.invoices.retrieve(invoiceId);
// Ensure the invoice is not in 'paid', 'void', or 'uncollectible' state
if (invoice.status === 'open' || invoice.status === 'draft') {
// If the invoice is already open or in draft, you can proceed with updating it.
const updatedInvoice = await stripe.invoices.update(invoiceId, {
auto_advance: true, // Auto-advances the invoice to 'open' if it's in draft
});
}