我在Worldpay付款网关中尝试过使用此api格式进行令牌化。我有方法不允许响应。这种方法有什么错误。
尝试时遇到此错误。
{"httpStatusCode":405,
"customCode":"HTTP_METHOD_NOT_ALLOWED",
"message":"Request method 'GET' not supported",
"description":"Requested HTTP method is not supported",
"errorHelpUrl":null,
"originalRequest":"api.worldpay.com/v1/…"}
答案 0 :(得分:0)
您必须发送POST
请求,而不是GET
请求。使用cURL
示例:
// set post fields values
$post = [
'clientkey' => 'your_key',
'name' => 'Some Name', // etc.
];
$ch = curl_init('https://api.worldpay.com/v1/tokens');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
// close the connection, release resources used
curl_close($ch);
//do something with $response