I need to redirect to a URL after the payment completed
I used the code provided in the documentation
<script src="https://ap-gateway.mastercard.com/checkout/version/52/checkout.js"
data-error="errorCallback"
data-cancel="cancelCallback"
data-complete="completeCallback"
data-afterRedirect="restorePageState"
return_url="{{url('confirm_is_paid/'.$Recipt->id.'/'.$Recipt->security_code)}}"
>
</script>
<script type="text/javascript">
function errorCallback(error) {
console.log(JSON.stringify(error));
}
function cancelCallback() {
console.log('Payment cancelled');
}
Checkout.configure({
merchant: 'my_merchant_id',
order: {
amount: function() {
//Dynamic calculation of amount
return {{$Recipt->final_price}};
},
currency: 'EGP',
description: 'Ordered goods',
id: Math.random()
},
interaction: {
operation: 'PURCHASE', // set this field to 'PURCHASE' for Hosted Checkout to perform a Pay Operation. , AUTHORIZE
merchant: {
name: 'AAIB TEST',
address: {
line1: '200 Sample St',
line2: '1234 Example Town'
}
} }
});
function restorePageState(data)
{
window.location.replace("{{url('confirm_is_paid/'.$Recipt->id.'/'.$Recipt->security_code)}}");
}
function completeCallback(resultIndicator, sessionVersion) {
window.location.replace("{{url('confirm_is_paid/'.$Recipt->id.'/'.$Recipt->security_code)}}");
}
Checkout.showPaymentPage();
</script>
everything is working correctly except I can't redirect after the payment completed so what can i do to made it redirect to a url after the payment compleated ?