#akashpatil7596_webhooks
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/1368866984128811053
đ 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.
- akashpatil7596_webhooks, 34 minutes ago, 28 messages
Basically, you're asking why it takes ~24h for the Invoice to attempt to charge the customer?
Yes
In my code as you can see I manage that as soon invoice.created it gets finalized
Still on 3rd and 4th may it went to open
Generally, it takes 1h from finalization to automatic collection, but if your webhook endpoint fails to respond to a invoice.created event successfully, collection can be delayed by 72h: https://docs.stripe.com/billing/subscriptions/webhooks#understand
This is to ensure your app acknowledges the Invoice creation, in case you need to make any changes to the Invoice.
So what to do? I want to finalize it as it gets created
I am not sure what you mean. Finalization turns a draft Invoice into an open Invoice. After that the payment needs to be collected for it to turn paid.
It all happens automatically, but not immediately, to give you time to make changes to the draft Invoice.
What is exactly the issue you're facing with this?
Finalization turns a draft Invoice into an open Invoice
No finalize should be turns a draft into paid
Just one thing that invoice.created should be paid and get finalized immediately.
Where are you taking this information from?
You might misunderstand the term "finalization" in the context of Stripe Invoices. It means that no changes are permitted on the Invoice (vs draft), and it's open to be paid.
So what to do for pay instantly
I suggest you to go over this guide: https://docs.stripe.com/invoicing/integration/workflow-transitions
I do the same, as you can see in my code, still the invoice draft went to open?
Do the same as what exactly?
if (data?.type === 'invoice.created') {
const isSubscriptionExist = await this.subscriptionRepo.isSubscriptionExist(data, transaction);
if (isSubscriptionExist) {
await this.stripeService.finalizeInvoice(data?.data?.object?.id);
}
}
async finalizeInvoice(invoiceId: string) {
try {
return await this.stripe.invoices.finalizeInvoice(invoiceId);
} catch (error) {
logger.error('error', error);
throw new HttpException(500, 'SOMETHING_WRONG', error);
}
}
Hey! Taking over for my colleague. Let me catch up.
Can you share an invocie Id resulting from this code ? and what you are expecting to happen exactly to it ?
04 May : in_1RKz9qAGlCdR56ap7AgP4bvd
03 May : in_1RKcgdAGlCdR56apAH9v53ve
These two invoices after they are created went into open not paid, I want to go to paid after created
Thanks for sharing these two invoices. Firstly, these invoices were paid automatically
These are a result of a Subscription, right?
Yes, but it took time to get paid like 1-2 day, until that they were open and not paid
Usually invoices are finalized and paid automatically after 1 hour from creation
No I want instant finalized and paid
For that, all your webhook endpoints needs to respond successfully to the event evt_1RKz9rAGlCdR56apNxnIUxXq
No you can't. The default behaviour is to wait 1hour
Here it tools 1-2 days, because your webhook failed to responde to Stripe
Same for this event https://admin.corp.stripe.com/notification/evt_1RKz9rAGlCdR56apNxnIUxXq
Yes but why it gets failed my server was on all the time
Let's stop sharing the same message multiple time please, we have access to the full conversation.
Stripe have no control over your website/server. You need to add some logs maybe or debug it i order to fix it and make it return 2xx.
You need to fix this webhook endpoint in particular we_1RHk7BAGlCdR56apLtDPVICv
Okay thanks let me check
Between, it responded with 404
Make sure, that you have this endpoint set /api/v1/webhook/stipe
ok let me check
thanks
Hey wait
my webhook endpoint is : whsec_J7ZkhGlBjhEG6UjXi9892xor1WJwjcVh not we_1RHk7BAGlCdR56apLtDPVICv
No that's your webhook secret and not your webhook Id