#angieology - Invoices
1 messages · Page 1 of 1 (latest)
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
If you pass in the Customer's coupon in the coupon property does it work as expected? https://stripe.com/docs/api/invoices/upcoming#upcoming_invoice-coupon
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
It sounds like the Coupon you're using doesn't apply to those items
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
Can you paste the coupon ID here?
but you're saying that if I get an invoice for an upgrade plan, i need to also pass the coupon?
'25-percent-discount'
Oh, sorry, I should have asked for the Discount ID.
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
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.
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
price_1JHxMdJOFr5bbosldZo9EKrA
Looking back at the original Subscription creation request it looks like the coupon is being passed in as a one-off and is not attached to the Customer beyond that: https://dashboard.stripe.com/test/logs/req_aoOCatjGdfxGPU
That explains why no discount is shown if you don't specify coupon when getting the upcoming Invoice.
at the time of first purchase?
Yeah, when the Subscription was created.
how do I attach the coupon to the customer?
I guess its in update customer API https://stripe.com/docs/api/customers/update#update_customer-coupon
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yep.
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?
👋 I'm hopping in for @lone mesa - give me a minute to catch up!
it actually seems like the response is correct, I may be reading the response incorrectly.
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
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
If you're looking for the amount due for a specific line item then yes, it would be at amount not plan.amount
ok i have no issue, that is the correct amount