#angieology - Invoices

1 messages · Page 1 of 1 (latest)

lone mesa
#

Hello! Can you share the code you're using to get the upcoming Invoice?

slim shell
#

I'm sending my current subscription in subscriptions arg, and the new price to upgrade to in subscription_item

#

^ method just calls one that spreads that args object into a stripe call

lone mesa
slim shell
#

I've tried that and it didn't seem to make a difference, I will try again now

#

i've added the coupon and the discount amount is 0

#

in lines.data the items have discountable: false

lone mesa
#

It sounds like the Coupon you're using doesn't apply to those items

slim shell
#

in the documentation, it says the exisitng coupons on the plan will be applied

#

I see them being applied if i get the upcoming invoice for the current plan

lone mesa
#

Can you paste the coupon ID here?

slim shell
#

but you're saying that if I get an invoice for an upgrade plan, i need to also pass the coupon?

#

'25-percent-discount'

lone mesa
#

Oh, sorry, I should have asked for the Discount ID.

slim shell
#

oh i might have an error looks like i'm passing the whole class, not the string

#

that is on the dashboard?

#

i'm searching the coupon section

#

di_1JwDtzJOFr5bboslPufjnwkj is the one from my response payload

#

hm doesn't exist on my stripe dashboard

lone mesa
#

Let me look...

#

Ah, that must be from the upcoming Invoice, it doesn't seem to exist. I was hoping to get the Discount ID from the existing Subscription where the coupon is working as expected.

slim shell
#

oh i see

#

i can get that

#

di_1JwCmaJOFr5bboslHUgGEruI

#

this is what discount I get on the current subscription upcoming invoice (no upgrade, no coupon param)

#

just the exisitng coupon

lone mesa
#

Looking, hang on...

#

What's the plan/price you're trying to preview the switch to?

slim shell
#

price_1JHxMdJOFr5bbosldZo9EKrA

lone mesa
#

That explains why no discount is shown if you don't specify coupon when getting the upcoming Invoice.

slim shell
#

at the time of first purchase?

lone mesa
#

Yeah, when the Subscription was created.

slim shell
#

how do I attach the coupon to the customer?

lone mesa
#

Yep.

slim shell
#

thanks alot.

#

was stuck on this for a couple days, will try this

#

I send coupon info when creating customer, and the discount didn't apply di_1JwERGJOFr5bbosllh28LXxX

#

customer cus_KbRJlue2EGHbCX

#

or is it something I have to calculate from these amounts?

coarse meadow
#

👋 I'm hopping in for @lone mesa - give me a minute to catch up!

slim shell
#

it actually seems like the response is correct, I may be reading the response incorrectly.

coarse meadow
#

Just to make sure I understand - your core issue is that you have a customer discount set, but it doesn't seem to be applying to the upcoming invoice like you expect it to

slim shell
#

yes, but I think the issue is solved, becuase I do see the correct price in the response object, i'm just a little confused how to read it. my current code is reading the plan.amount which is not the correct price

#

does this represent the new recurring charge to the customer after upgrade?

#

oh no, that's the old plan price

#

it should be this. I'm using plan.amount but I should be using .amount

coarse meadow
#

If you're looking for the amount due for a specific line item then yes, it would be at amount not plan.amount

slim shell
#

ok i have no issue, that is the correct amount