Php Instamojo中不允许获取方法post错误
在使用Instamojo支付网关处理支付时,我收到了不允许的Php Instamojo中不允许获取方法post错误,php,curl,instamojo,Php,Curl,Instamojo,在使用Instamojo支付网关处理支付时,我收到了不允许的方法\“POST\”错误。我不知道我做错了什么 $this->load->helper('url'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://test.instamojo.com/api/1.1/'); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch,
方法\“POST\”
错误。我不知道我做错了什么
$this->load->helper('url');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://test.instamojo.com/api/1.1/');
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //<---- add this line or attach ssl certi
curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Api-Key:test_e7ae89197569462c232b303d30e",
"X-Auth-Token:test_a62220667c7197fc3a1ac17c1da"));
$payload = Array(
'purpose' => "Fifa 16",
'amount' => "3499",
'phone' => "990900909",
'buyer_name' => "Ajay Singh",
'redirect_url' => base_url().'Billing/paymentconfirmation',
'webhook' => base_url().'Billing/paymentconfirmation',
'send_email' => true,
'send_sms' => true,
'email' => "123@gmail.com",
'allow_repeated_payments' => false
);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
https://test.instamojo.com/api/1.1/
是API的基本URL。您需要到达特定的端点。见:
例如:
Create a Request
https://www.instamojo.com/api/1.1/payment-requests/
Creating a Refund
https://www.instamojo.com/api/1.1/refunds/
URL正确吗?是的URL正确!选中两次您没有在代码中调用该方法,因此您可能给了我们错误的代码,或者您使用的框架在发布到页面时自动使用
post()
方法。使用CodeIgnitor使用CodeIgnitor我不能在localhost上使用它,因为我现在收到此错误{“success”:false,“message”:{“webhook”:[“域名不应为\“localhost\”或\“127.0.0.1\”“]}”您不能将localhost
作为回调传递给远程API。回调需要是一个实时的、可公开访问的URL。现在我该怎么办……因为网站正在建设中。如果您想让回调正常工作,您需要在一个实时URL上开发。@AjaySingh您可以使用类似服务来测试webhook调用的本地URL。
Create a Request
https://www.instamojo.com/api/1.1/payment-requests/
Creating a Refund
https://www.instamojo.com/api/1.1/refunds/