HELP: SCA - migrating SQPaymentForm to Web Payments SDK - PHP

OK, I’m doing pretty much the same thing.

Sadly, nost in in Javascript, but if you have the actual payment part working, here’s what I did.

in the paymnet_flow.js file, at the bottom, I added an extra bit, whereby if all is good with the payment itself (which is in it’s own nested form) the following:

if (data.errors && data.errors.length > 0) {
      if (data.errors[0].detail) {
        window.showError(data.errors[0].detail);
        
		document.getElementById('card-button').disabled = false;
      } else {
        window.showError('Payment Failed. Please reload this page and try again.');
      }
    } else {
    	document.forms['theForm'].submit();
		
    }
  } catch (error) {
    console.error('Error:', error);
  }
}

The key part is:

document.forms['theForm'].submit();

as this submits the wrapper form (my actual form) which is set to my ‘extra_stuff_to_do.php’ page.

I already have, in that proper form (the one you and I know as it’s PHP) the amount, client info, order ID, etc

This means in my ‘extra_stuff_to_do.php’ I can process this, update a database, send an email, etc.

It’s a mess of a setup, but this new payment flow things is just plain bad all round.

My solution worked though! Which is basically all that mattered!