#mati_best-practices

1 messages · Page 1 of 1 (latest)

ripe dawnBOT
#

đź‘‹ 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/1393090335529373756

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

low kernel
#

hello! can you share the example subscription ids (it'll have the prefix sub_ for what you described?

#

Anyway, without looking at the example subscription ids right now.

https://docs.stripe.com/billing/subscriptions/usage-based/billing-credits#credit-grant-eligibility - the credit grant will only be applied if

  • The invoice’s period_end is on or after the credit grant’s effective_at time.
  • The invoice’s period_end occurs before the credit grant’s expires_at time, if set.

So what you're seeing is expected behaviour.

unfortunately, I don't think there's a way to achieve what you want now.

Grant billing credits to your customers so they can use them to pay for usage-based products or services, memberships, pay-as-you-go plans, or subscriptions. Learn about approved and prohibited use cases for billing credits, how to apply credit grants, and what information displays in the credit balance summary and in credit balance transactions.

lucid heath
#

Give me a sec

#

sub_1RWbUoHGp8wLvXdcZD6nOnum

lucid heath
low kernel
#

Taking a look at the subscription example you shared

lucid heath
#

Yes.

low kernel
#

okay, and which credit grant did you create that you expected to be applied? can you share the corresponding request id (it will have the prefix req_ )or the credit grant object id (it will have the prefix credgr_)

lucid heath
#

Give me a sec.

#

It might be this one credgr_61SlMan3MhkBheWfU41HGp8wLvXdc0rI

low kernel
#

do you have the request id (it will have the prefix req_ )for the billing meter event that you created for that period of time?

I've tried searching for it, but you have so many billing meter events for different customers that it's very difficult to find

#

if you can't find it, I'd really suggest just trying out your flow again and making sure you copy down the relevant ids

lucid heath
#

No problem.

#

Let's me find.

#

req_20YUyQDTIVo3th

#

req_20YUyQDTIVo3th

low kernel
#

thanks for tracking down those IDs! So unfortunately, like I mentioned before, the criteria below isn't being fulfilled

The invoice’s period_end occurs before the credit grant’s expires_at time, if set.

Which is why the credits aren't being applied.

Now, if you really want a workaround or alternatives, you can't use credit grants at all.

The only straightforward idea that comes to mind here, is to track the credit that you want to give in your own database, and then apply a one time amount discount to the subscription for that credit. The discount should be reflected in the invoice that is generated.

You'll want to test this out to see if it meets your requirements