#fallen-subscription-discount

1 messages ยท Page 1 of 1 (latest)

primal dockBOT
near snow
#

Hi ๐Ÿ‘‹

always_invoice does not create prorations but instead cuts an invoice at the time of the change, so the charges cover everything up to the change to the Subscription.

#

Prorations + discounts is a very tricky subject and the way Stripe handles it is counter-intuitive

late scroll
#

oh boy, im sure im going to hate this explanation ๐Ÿ˜†

near snow
#

Well that's about all I've got so far

late scroll
#

okay, so here's a senario...

near snow
#

Please just send me the API request ID

late scroll
#

๐Ÿ‘ one sec

near snow
#

for the change with create_prorations that doesn't do what you expect

late scroll
#

req_iBnEQGFXwOEvbj

#

where as req_uWT0DRM9SqLAZb gives me the prorated amounts i expect but not the discount amount for the coupon

near snow
#

Wait...so which one is the problem you are describing? Let's focus on one scenario at a time here

late scroll
#

the root issue is when i preview an update with always-invoice for the proration behavior the total_discount_amounts.amount field is 0

#

but if i set it to create_prorations the discounts are returned but the amounts are not prorated as i'd expect.

near snow
#

Those settings perform entirely different actions, as I explained.

late scroll
#

so i guess the question is.... is there a way i can do "always-invoice" and get back the correct discount amount fields for my coupons?

near snow
#

Are these coupons that were applied before the change you are attempting to make?

late scroll
#

yes

near snow
#

And that is the first request ID?

late scroll
#

both already have the coupon applied to the customer

#

but yeah the first request id has the correct total_discount_amounts value

#

if i need to i can calculate the discount amount on my end but my goal is to have stripe as the source of truth

near snow
#

Ah wait you are talking about the previewing upcoming invoices. Unfortunately I cannot see the output there

late scroll
#

correct

#

one sec i can send you the output

#

this is with always_invoice set

#

this is with create_prorations set

near snow
#

I don't need to see most of this, right?

#

You are saying the issue is with the discount property?

late scroll
#

what im seeking is the top response but with the total_discount_amounts property to have values

#

or really anywhere, i just need to know how much that coupon took off

near snow
#

Okay so these outputs are too big for me to even see what you are referring to

late scroll
#

first request...

#
    "total_discount_amounts": [
        {
            "amount": 0,
            "discount": {
                "checkout_session": "",
                "coupon": null,
                "customer": null,
                "deleted": false,
                "end": 0,
                "id": "di_1MUyi8KjI0M1O6BOixz64pIT",
                "invoice": "",
                "invoice_item": "",
                "object": "",
                "promotion_code": null,
                "start": 0,
                "subscription": ""
            }
        }
    ],```
#

second request...

#
    "total_discount_amounts": [
        {
            "amount": 14400,
            "discount": {
                "checkout_session": "",
                "coupon": null,
                "customer": null,
                "deleted": false,
                "end": 0,
                "id": "di_1MUyi8KjI0M1O6BOixz64pIT",
                "invoice": "",
                "invoice_item": "",
                "object": "",
                "promotion_code": null,
                "start": 0,
                "subscription": ""
            }
        }
    ],```
near snow
#

Okay and in this case the second request shows the 20% off coupon being applied

late scroll
#

so is it just that the coupon has no affect on the proration being requested?

near snow
#

What is the change you are making here?

late scroll
#

altering the units on the subscription to a higher amount

near snow
#

Okay so you've got a 20% off coupon that is being applied to all prices for a given customer.

#

And you are increasing the quantity in two subscription items

late scroll
#

correct

near snow
#

So the prorations should be the difference between the old quantities +discountfor the full billing period and the new quantities + discount for the full billing period

#

Does the amount appear incorrect?

late scroll
#

the new discount amount is always zero though

near snow
#

I understand that, I'm just trying to double check how everything is being applied first.

late scroll
#

correct, then the first response the amounts are what i expect

near snow
#

Okay, so that part is working. Good

#

And the first one is always_invoice or is that second one?

late scroll
#

the first one

near snow
#

Th3FalleN sub discounts

late scroll
#

oh lawd, it's the big guns. i done dun it now

icy lotus
#

fallen-subscription-discount

late scroll
#

sooo any ideas?

icy lotus
#

Sorry I totally misunderstood you were waiting on us when I took over

late scroll
#

no worries

icy lotus
#

sorry Discord is super busy. All you're asking is why total_discount_amount is not set? Or something else?

late scroll
#

yeah, in a nut shell i need to know the amount of discount applied to the proration

icy lotus
#

Yeah that's not possible today unfortunately, we don't surface it in that case

late scroll
#

so, we'll need to do that calculation ourselves

icy lotus
#

yeah it's something we want to fix

late scroll
#

that hurts my brain, but alrighty i'll get on it. thanks for your input as always

#

oof yeah so the prorated amount does indeed include that coupon in it's total calculation. which makes things even worse dead

icy lotus
#

yeah we basically apply the coupon during the proration but we don't surface back the calculation I think

late scroll
#

that's a hell of a wrench in my ui's gears ๐Ÿ˜ญ

#

time to get working on fixing that

#

thanks as always gents