#Jonas Reif

1 messages · Page 1 of 1 (latest)

frigid sandalBOT
wicked breach
#

Hi there

#

The discount should appear on the next invoice

#

Where are you not seeing it exactly?

brisk widget
#

Here in the customer portal the price is still 348€ but the user has added the off once coupon already. So there is no indicator that the price will be 278€ on the next invoice

wicked breach
#

Gotcha

#

Give me a moment to dig

brisk widget
#

thanks 🙂

also when I retrieve the subscription via api there is no discount on the subscription

So subscription.discount is null

wicked breach
#

Hmm that's strange... I do see a discount associated with that Sub

brisk widget
#

hm ok. Let me check again

#

ah correction,
I see the discount, but not the amount_off

"discount": {"id":"di_1MoQLPAHqm7DWpwQJMHJliie","object":"discount","checkout_session":null,"coupon":{"id":"h8L63FK5","object":"coupon","amount_off":null,"created":1679423320,"currency":null,"duration":"once","duration_in_months":null,"livemode":false,"max_redemptions":null,"metadata":{},"name":"test","percent_off":20.0,"redeem_by":null,"times_redeemed":4,"valid":true},"customer":"cus_NZUimg0V3TQY0K","end":null,"invoice":null,"invoice_item":null,"promotion_code":null,"start":1679486443,"subscription":"sub_1MoLipAHqm7DWpwQTjQN0SUF"}
#

but in billing portal I dont see any info that the next invoice will be 20% off

wicked breach
#

Ah okay yeah

#

So actually as the tweet indicates you applied a once-off coupon

brisk widget
#

ok.
What should I do instead? We are using both yearly and monthly subscriptions

#

Do I have to create 2 coupons
one repeating for 1 month for monthly subscriptions
and one repeating for 12 month for yearly subscription?

wicked breach
#

Well do you want the discount to be repeating? Or you just want it to apply to the next invoice?

brisk widget
#

just to the next invoice.
For yearly for one year, for monthly one month

#

ok. Seems to be working for yearly at least.
Have to double check if its also working for monthly

wicked breach
#

Yep having it be repeating and combining with duration_in_months is probably the way to go here

brisk widget
#

ok thanks for your help.
To get the amount of the next invoice I have to make another call to the api right? or could I extend the retreive subscription to also get the next upcoming invoice amount?

wicked breach
brisk widget
#

alright, thought that there is an easier way instead of making another api call

wicked breach
#

No the upcoming invoice information won't be returned on the update request

brisk widget
#

ok.
But could I expand a subscription retrieve call to get upcoming invoice?

#

Otherwise I need after update 2 other api calls.

  1. upcoming invoice api call
  2. retrieve subscription api call (since we have to store some more other values, which are not returned in the updated request)
wicked breach
#

No you can't expand to see upcoming invoice. You will need a separate API call for that. What values are you not seeing in the update request that you want?

#

You can expand responses in your update request as well

#

So you shouldn't need to retrieve the Sub again

brisk widget
#

ah ok great.
will then try that.
Then one additional api request is fine to get that upcoming amount

Thanks for your help! 🙂