Receiving a JSON Object for a Provider Error Message

Cloud Elements has standardized error messages across the variety of providers that we support as a string. You can remove the formatting created by the Cloud Elements platform and have the error return as a JSON string which can be easily converted into a JSON object. To do this, you will need to add some JS to your resource posthook: 

if (response_iserror){
 done({response_error_message: response_body_raw})
} else {
  // JS Block
}

done({})