> ## Documentation Index
> Fetch the complete documentation index at: https://razorpay-881012b3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch an Order With ID

> Fetches an Order with its id using the Razorpay Orders API.

<div style={{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.35rem 0.9rem",border:"1px solid rgba(128,128,128,0.28)",borderRadius:"0.5rem",padding:"0.45rem 0.75rem",margin:"0 0 1.25rem",fontSize:"0.875rem"}}>
  <span style={{fontWeight:600}}>Available in</span>
  <span>🇮🇳 India</span>
  <span>🇸🇬 Singapore</span>
  <span>🇺🇸 United States</span>
</div>

Use this endpoint to retrieve details of a particular order as per the id.

<RequestExample>
  ```bash Curl theme={null}
  curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET]\
  -X GET https://api.razorpay.com/v1/orders/order_DaaS6LOUAASb7Y \
  ```

  ```java Java theme={null}
  RazorpayClient razorpay = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

  String orderId = "order_DaaS6LOUAASb7Y";

  Order order = razorpay.orders.fetch(orderId);
  ```

  ```python Python theme={null}
  # do easy_install razorpay or
  #    pip install razorpay

  import razorpay
  client = razorpay.Client(auth=("YOUR_ID", "YOUR_SECRET"))

  client.order.fetch(orderId)
  ```

  ```php PHP theme={null}
  $api = new Api($key_id, $secret);

  $api->order->fetch($orderId);
  ```

  ```ruby Ruby theme={null}
  require "razorpay"
  Razorpay.setup('YOUR_KEY_ID', 'YOUR_SECRET')

  orderId = "order_DaaS6LOUAASb7Y"

  Razorpay::Order.fetch(orderId)
  ```

  ```javascript Node.js theme={null}
  var instance = new Razorpay({ key_id: 'YOUR_KEY_ID', key_secret: 'YOUR_SECRET' })

  instance.orders.fetch(orderId)
  ```

  ```go Go theme={null}
  import ( razorpay "github.com/razorpay/razorpay-go" )
  client := razorpay.NewClient("YOUR_KEY_ID", "YOUR_SECRET")

  body, err := client.Order.Fetch("<orderId>", nil, nil)
  ```

  ```csharp .NET theme={null}
  RazorpayClient client = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

  string orderId = "order_Z6t7VFTb9xHeOs";

  Order order = client.Order.Fetch(orderId);
  ```

  ```bash CLI theme={null}
  razorpay orders fetch ord_ABC123
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
      "id": "order_DaaS6LOUAASb7Y",
      "entity": "order",
      "amount": 2000,
      "amount_paid": 0,
      "amount_due": 2000,
      "currency": "SGD",
      "receipt": null,
      "offer_id": "offer_JGQvQtvJmVDRIA",
      "offers": [
          "offer_JGQvQtvJmVDRIA"
      ],
      "status": "created",
      "attempts": 0,
      "notes": [],
      "created_at": 1654776878
  }
  ```

  ```json Failure theme={null}
  {
      "error": {
          "code": "BAD_REQUEST_ERROR",
          "description": "The id provided does not exist",
          "source": "business",
          "step": "payment_initiation",
          "reason": "input_validation_failed",
          "metadata": {}
      }
  }
  ```
</ResponseExample>

## Path Parameters

<ParamField path="id" type="string" required>
  Unique identifier of the order to be retrieved.
</ParamField>

## Response Parameters

<ResponseField name="id" type="string">
  The unique identifier of the order.
</ResponseField>

<ResponseField name="amount" type="integer">
  The amount for which the order was created, in currency subunits. For example, for an amount of , enter `29500`.
</ResponseField>

<ResponseField name="entity" type="string">
  Name of the entity. Here, it is `order`.
</ResponseField>

<ResponseField name="amount_paid" type="integer">
  The amount paid against the order.
</ResponseField>

<ResponseField name="amount_due" type="integer">
  The amount pending against the order.
</ResponseField>

<ResponseField name="currency" type="string">
  ISO code for the currency in which you want to accept the payment. The default length is 3 characters. Refer to the [list of supported currencies](/docs/sg/payments/international-payments#supported-currencies).
</ResponseField>

<ResponseField name="receipt" type="string">
  Receipt number that corresponds to this order. Can have a maximum length of 40 characters and has to be unique.
</ResponseField>

<ResponseField name="status" type="string">
  The status of the order. Possible values:

  * `created`: When you create an order it is in the `created` state. It stays in this state till a payment is attempted on it.
  * `attempted`: An order moves from `created` to `attempted` state when a payment is first attempted on it. It remains in the `attempted` state till one payment associated with that order is captured.
  * `paid`: After the successful capture of the payment, the order moves to the `paid` state. No further payment requests are permitted once the order moves to the `paid` state. The order stays in the `paid` state even if the payment associated with the order is refunded.
</ResponseField>

<ResponseField name="attempts" type="integer">
  The number of payment attempts, successful and failed, that have been made against this order.
</ResponseField>

<ResponseField name="notes" type="json object">
  Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, `"note_key": "Beam me up Scotty”`.
</ResponseField>

<ResponseField name="created_at" type="integer">
  Indicates the Unix timestamp when this order was created.
</ResponseField>

<ResponseField name="checkout" type="object">
  Checkout configuration applied to this order, when the order was created with checkout-time options (theme, prefill, partial-payment settings).
</ResponseField>

<ResponseField name="description" type="string">
  A brief description of the order, used for display purposes.
</ResponseField>

<ResponseField name="offers" type="array">
  List of offer IDs (`offer_xxxx`) applied to this order, if any.
</ResponseField>

<ResponseField name="offer_id" type="string">
  Unique identifier of the offer associated with this order.
</ResponseField>

## Errors

<AccordionGroup>
  <Accordion
    title="The API `<key/secret>
` provided is invalid."
  >
    **Code:** `400`

    The API credentials passed in the API call differ from the ones generated on the Dashboard. Possible reasons:

    * Different keys for test mode and live modes.
    * Expired API key.

    **Solution:** The API keys must be active and entered correctly with no whitespace before or after the keys.
  </Accordion>

  <Accordion title="id is not a valid id.">
    **Code:** `400`

    The `order_id` passed is invalid.

    **Solution:** Use a valid `order_id`.
  </Accordion>

  <Accordion title="The id provided does not exist">
    **Code:** `400`

    The `order_id` does not exist or does not belong to the requestor.

    **Solution:** Ensure that you use a valid `order_id` that belongs to the requestor.
  </Accordion>

  <Accordion title="Order older than 180 days, please use reports.">
    **Code:** `400`

    The order being fetched was created more than 180 days ago. The live Orders API only retains recent orders for direct fetch.

    **Solution:** For orders older than 180 days, use the **Reports / Settlements export** from the Dashboard rather than the live API.
  </Accordion>
</AccordionGroup>
