Hello sorry for the delay, here is the code:
<script>
jQuery("#get-otp").on('click', function(e) {
e.preventDefault();
jQuery.ajax({
type: "POST",
url: "https://e-ly.shop/wp-admin/admin-ajax.php",
data: {
action: 'send_user_otp',
phone_number: 0914864917,
birthyear: jQuery("input[name='birth_date']").val(),
order_id: 3204,
order_total: 50.00,
token: '***********************************',
url: 'https://pgw.almadar.ly/api/',
category: 20 },
success: function(response) {
if (isNaN(response)) {
alert(response);
console.log(response)
} else {
let transactionID = response;
jQuery("#transaction_id").val(transactionID);
}
}
});
});
jQuery("#pay_sadad").on("click", function(e) {
e.preventDefault();
e.preventDefault();
jQuery.ajax({
type: "POST",
url: "https://e-ly.shop/wp-admin/admin-ajax.php",
data: {
action: 'pay_invoice',
transaction_id: jQuery("#transaction_id").val(),
OTP: jQuery("#OTP").val(),
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiU2FkYWRQR1ciLCJjb3Jwb3JhdGVTZXJ2aWNlSWQiOjEzNTAsImFwcElkIjoiZmE1MjhiY2Q5ZjRiNGZiZWExYzRmOTI4ZTU3Nzg3NzkiLCJleHAiOjE2NTM2NTI0NzEsImlzcyI6IkNvcmV0ZWMiLCJhdWQiOiJTQURBRFBHVyJ9.CL6M9gmbvk698m5lExmIn734pTEbU6dIMbYBRI013ho',
url: 'https://pgw.almadar.ly/api/',
},
success: function(response) {
console.log(response);
if (response == 0) {
jQuery.ajax({
type: "POST",
url: "https://e-ly.shop/wp-admin/admin-ajax.php",
data: {
action: 'update_order_on_success',
order_id: 3204,
},
success: function(response) {
window.location.href = response;
}
});
}
}
});
});