#yuichi-hamamoto_docs

1 messages · Page 1 of 1 (latest)

lament ravenBOT
#

👋 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/1381844888731127839

📝 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.

#

⛔️ Stripe developers have stepped away for a short while

Please leave your questions here, and we’ll respond as soon as we're back! If you need help urgently, you can contact Stripe support for help.

lament ravenBOT
heavy gulch
#

Hi! Looking into your question!

#

Can I get the Subscription object you are looking at?

lone sky
#

How?

#

I was going paste the object I retrived but it was too big to paste

#

Sorry it's screenshot. Could be hard to read

#

But I am not asking about something specific

heavy gulch
#

I just need the object ID which starts with sub_. I see it in your screenshot. Can you paste that here?

lone sky
#

sub_1RW7E1R3ZSJy0f3V6sg9lJ8d

#

So let's say when the user subscribes and pays the invoice, it will receive invoice.paid hook. But invoice is invoice, I only know the payment was successfully completed for the subscription, and now it's active.

#

But I would like to know what the invoice was for or at least how long the user is provisioned

#

like was it for 1/1-31? 2/1-28?

heavy gulch
#

If you look at the invoice.paid event (e.g. https://dashboard.stripe.com/test/events/evt_1RWBoKR3ZSJy0f3VGtjDNf5s) you can see

  • The subscription period:
    "period": {
    "end": 1780631309,
    "start": 1749095309
    },

  • Under plan you can see the interval: "interval": "year",

  • You can also see what subscription it is for: "subscription": "sub_1RW7E1R3ZSJy0f3V6sg9lJ8d"

lone sky
#

I see period in object.lines.data: {period:{end,start}}[]

#

Why is it array?

#

I was aware interval exists but it only tell me interval but not exact day

heavy gulch
lone sky
#

yea

#

It only has one object in the array so easy to miss that's an array tho

#

The period you gave to me belong there

#

wait not it's just feld

#

it says there are 28 in the line

heavy gulch
#

Sorry I am a little confused. What is the exact question here?

lone sky
#

User subscribe

#

Pay the incoice

#

Then receive invoice.paid

#

but it doesnt have the infomation about for what period

#

When I receive the hook, I want to provision but with period, from when to when

#

e.g. start monthly subscription on 1/1

#

pay on 1/5, then the subscription becomes active. I want to provision for 1/5-2/4 and inform the user

#

Like "we received payment for 1/5-2/4 so you can use for the period"

heavy gulch
#

The period_start and period_end are the indicators for the start and end of a subscription.

These fields are a timestamp. So you can convert them. Looking at evt_1RWBoKR3ZSJy0f3VGtjDNf5s, below are the conversions:

  • period_start: Friday, 5 June 2026 03:48:29 (UTC)
  • period_end: Thursday, 5 June 2025 03:48:29 (UTC)
"period_end": 1749095309,
"period_start": 1749095309,
lone sky
#

So the reason why period_end and period_start are the same is because it's on the test mode?

#

I checked some events but they are all same

heavy gulch
#

I am still looking into it. Can you provide these events where you saw they were the same?

lone sky
#

evt_1RYKDjR3ZSJy0f3VrDG1ln9B

heavy gulch
#

Thank you for waiting!

Lets focus on sub_1RW7E1R3ZSJy0f3V6sg9lJ8d first.

Now for all of these, each invoice is created as the "first" invoice for that new cycle. For first Invoices, since there is no "past" for the invoice, period_start and period_end will be equal in that situation and correspond to the date the Subscription was created. In this cases these invoices all have the same start and end date.

Now moving to sub_1RYKCQR3ZSJy0f3VHanuVtDB:

  • Event evt_1RYKDjR3ZSJy0f3VrDG1ln9B is for in_1RYKCQR3ZSJy0f3VpQ1QCasj
  • in_1RYKCQR3ZSJy0f3VpQ1QCasj is the first invoice and it follows the same principal as what I mentioned above: For first Invoices, since there is no "past" for the invoice, period_start and period_end will be equal in that situation and correspond to the date the Subscription was created. In this cases these invoices all have the same start and end date.
lone sky
#

So in any case, there's no way I know what the invoice/payment was for, for the first payment of subscription?

#

But for 2-n th cycle of subscription, I can refer period_start and period_end

heavy gulch
lone sky
#

I meant for the first payment, I dont know when the first cycle will ends right

heavy gulch
lone sky
#

So it's safe to search the array of line items for subscription if the billing_reason is related to subscription?

#

and the number of subscription exists in lines is 1

lone sky
heavy gulch
#

Yes you should get the start and end dates from the subscription line items.

lone sky
#

ok I get it