Closed wozaki closed 3 months ago
@wozaki The message_code
property on the Error
API resource is not a public feature. It does exist but it's purely internal to Stripe and shouldn't be exposed anywhere in the public API today (though you can sometimes see it in error messages on the Dashboard or via Workbench. This means we wouldn't add this feature to our public server-side SDKs.
Can you confirm that this maps to what you were seeing and that you do not see this property in our public API today?
@remi-stripe
Thank you for your review.
Upon further review, I confirmed that the message_code
property only appears in error responses via the Dashboard.
I also understand that it should not be used in the public API at this time.
I will go ahead and close this Pull Request.
Background Summary
The current
Error
struct does not include a field to store themessage_code
. This requires writing additional code to extract themessage_code
fromRawJSON
when handling specific errors, such as checking if an invoice is already paid.Detailed Description
When executing
POST /v1/invoice/:id/pay
on an already paid invoice, the following error is returned:Currently, since the
Error
struct does not have a field that includesmessage_code
, it is necessary to write code to extractmessage_code
fromRawJSON
.The example of Before and After of this modification is as follows: