gpt4 book ai didi

integration - MPGS 集成

转载 作者:行者123 更新时间:2023-12-04 02:49:48 27 4
gpt4 key购买 nike

我正在尝试使用新的 migs getaway (MPGS) 我遵循了下一个 url 中的代码

https://ap-gateway.mastercard.com/api/documentation/integrationGuidelines/hostedCheckout/integrationModelHostedCheckout.html

当然我被替换了所有必填字段
<html>
<head>
<script src="https://ap-gateway.mastercard.com/checkout/version/36/checkout.js"
data-error="errorCallback"
data-cancel="cancelCallback">
</script>

<script type="text/javascript">
function errorCallback(error) {
console.log(JSON.stringify(error));
}
function cancelCallback() {
console.log('Payment cancelled');
}

Checkout.configure({
merchant: 'xxxxxx',
order: {
amount: function() {
//Dynamic calculation of amount
return 80 + 20;
},
currency: 'USD',
description: 'Ordered goods',
id: 'xxxxxx'
},
interaction: {
merchant: {
name: 'xxxxxx',
address: {
line1: '200 Sample St',
line2: '1234 Example Town'
}
}
}
});
</script>
</head>
<body>
...
<input type="button" value="Pay with Lightbox" onclick="Checkout.showLightbox();" />
<input type="button" value="Pay with Payment Page" onclick="Checkout.showPaymentPage();" />
...
</body>

但我一直都把这个错误作为 json 对象
{
"cause":"INVALID_REQUEST",
"explanation":"Invalid request",
"supportCode":"6RVIIBKFVR6CG",
"result":"ERROR"
}

最佳答案

1. 使用以下 curl 请求或 API 请求 创建使用服务器到服务器请求的结帐 session 请求
网址 https://cibpaynow.gateway.mastercard.com/api/rest/version/60/merchant/{merchantId}/session
HTTP 方法 POST
身份验证 此操作需要通过以下方法之一进行身份验证:
证书认证。
w3.org 中描述的基本 HTTP 身份验证。提供“商家”。在用户 ID 部分和密码部分中的 API 密码。

{
"apiOperation": "CREATE_CHECKOUT_SESSION",
"interaction": {
"operation": "PURCHASE"
},
"order": {
"id": "anyorder",
"currency": "EGP",
"description": "Order Goods",
"amount": "10.00"
}
}
2. 从响应中获取 session ID 并将其放置在我创建的附加示例 HTML 页面中:

<html>
<head>
<script src="https://cibpaynow.gateway.mastercard.com/checkout/version/57/checkout.js" data-error="errorCallback" data-cancel="cancelCallback"></script>
<script type="text/javascript">
function errorCallback(error) {
console.log(JSON.stringify(error));
}
function cancelCallback() {
console.log('Payment cancelled');
}
Checkout.configure({
session: {
id: '' //session ID generated from the request
},
interaction: {
merchant: {
name: '', //your MID
address: {
line1: '200 Sample St',
line2: '1234 Example Town'
}
}
}
});
</script>
</head>
<body>
...
<input type="button" value="Pay with Lightbox" onclick="Checkout.showLightbox();" />
<input type="button" value="Pay with Payment Page" onclick="Checkout.showPaymentPage();" />
...
</body>
</html>

3. 保存页面并在浏览器中打开页面,然后按“使用灯箱付款”按钮

关于integration - MPGS 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42891558/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com