【发布时间】:2019-08-20 12:55:02
【问题描述】:
付款完成后我需要重定向到一个网址
我使用了文档中提供的代码
<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?
【问题讨论】:
-
完成后有什么活动吗?
-
嗨@Zayed,从支付界面重定向后,您的 restorePageState 函数是否正常工作?
标签: javascript mastercard