#brometheus_subscription-discount

1 messages ¡ Page 1 of 1 (latest)

molten notchBOT
#

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

fresh solar
#

@viscid sapphire usually you do this with a Coupon for example for 50% off once

#

brometheus_subscription-discount

viscid sapphire
#

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

fresh solar
#

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

  1. Create -$5 InvoiceItem ii_123
  2. Create Subscription for $15/month Price
  3. This creates the Invoice in_123 that has 2 lines, one for $15 and one for the -$5 credit
viscid sapphire
#

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

fresh solar
#

sure!

viscid sapphire
#

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
fresh solar
#

yeah then you create the InvoiceItem later in that case.

viscid sapphire
#

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