0

First, thanks in advance for any insight.

I have successfully set up cartthrob to process payments with Stripe and I have one final UX hurdle to cross over: the checkout_form doesn't seem to honor the error_handling="inline" parameter.

For example: if I try to submit the form with an incomplete credit card number, instead of triggering the inline error, I get a JavaScript dialog, "The page at...says, Your card number is incorrect." As a test, I switched to another gateway in the Payment Gateway configuration panel, submitted the form again with an incomplete credit card number and, expectedly, CartThrob properly triggered the inline error.

Has anyone come across, or better yet, circumvented this behavior? I know that Stripe requires relies on JavaScript to process its credit cards, so I suspect this is tied to those requirements, but it seems as though one should still be able to handle the errors inline. The inability to is a major bummer for UX.

Cheers,

Chris

2

You can override the default behavior by setting a custom error handler. Make sure this code comes after your checkout_form.

<script>
CartthrobTokenizer.setErrorHandler(function(errorMessage){
  //do what you want with the errorMessage. the default behavior is to alert() it
  //something like $("#alert-box").html(errorMessage).show();
});
</script>
0

It is indeed due to Stripe's JS. I don't currently have a workaround, but I'll be looking into it shortly as CartThrob.com & Mightybigrobot.com will both be switching to Stripe soon.

1
  • Thanks for the prompt reply. Do think it would be possible to listen for and capture the error, prevent the dialog and then display the error inline? Possibly using jQuery? – Chris Jan 18 '14 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.