I have a problem with configured "COPYandPAY API".
When user click button "Pay now" I would like to do some action and if result of that action will be "true" then submit payment form. Otherwise not allow submit.
I checked documentation and found I can use function "onBeforeSubmitCard()", but documentation says this function "Overrides the internal submit function." I tried use "this.submit();" but then I get error from "hyperpay": "Payment Failed: invalid or missing parameter". If function return "true" then nothing happens.
So how can I submit form when use function "onBeforeSubmitCard"?
onBeforeSubmitCard: function (e) {
$.ajax({
url: route('home.cart.check'),
type: 'get',
success: function success(response) {
this.submit();
},
error: function error(result) {
toastr.error(result.message);
return false;
}
});
}