如何解决万事达卡支付网关 (mpgs) 中的此错误 "cause":"INVALID_REQUEST","explanation":"Invalid request"

How to solve this error "cause":"INVALID_REQUEST","explanation":"Invalid request" in mastercard payment gateway (mpgs)

我正在尝试将我的网站与万事达卡网关支付 (mpgs) 集成, 我跟进文档,我 select Hosted Checkout 方法,请参阅 here

中的文档

我通过此代码请求结帐会话:

$orderid = $_POST['order_id'];
$merchant = $_POST['merchant']; //       
$apiPassword = $_POST['api_password'];//           
$amount=$_POST['amount'];
$currency=$_POST['currency'];

$ch = curl_init();  
curl_setopt($ch, CURLOPT_URL, "https://test-gateway.mastercard.com/api/nvp/version/58");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST , 1);
curl_setopt($ch, CURLOPT_POSTFIELDS , 
"apiOperation=CREATE_CHECKOUT_SESSION&apiPassword=$apiPassword&apiUsername=merchant.$merchant&merchant=$merchant&interaction.operation=AUTHORIZE&order.id=$orderid&order.amount=$amount&order.currency=$currency");

$arr = array('sessionid' => $sessionid);

echo json_encode($arr);

而且这个请求非常有效,成功获取了sessionid,

但是当执行这个结帐代码时,错误出现在 JavaScript 控制台中,如下所示: {"原因":"INVALID_REQUEST","解释":"无效请求","supportCode":"PVIRB4OXUZI6G","结果":"错误"}

这是代码:

                 Checkout.configure({
                  merchant: $("#merchant").val(),
                  order:{
                      amount: function(){
                        return $("#amount").val(); 
                      },
                      currency: $("#currency").val(),
                      description: $("#order_description").val(),
                      id: $("#order_id").val()
                  },
                  session: { 
                    id: sessionid
                    },
                  interaction: {
                        merchant: {
                            name:  $("#merchant").val(),
                            address: {
                                line1:  $("#address1").val(),
                                line2:  $("#address2").val()           
                            }    
                        }
                   }
                });
Checkout.showLightbox();

为了开始付款流程,我打电话给: Checkout.showLightbox();

应该会出现弹出窗口,但不幸的是它没有出现。

有什么帮助吗?

我解决了这个问题,问题是因为这个 link :

https://测试网关.mastercard.com/api/nvp/version/58"

YOH 应该要求您的银行为您提供商户管理门户和link。

在我的例子中,link 是:

https://test-bop.mtf.gateway.mastercard.com/api/nvp/version/58"