#smp_api

1 messages · Page 1 of 1 (latest)

tranquil sinewBOT
#

👋 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/1245021500193640578

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

civic plover
#

Hi 👋 can you elaborate a bit on what you're doing seeing? The logs for that request, made from your PHP code, show that it returned the same error you said the CLI returned.

gloomy timber
#

Yeah, I bascially want to redirect my user when a stripe error occurs, unless for example an error like a finalized invoice being finalized again occurs

#

But the message code is missing on the php log

#

i get this in my dashboard logs for php request (req_EAwCocTUnWH0ST) {
"error": {
"message": "This invoice is already finalized, you can't re-finalize a non-draft invoice.",
"request_log_url": "SITE",
"type": "invalid_request_error"
}
}

#

and this for stripe cli

#

(req_6KEeXtWz83Bmf6) {
"error": {
"message": "Diese Rechnung wurde bereits fertiggestellt. Sie können eine Rechnung, die kein Entwurf ist, nicht erneut fertigstellen.",
"message_code": "draft_invoices_only",
"request_log_url": "SITE",
"type": "invalid_request_error"
}
}

#

The message code is missing on the php made request and I want to know why it doesnt appear for php

#

I could also do the same for the message itself but chances are high that due to a future update or change in language this wont work properly for me so it would be nice to have the message code

civic plover
#

Thank you for your patience. I've confirmed with a teammate that message_code is not expected to be returned to you. It seems we return it to ourselves as part of our dashboard requests currently, but it's not exposed in requests made by your server.

gloomy timber
#

Damn, okay but thanks for your investigation. Gotta try a workaround then, unless you know another way of returning a value that shows whether request didnt work because of refinalization

#

Nvm I think I'm just gonna check finalization status after getting invoice data and depending on that I will finalize the invoice again. Thank you!

civic plover
#

Yeah, double checking the status of the Invoice may be the best approach, but I'll let you know if I hear a smoother option!

#

My teammate confirmed checking the status of the Invoice, either before if you want to try to mitigate the error or after if you want to try to recover from it, is the best option here.

gloomy timber
#

So just to be clear. You also mean checking for $invoice>->status_transitions['finalized_at'] being empty before finalizing is what you mean right?

civic plover