#waldeedle_api
1 messages ¡ Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- waldeedle_subscription-proration, 1 day ago, 19 messages
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1248456105110147145
đ Have more to share? Add details, code, screenshots, videos, etc. below.
I just want to make sure that the invoice object is built how I think it is, all line item discounts also appear at the invoice level under the discount amounts object
that would be the aggregate amount. I think you still need to look at line item level for each item discount
You can test it in Test mode
I just mean the actual discount object, not looking for amounts. moreso looking at discount.coupon or discount.promotion_code.coupon
discount is deprecated. Look at discounts instead.
let me be specific:
Does invoice.total_discount_amounts include all the discounts found under invoice.lines.data.discount_amounts and I literally mean the discount object so I can check either the discount.coupon or the discount.promotion_code.coupon using invoice.total_discount_amounts?
{
"lines": {
"data": [
{
"discount_amounts": [
{
"amount": 0,
"discount": "di_1POkZ7KjI0M1O6BOjcBYsSRE"
}
],
}
]
},
"total_discount_amounts": [
{
"amount": 0,
"discount": {
"id": "di_1POkZ7KjI0M1O6BOjcBYsSRE",
"coupon": {
.....
},
"promotion_code": {
........
},
}
}
]
}
it seems like its true based on my testing
but i cant confirm in all cases and dont see it mentioned when I read the invoice object docs
I agree with the first half, but not sure when you mention discount.coupon.
Does invoice.total_discount_amounts include all the discounts found under invoice.lines.data.discount_amounts?
that half?
thats more than fine lol
but just for your understanding the json I just sent above I was going to create a map of discount.ids to the discount object from total_discount_amounts and then just loop through lines.data.discount_amounts matching based on the id
ah you mean the discount object under total_discount_amounts
Sorry I misunderstood with another discount object at the Invoice object level
oh the deprecated one, yeah no no sorry I could've been more clear
so my idea works then?
Just 1 concern, what if you have multiple items, each has different discount
How would the total_discount_amounts.discount object look like
I'm preeeeettty certain I checked that but lemme revalidate, I'll paste the edited object here once I get it
{
"id": "in_1POsdsKjI0M1O6BOrsrRgfpr",
"object": "invoice",
"discount": null,
"discounts": [
"di_1POpTnKjI0M1O6BOQRUoOzmq",
"di_1POsYQKjI0M1O6BO2F95rsxv"
],
"lines": {
"object": "list",
"data": [
{
"discount_amounts": [
{
"amount": 0,
"discount": "di_1POpTnKjI0M1O6BOQRUoOzmq"
},
{
"amount": 0,
"discount": "di_1POsYQKjI0M1O6BO2F95rsxv"
}
],
"discountable": false,
"discounts": []
},
{
"discount_amounts": [
{
"amount": 0,
"discount": "di_1POpTnKjI0M1O6BOQRUoOzmq"
},
{
"amount": 0,
"discount": "di_1POsYQKjI0M1O6BO2F95rsxv"
}
],
"discountable": false,
"discounts": [] }
],
"total_discount_amounts": [
{
"amount": 0,
"discount": {
"id": "di_1POpTnKjI0M1O6BOQRUoOzmq",
"coupon": {...},
"promotion_code": {...},
}
},
{
"amount": 0,
"discount": {
"id": "di_1POsYQKjI0M1O6BO2F95rsxv",
"coupon": {...},
"promotion_code": {...},
}
}
]
}
so this is a prorated invoice and it has both discounts in the total_discount_amounts object
and if I update the subscription to drop a discount only 1 discount in the total_discount_amounts object which matches the 1 in the lines.data.discount_amounts
Yeah it's working as expected!