#jagariko_api

1 messages · Page 1 of 1 (latest)

arctic mountainBOT
#

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

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

  • _api, 1 hour ago, 7 messages
lyric arch
#

Which sub_xxx ID demonstrates the behaviour you reference

strange matrix
#

The following subscription IDs demonstrate the behavior:

sub_1RDkU0H9QZM8KDuiwC1mTae4: An invoice was generated.

sub_1RDjaSH9QZM8KDuiRCbkuZzG: No invoice was generated.

lyric arch
strange matrix
#

Yes!

Invoice was created:

  • req_gDnPXtzTXImbzO (We first add a usage-based Free plan (price = ¥0).)
  • req_GRJqDlNBuqJBU8 (Then we update the subscription with trial_end=now.)

No invoice created:

  • req_qvlbmF2lM9Z6js (We call Subscription.update to add the usage-based Free plan and set trial_end=now in the same API call.)
lyric arch
#

Overall I'm confused, the parameters on all 3 of those requests are totally different. Why would you expect them all to behave the same?

strange matrix
#

I’m not expecting all three requests to behave identically.
What I’m trying to understand is why the specific request where we update both trial_end=now and add a usage-based (metered) plan at the same time does not generate a ¥0 invoice, while doing the same operations in two separate steps does generate invoices.

lyric arch
strange matrix
#

I believe the invoice in_1RDjcpH9QZM8KDuivC2hEKdT was actually generated at the time the trial started, not when the trial ended.

lyric arch
#
#

in_1RDjaSH9QZM8KDuiARnNaRkf is the initial trial invoice

arctic mountainBOT
lyric arch
#

What are you showing me? I already explained why that didn't generate an invoice

strange matrix
cunning mural
#

Hey! Taking over for my colleague. Let me catch up.

strange matrix
#

Hey, thanks for jumping in! 🙏

cunning mural
#

However, I’m trying to understand why this request, which also used trial_end=now, did result in an invoice:
As you ended the trial period, so a new invoice will be generated, that's expected.

#

The invoice has 0$ amount because you are using a freemium price price_1QjHt6H9QZM8KDuiikGQJB4u

strange matrix
cunning mural
#

My colleague have already answered you regarding that request I think

We wouldn't then generated another new invoice just for the addition of a usage based plan, which was the only 'difference' on req_qvlbmF2lM9Z6js

#

Also, the trial is already ended, why you are making another request with trial_end=now ?

#

It has no impact.

strange matrix
#

I think there might be some confusion — the request where we used trial_end=now was for a different subscription than the one that had already ended its trial.

cunning mural
#

Ah yes true, sorry. But for this Subscription there is already an invoice genered with 0$ amount in_1RDjcpH9QZM8KDuivC2hEKdT

#

Ending the trial period won't generate a new invoice as there was already one freemium invoice

#

Why you want to have two invoices with 0$ ?

strange matrix
cunning mural
strange matrix
cunning mural
#

Here the difference is there was a 0$ invoice already generated, so no new one will be generated

strange matrix
#

To help clarify the behavior, I’d like to walk through the flow with you in real time.
The following customer is currently still in the trial period:
http://dashboard.stripe.com/test/customers/cus_S82M2zXqCPBzBV

If you're able to take a look and confirm the current state, I’ll go ahead and end the trial so we can observe what happens with invoice generation.

cunning mural
#

You are referring to this Subscription sub_1RDmHVH9QZM8KDuiWkQUOmjZ

#

It's in trial period now and it should end on Apr 28

#

And between, there is a freemium invoice generated already for this Subscription between: in_1RDmN4H9QZM8KDuiSvwb3xpb

strange matrix
#

I’ll now update the subscription using trial_end=now to immediately end the trial.

Let’s see together whether an invoice is generated in this case.

cunning mural
#

It won't generated. I explained previously why, you have already a freemimum invoice generated.

strange matrix
cunning mural
#

Why are you expecting a new invoice with 0$ ?

#

There is no change that requires an invoice in this use case

strange matrix
#

We're expecting a ¥0 invoice because it's a way for us to reliably detect when a trial ends in our system.

cunning mural
#

You should rely on this event in your system and not invoice generation customer.subscription.trial_will_end

arctic mountainBOT
strange matrix
#

Thank you, and yes — we understand that customer.subscription.trial_will_end is the recommended way to detect trial endings.
That said, in our previous implementations, we relied on invoice.created with a ¥0 invoice at the time the trial ended, which worked well for our use case.

cunning mural
#

You should update your implementation to use the recommended flow.

#

And listen to the event customer.subscription.trial_will_end and detect when a trial is ended.

strange matrix
#

we’ll look into using customer.subscription.trial_will_end for detecting trial ends going forward.

#

That said, we've seen cases where a ¥0 invoice is generated when the trial ends, and we've been relying on that behavior as well.

Just to be sure, could you help confirm under what conditions a ¥0 invoice will be created when a trial ends?

alpine blaze
#

Hi, taking over as my teammate needs to step away. Let me catch up.

#

I recommend that you test this. Are you able to make the update and look for customer.subscription.trial_will_end event?

strange matrix
#

Thanks — yes, I understand that customer.subscription.trial_will_end is the recommended event to use, and we’ll look into incorporating it.

That said, for now, I'd really appreciate it if you could help confirm under what conditions a ¥0 invoice is generated when using trial_end=now.

We've seen it happen in some cases, but not others — so we're trying to understand that behavior more clearly before finalizing our logic.

#1361301012538720330 message

alpine blaze
strange matrix
#

I’ll proceed to end the trial immediately using trial_end=now.

#

I’ve just ended the trial using trial_end=now.

You can see that two invoices were generated as a result:
https://dashboard.stripe.com/test/subscriptions/sub_1RDmbHH9QZM8KDui5MkKeJJc

Could you help explain why two invoices were created in this case?
We're trying to understand what triggered each one so we can ensure consistent behavior in our system.

alpine blaze
strange matrix
alpine blaze
#

I'm unsure what you mean by that. Are you able to reword this?

strange matrix
#

Sorry to ask again — but could you help me understand why an invoice was generated when we ended the trial using trial_end=now in this request?
https://dashboard.stripe.com/test/workbench/logs/req_U4p7O0Yg8Uf9ZG
https://dashboard.stripe.com/test/workbench/events/evt_1RDmwSH9QZM8KDuiV9JPeoYj

alpine blaze
strange matrix
#

Thanks for all your help so far.

I think we’ll pause the investigation here for now.

We’ve explored various cases and we may need to approach this differently on our side.

Appreciate your time and support!