#mp_api

1 messages ¡ Page 1 of 1 (latest)

naive fjordBOT
#

👋 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.

stable kraken
#

Success req id: req_XMSO1MDlmxPfQM

slim frost
#

hey there, taking a look at these

stable kraken
#

Thank you

slim frost
#
 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

stable kraken
#

How can we find the correct amount?

slim frost
#

What do you mean?

#

You're issuing a credit note, so you can determing the amount

stable kraken
#

User has paid for 5 quantities but we need to refund for 2

slim frost
#

Do you mean how to get the full amount for that lines proration?

stable kraken
#

Correct

slim frost
#

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

#

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

stable kraken
#

Got it. Thank you

#

Because the invoice is >30 days old I cannot see the attribute

slim frost