0

我正在尝试配置 MPGS 并尝试设置回调 url。它需要使用 REST 创建会话。

代码类似于下面的代码。我不确定应该如何使用 cURL 编写代码。谁能帮忙

谢谢

POST https://cbcmpgs.gateway.mastercard.com/api/rest/version/47/merchant/XXXXXXXXXX/session


{
"apiOperation": "CREATE_CHECKOUT_SESSION",
"order": {
 "currency": "LKR",
 "id": "20181003001"
},
"interaction": {
 "returnUrl": "http://www.google.lk"
}
4

1 回答 1

0
$url = '';
$postFields = array(
    'apiOperation' => 'CREATE_CHECKOUT_SESSION',
    'order' => array(
        'currency' => '',
        'id' => ''
    ),
    'interaction' => array(
        'returnUrl' => ''
    )
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json'
));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($postFields));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
$output = curl_exec($curl);
curl_close($curl);
于 2019-05-16T05:52:49.810 回答