付款完成后我需要重定向到一个 URL
我使用了文档中提供的代码
<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>
一切正常,但付款完成后我无法重定向,所以我可以做些什么来让它在付款完成后重定向到一个 url?