我正在尝试配置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"
}
答案 0 :(得分: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);