与codeigniter的instamojo结账

时间:2017-02-02 05:45:19

标签: php codeigniter instamojo

我用CodeIgniter创建了一个项目,现在我想集成instamojo支付网关。但是当我尝试结帐时,我面临以下问题。

  1. Page只是加载
  2. 过了一段时间后,它给了我以下错误。
  3.   

    "错误:出了点问题。 cURL引发了一个错误,数字为:7和   消息:无法连接到test.instamojo.com端口443:连接   时间到。 "

    我正在使用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;
    

1 个答案:

答案 0 :(得分:0)

更改第一行

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

工作正常。 有关更多详细信息,请see the insatamojo-php source tree