#brometheus_subscription-discount
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/1270868511186751548
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
@viscid sapphire usually you do this with a Coupon for example for 50% off once
brometheus_subscription-discount
I'm doing something kinda complex where I'm doing this as part of an upgrade from one subscription to another - for reasons, I want to calculate the proration from cancelling the old subscription, then cancel the old subscription, then create a new subscription and apply that proration as a discount
So every customer who upgrades I would expect to have a unique $ amount of credit I would apply based on what the proration calculation was
Does Coupons support that? Or will it lead to a lot of old objects
that would be a lot of objects I'd say
In that case the best option is likely to create an InvoiceItem for the specific amount you want to offer a credit with the right description and then when you create the Subscription it will pull that pending InvoiceItem into it automatically and add it to the first Invoice
- Create -$5 InvoiceItem ii_123
- Create Subscription for $15/month Price
- This creates the Invoice in_123 that has 2 lines, one for $15 and one for the -$5 credit
ah you can create an InvoiceItem attached to a customer, and it'll automatically get added on to whatever that customer's next invoice is?
cool, I'll try that out
sure!
would love to be able to create that InvoiceItem in the same call as subscription.Create so I can be sure nothing else will swoop in and steal my just-created InvoiceItem onto their Invoice
(and for better request idempotency - if my workflow fails halfway through after creating the InvoiceItem but before creating the Subscription, then they have an extra discount)
but I think it's good enough
thank you!
ah, one more wrinkle, I'm possibly going to delay creation of that first real invoice for the Subscription, either:
- creating a trial (I think these always automatically create $0 trial invoices, which I suspect would incorrectly grab this floating InvoiceItem. I want it to be on the first non-$0 invoice for the subscription)
- using billing_cycle_anchor to delay the invoice creation
yeah then you create the InvoiceItem later in that case.
My feature request here (can pass on to the appropriate team) would be to expand Subscription.Create add_invoice_items parameter, to allow creating an InvoiceItem in the Subscription Create call, that appears on the first Subscription invoice, but has a similar interface to creating a new Invoice Item from scratch, passing details like:
amount=-14966,
currency="usd",
description="20 seats discount",
period={
"start": 1723070232,
"end": 1724279843,
},
but without tying it to either a Price/Product object, or to a Discount