#elBR

1 messages · Page 1 of 1 (latest)

sonic whaleBOT
foggy depot
#

Hey, can you share some example request IDs req_xxx

#

And the payload responses

#

(truncate them to highlight differences)

noble barn
#

yes

#

I am sharing you the code

#

as you can see the two requests are the same appart the coupon code

#

that coupon code is a $10 coupon

#

if I call both of them, the difference is not $10

foggy depot
#

And the responses to those API calls?

#

i.e. what are the differences?

#

Ok, this is the issue I suspect:

When you make changes to a subscription, any existing discounts are applied when proration is calculated. You can’t discount proration line items further on the invoice that’s generated.
https://stripe.com/docs/billing/subscriptions/coupons#:~:text=When you make changes to a subscription%2C any existing discounts are applied when proration is calculated. You can’t discount proration line items further on the invoice that’s generated.

Add a discount to a subscription using coupons and promotion codes.

noble barn
#

is not that case

#

you see that I am making the same call

#

and a discount is applied

#

just that the difference is not $10

foggy depot
#

You need to share the full JSON responses, You've deleted them

#

There was a marginal difference in the amount (likely due to the time the requests were made - we prorate to the second)

noble barn
#

Without coupon:

foggy depot
#

That's not the full JSON response. I need to see the line items

noble barn
#

With coupon:

#

ah ok

foggy depot
#

If you just paste the line items JSON from both responses, the issue will be clear

noble barn
foggy depot
#

That's unreadable I'm afraid. Can you just paste the JSON (not an image) and format it?

noble barn
#

ok

#

the difference as you can see is not $10 but has a difference of some cents

foggy depot
#

Yeah, the difference is 956 ($9.65). Which likely accounts for the difference in time between the requests, which is crucial when prorating changes (we calculate proration to the second)

noble barn
#

no is not

#

the requests are made in the same time

#

please make a test

#

with the data that I already sent you

foggy depot
#

1665140176 -> Fri Oct 07 2022 10:56:16 GMT+0000
1665140287 -> Fri Oct 07 2022 10:58:07 GMT+0000

I see almost 2 minutes difference

noble barn
#

I can try again

#

but is the same

#

the difference will be in cents

foggy depot
#

Please can you pass the subscription_proration_date parameter as I explained

noble barn
#

ok

#

and what value to give?

#

what format

foggy depot
#

A unix timestamp for a value for a time in the future that you want the response to reflect

noble barn
#

ok thanks

#

again, not the same result

#

not the same difference so

foggy depot
noble barn
#

req_AgoXwWb1W5y4fE

#

req_OipOWiQhCIlqmj

#

as you can see the parameters are the same and changes just the coupon code

#

and the total difference is not $10

foggy depot
#

Can you share the JSON please

#

I suspect the coupon amount is also prorated

noble barn
foggy depot
#

Thank you

#

Checking on this

weak copper
#

ok thank you

#

please let me know

foggy depot
#

Ok, thanks for your patience here whilst I worked through this with a colleague. As expected, the discount applied (982, or $9.82) is a prorated amount of the $10.00 coupon to reflect the remaining time in the billing period (98%):

  • The subscription's current period start is 2022-10-06 10:23:01
  • You fixed the proration date in your request to 2022-10-07 00:00:00
  • That is leaves roughy ~98% of the current billing period in which we are prorated values
weak copper
#

so the coupon also gets prorated

#

but checking the invoice saved on Stripe it says -10$ coupon code

#

and this is not clear to the customer

foggy depot
#

That's true, and valid feedback

thin agate
#

👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

weak copper
#

but is there any way to not prorate the coupon?

#

I want it to be fully applied

#

because otherwise I have no way that Stripe tells me the prorated amount of the coupon

#

so that I can inform my customer

thin agate
#

AFAIK there isn't a way around this

thin agate
#

I was trying to think about a solution but the only one that came to mind was making 2 request as you did already (one with and one without the coupon) and calculate the difference

weak copper
#

thanks

thin agate
#

sorry I wasn't that more helpful