When Stripe is selected as the payment method, it doesn't let you go back and it pop=up an error saying "This card number looks invalid"

Comments

bradhawkins’s picture

I've noticed this problem myself and I'm glad you posted the issue so we can get it addressed. The problem itself can be found in commerce_stripe.js. Sorry I don't have time to roll out a patch, but here's the change that I made to fix the error.

Around line 12 find this:

$('#commerce-checkout-form-checkout, #commerce-checkout-form-review').submit(function(event) {

and change it to this:

$('#commerce-checkout-form-checkout #edit-continue, #commerce-checkout-form-review #edit-continue').click(function(event) {

I've been using this altered code on my site and haven't noticed any errors, but please let me know if you find any in your testing. And hopefully someone else can roll this into a patch, I'm just not setup to that right now and probably wont be able to for some time.

bennybobw’s picture

This won't work if you have commerce_coupon enabled. You'll have to expand it to:

$('#commerce-checkout-form-checkout #edit-continue, #commerce-checkout-form-review #edit-continue').click(function(event) {
$(this).addClass('auth-processing');

And in the stripeResponseHandler:

 $btnTrigger = $('.form-submit.auth-processing').eq(0);

If there's an error remove the class, if not

var trigger$ = $("<input type='hidden' />").attr('name', $btnTrigger.attr('name')).attr('value', $btnTrigger.attr('value'));
form$.append(trigger$);
janip’s picture

Status: Active » Needs review

Pushed the following to 7.x-1.x-dev:

"When Stripe is selected as the payment method, it doesn't let you go back and it pop=up an error saying "This card number looks invalid"": Fixed with code provided by bradhawkins and bennybobw"
http://drupalcode.org/project/commerce_stripe.git/commit/ba6eb6b

iler’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.