#just_invoice-draft

1 messages ยท Page 1 of 1 (latest)

cosmic cobaltBOT
#

๐Ÿ‘‹ 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/1286002879785730220

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

tidal shoal
#

Hello

#

On my website, subscriptions are for 30 days but Stripe offers options for recurring payments every 1, 7, or 31 days. So it is available just after 1 day of the subscription on my site. What do you suggest? What can we do in your API?

obtuse shard
tidal shoal
#

There is a section called "Subscriptions" on the Stripe dashboard. I am referring to that. Automatic card payments can be made through the API, but I have a timing issue. The timezone on my website does not match the one on your API, causing the Subscription to end on my site. Customers are complaining.

#

Isn't there anything to trigger Manuel?

obtuse shard
#

We can't help much with the Dashboard here, this server is for developer help with code/the API/webhooks/etc.

#

For the timing issue, though, what specifically is the issue that's causing your customers to complain?

tidal shoal
#

Yes, I also need help with the API.
I am currently using this API to see the time but it is not working.

#

const subscription = await stripe.subscriptions.retrieve(sub_id);

obtuse shard
#

When you say it's not working what do you mean? Are you getting an error?

tidal shoal
#

There is a timer in the database on my server.
If you have a 30-day subscription, it expires in 30 days and the subscription is deleted.
but if the customer activates automatic payment through a 30-day Stripe card
We expect an API from Stripe. Unfortunately, the timer in my database expires early because Stripe's Webhook timer is not the same. I need to find out when Stripe will send the webhook.

obtuse shard
#

Which specific Stripe Event type are you keying off of?

tidal shoal
#

We received a webhook from Stripe after 30 days, but the subscription on our website had already expired. Even if we take the customer's money, the subscription was not successfully renewed. I need help with this issue.

obtuse shard
#

Right. What Event type are you using for this?

tidal shoal
#
      const session = await stripe.checkout.sessions.create({```
obtuse shard
tidal shoal
obtuse shard
#

That's not an Event type, that's an API endpoint to create a Checkout Session.

#

You have a Webhook Endpoint set up to listen for some kind of Subscription Event(s). You're asking about how to predict when you receive those Event(s). I can't answer your question unless I know what Event types your Webhook Endpoint is listening for.

#

For example, are you using invoice.paid for this? Are you using customer.subscription.updated? Something else? A combination?

tidal shoal
#

this?

obtuse shard
#

Yes.

#

So those are the only two Event types you're listening for?

tidal shoal
#

yes

obtuse shard
#

Okay, so you're expecting the invoice.payment_succeeded Event to arrive before the timer on your end runs out, correct?

tidal shoal
#

Yes, I need to know at what time and in which timezone this webhook call will come.

#

Is this possible?

obtuse shard
#

Not exactly, no. Webhook don't have predictable delivery times due to the nature of how the internet works. There might be network issues that cause delays and retries before they actually arrive.

#

I recommend you don't use the timer approach at all.

#

Instead, you should rely on listening for webhooks to update the status of Subscriptions on your end.

#

Right now you're only listening for payment success, but you can also listen for payment failures and other events and act accordingly instead of using a timer.

tidal shoal
#

also this?

const subscription = await stripe.subscriptions.retrieve(sub_id);
#

subscription.current_period_end

#
current_period_end
#

Isn't this time frame the date when the next payment will be taken?

obtuse shard
#

That's when the current Subscription period ends. Payment happens a bit after that depending on various factors.

#

Typicaly we give you an hour to modify the Invoice for that payment before we move forward, for example.

cosmic cobaltBOT
tidal shoal
#

It seems a bit complicated, I will think of some solutions for this.

brazen bloom
#

just_invoice-draft

tidal shoal
#

Hello

tidal shoal
brazen bloom
#

check please what? My colleague was already working with you and explained what you needed

tidal shoal
#

I thought you came to help. Well, thank you.

#

You can close the ticket.

brazen bloom
#

๐Ÿ‘

#

I'm happy to help to be clear, if you have a question. Just saying that I am taking over for my colleague and it looks like they already answered your questions for now