closes #427 - fix 'unknown error' message on failed transactions in WP
AJAX requests call exit()
, which triggers callbacks from register_shutdown_handler()
. On WordPress, this causes headers to be sent (by ob_end_flush()
. So AJAX requests always return a 200
HTTP response code. civicrmStripe.js
expects a 500
code to display an error on-screen.
To replicate this, try to submit a card number that gets declined on WordPress. The test card for this is 4000 0000 0000 0002
.
Without this patch, you get Unknown Error
- with this patch you'll see the correct message.
Note that without the correct permission, you won't even get Unknown Error
, you'll get Sorry an error occurred and your request was not completed. (Error ID: xyz)
. That needs a separate fix - in core, I believe.