Can you please help with the Regex syntax to extract the “message” section of the below raw stripe error. In this case, the message I am trying to extract is “Your card was declined.” - however, I would like to use a generic approach that will work on all similar Stripe error messages please.
Raw error from Stripe.js Plus - Update a customer's details: {
"error": {
"message": "Your card was declined.",
"type": "card_error",
"param": "",
"code": "card_declined",
"decline_code": "generic_decline"
}
}
I am open to other ideas too on how to accomplish the same result without Regex. Essentially, I am trying to populate a generic alert with the correct stripped-down error message from Stripe. Thanks for the help!