I am getting an error as "Invalid Auth key", though I am pasting the exact key as shown in the https://test.instamojo.com/integrations . Kindly help me out.

Posted in General by Abhishek Fri Dec 15 2017 07:14:16 GMT+0000 (UTC)·Viewed 572 times

<?php namespace App\Http\Controllers; use Illuminate\Http\Request; class Instacontroller extends Controller { public function checkout(){ return view('checkout'); } public function createRequest(request $request){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://www.instamojo.com/api/1.1/payment-requests/'); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Api-Key:test_05ee098cad11c6d689da00af36a", "X-Auth-Token:test_3519e8a9ca14c7e5945e4c2eff1")); $payload = Array( 'purpose' => $request->purpose, 'amount' => $request->amount, 'phone' => $request->phone, 'buyer_name' => $request->buyername, 'redirect_url' => 'http://http://localhost:8000/redirect/', 'send_email' => true, 'webhook' => 'http://http://localhost:8000/webhook/', 'send_sms' => true, 'email' => $request->email, '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; } }
Markdown is allowed