0

I am trying to integrate razorpay and trying to fetch paymentId via OrderId But i am getting following error "description":"id is/are not required and should not be sent"

Here is my code,Where i am wrong ?

<?php
    $fields = array();
    $fields["id"] = "order_xxxxxxxxxxx";
    $payment_id="order_F7ebrxPQMOTksa";
    $url = 'https://api.razorpay.com/v1/orders/';
    $key_id = "xxxxxxxxxxxxxxxxxxx";
    $key_secret = "xxxxxxxxxxxxxxxxxxx";
    $params = http_build_query($data);
    //cURL Request
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERPWD, $key_id . ':' . $key_secret);
    curl_setopt($ch, CURLOPT_TIMEOUT, 60);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
    $headers = array();
    $headers[] = 'Accept: application/json';
    $headers[] = 'Content-Type: application/json';
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    $data = curl_exec($ch);
    echo "<pre>";print_r($data);
    ?>
amit
  • 1
  • 1
  • 18
  • 28
  • Just a quick look at the [documentation](https://razorpay.com/docs/api/orders/#fetch-an-order-with-id) it probably should be a GET and not a POST – Nigel Ren Jun 28 '20 at 07:21
  • @NigelRen: so what should i change in my code ? – amit Jun 28 '20 at 07:22

0 Answers0