I am using a checkout overlay from PayPal as described here. In order to trigger, there is a form which will be validated via formsy-react, the form itself works fine.
Now, I need to fire the formsy validation manually, because the PayPal-Button from paypal-checkout (see link above) is not part of that form.
We need to call the Backend before the paypal payment will trigger, because we have to set states before, during and after the payment process.
Due to laws we must validate acceptTermsAndConditions before the PayPal payment server- and clientside. That's why I need to validate the form before the payment.
So we tried to fire the formsy-validation process via the payment function:
payment: function(data, actions) {
Formsy.Form.validate(); // this wont work
if (Formsy.Forms.isValid()) {
// call backend
// then do
return actions.payment.create({
payment : {
transactions : [
{
amount : { total : '500', currency : 'EUR' }
}
]
}
});
}
},
Any help is very appreciated.
I ended up using the PayPal-built-in-validator shown here
It is not the best way, but it will work.