#mp_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1370390516289765487
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Success req id: req_XMSO1MDlmxPfQM
hey there, taking a look at these
Thank you
error: {
message: "You must credit invoice line item il_1QpySEJqE5f9ucQhkemoDgrk using amount and not quantity, this is because il_1QpySEJqE5f9ucQhkemoDgrk is a proration line item and has no unit_amount.",
request_log_url: "https://dashboard.stripe.com/logs/req_0UiRNXNCjV7DLL?t=1746788495",
type: "invalid_request_error",
},
In the failing example, the line item is a proration so you need to credit an amount
In the successful example, it is not a proration, so you can create a credit note for the line by quantity
How can we find the correct amount?
User has paid for 5 quantities but we need to refund for 2
Do you mean how to get the full amount for that lines proration?
Correct
Looking at the line item object on the invoice you can check if it is a proration using the proration attribute:
https://docs.stripe.com/api/invoice-line-item/object?lang=curl&api-version=2024-10-28.acacia#invoice_line_item_object-proration
and then get the amount from the amount attribute if you want to issue a "full" credit note:
https://docs.stripe.com/api/invoice-line-item/object?lang=curl&api-version=2024-10-28.acacia#invoice_line_item_object-amount
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If you only want to credit for some of the seats, you'll need to calculate that from the amount & quantity yourself
Say the prorated amount is ~600 ish and as here it is for quantity=6 seats. If you want to credit for 2 of 6 you could do amount * (credit quantity / line quantity) = 600 * (2/6) = 200
Can you say more about this? I would not expect this to matter, you should be able to view the invoice object and line items via the API.