我尝试访问 CCAvenue 支付网关,我正在使用 PostMan 进行此操作。我有有效的 access_code、工作密钥和 merchaint Id,但是当我尝试时,我收到类似 status=1&enc_response=command is required 的错误。谁能帮我解决这个问题吗
标题中的内容类型应该是
Content-Type: application/x-www-form-urlencoded
而不是 Content-Type: application/json
对于邮递员:
BODY 应该是
x-www-form-urlencoded
而不是 form-data
。
查找
curl_setopt($ch, CURLOPT_HTTPHEADER,'Content-Type: application/json');
替换为::
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
试试这个荣誉!
Laravel 10.x 使用 HTTP 客户端 参考。链接
$merchant_json_data = array(
'order_no' => '', //your app's internal order no
'reference_no' => '' //ccavenue tracking no
);
$merchant_data = json_encode($merchant_json_data);
$encrypted_data = encrypt($merchant_data, $working_key);
$response = Http::asForm()->post('https://apitest.ccavenue.com/apis/servlet/DoWebTrans', [
'enc_request' => $encrypted_data,
'access_code' => $access_code,
'command' => 'orderStatusTracker',
'request_type' => 'JSON',
'response_type' => 'JSON',
'version' => '1.2'
])->body();
dd($response);