我是新的万事达卡支付网关服务(MPGS)集成和面临的问题与第二步互动的万事达卡安全支付页面。
第一步:我使用apiOperation生成了一个会话ID,如“CREATE_CHECKOUT_SESSION”,使用Postman和POST方法,主体是raw =〉Json,如下所示:
URL: https://test-gateway.mastercard.com/api/rest/version/57/merchant/1033/session
Body:
{
"apiOperation": "CREATE_CHECKOUT_SESSION",
"interaction": {
"operation": "PURCHASE"
},
"order": {
"currency": "USD",
"id": "22541" ,
"amount": 50
}
}
通过在Authorization部分提供我的API凭据,成功生成了会话ID。现在,当我调用checkout.js文件与托管的结帐支付页面交互时,控件移动到支付网关页面,但显示错误
Refused to execute script from 'https://test-gateway.mastercard.com/form/version//merchant/1033/session.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
<script type="application/javascript" src="https://test-gateway.mastercard.com/checkout/version/57/checkout.js" data-error="errorCallback" data-cancel="cancelCallback" data-complete="completeCallback" >
</script>
<script type="application/javascript">
function errorCallback(error) {
console.log(JSON.stringify(error));
}
function cancelCallback() {
console.log('Payment cancelled');
}
function completeCallback(resultIndicator, sessionVersion) {
alert('success');
console.log(resultIndicator);
}
Checkout.configure({
merchant: '1033',
order: {
amount: function() {
return 50;
},
currency: 'USD',
description: 'Ordered goods',
id: '22541'
},
interaction: {
operation: 'PURCHASE',
merchant: {
name: 'MOFA -TEST',
address: {
line1: '200 Sample St',
line2: '1234 Example Town'
}
}
},
session: {
id: 'SESSION0002089703583J7873949J89'
}
});
Checkout.showPaymentPage();
</script>
任何帮助都将不胜感激。谢谢
2条答案
按热度按时间svdrlsy41#
万事达卡支付网关文档在描述请求的参数时并不清楚。我发现这个视频对使用PHP curl和JavaScript的万事达卡托管结账集成很有帮助:
下面是请求sessionId的代码片段:
https://www.youtube.com/watch?v=jRJkfszfla0
pgvzfuti2#
MPGS托管 checkout 集成已从API版本63及更高版本更新。但是,如果您仍在使用API版本57(最低3DS2.0支持的API版本),请查找以下示例代码。MPGS checkout.js HTML引用MPGS sample code version wise reference
检查站