3

I have created a project with CodeIgniter and now I want to integrate instamojo payment gateway. But I am facing following problem when I try checkout.

  1. Page is just loading
  2. After some time it give me following error.

"Error: Something went wrong. cURL raised an error with number: 7 and message: Failed to connect to test.instamojo.com port 443: Connection timed out. "

I am using the following code that is provided by instamojo documentation

    $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:API_KEY",
                  "X-Auth-Token:AUTH"));
$payload = Array(
    'purpose' => 'FIFA 16',
    'amount' => '2500',
    'phone' => '9999999999',
    'buyer_name' => 'John Doe',
    'redirect_url' => 'http://www.example.com/redirect/',
    'send_email' => true,
    'webhook' => 'http://www.example.com/webhook/',
    'send_sms' => true,
    'email' => 'foo@example.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;
Billal Begueradj
  • 20,717
  • 43
  • 112
  • 130

1 Answers1

0

change this line one

curl_setopt($ch, CURLOPT_URL, 'https://www.instamojo.com/api/1.1/');

its working fine. for more details please see the insatamojo-php source tree

Corion
  • 3,855
  • 1
  • 17
  • 27
Jaywant Narwade
  • 145
  • 1
  • 4