> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paytring.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch Order by ID

> Fetch an order using its Paytring order_id as id. Use HTTP Basic Auth and omit key and hash from the body. To look up your merchant receipt reference, use /api/v2/order/fetch/receipt instead.

Retrieve an order using the Paytring `order_id` returned by Create Order. To look up your own receipt reference instead, use [Fetch Order by Receipt ID](https://docs.paytring.com/api-reference/endpoint/fetch-order-by-receipt-id.md).

Authenticate with [HTTP Basic Auth](https://docs.paytring.com/api-reference/introduction.md). Do not include `key` or `hash` in the request body.

## Request example

```bash theme={null}
curl --request POST 'https://api.paytring.com/api/v2/order/fetch' \
  --user "${PAYTRING_API_KEY}:${PAYTRING_API_SECRET}" \
  --header 'Content-Type: application/json' \
  --data '{"id":"1111111111111111"}'
```

## Success response excerpt

```json theme={null}
{
  "status": true,
  "order": {
    "order_id": "1111111111111111",
    "receipt_id": "DEMO202611030001",
    "amount": 10000,
    "currency": "INR",
    "order_status": "success",
    "card_last_4": "6005",
    "card_issuer": "amex"
  }
}
```

Card details are returned only when available for a successful card payment. The response also contains customer, gateway, and other order details.

The top-level `status` describes whether the fetch succeeded. `order.order_status` describes the payment state. Check both and match the receipt ID, amount, and currency against your records before marking a payment successful.

V1 orders remain accessible through V2 for the same business account and test or live environment. Known API errors can return HTTP 200 with `status: false`; inspect the response body rather than relying on HTTP status alone.


## OpenAPI

````yaml POST /api/v2/order/fetch
openapi: 3.1.0
info:
  title: Orchestration
  version: '1'
servers:
  - url: https://api.paytring.com
security:
  - sec0: []
paths:
  /api/v2/order/fetch:
    post:
      summary: Fetch by Order ID
      description: >-
        Fetch an order using its Paytring order_id as id. Use HTTP Basic Auth
        and omit key and hash from the body. To look up your merchant receipt
        reference, use /api/v2/order/fetch/receipt instead.
      operationId: fetch-order
      requestBody:
        required: true
        content:
          application/json:
            example:
              id: '1111111111111111'
            schema:
              type: object
              required:
                - id
              properties:
                id:
                  type: string
                  description: >-
                    Paytring order_id returned by Create Order, not your
                    receipt_id.
                  minLength: 5
                  maxLength: 30
                  example: '1111111111111111'
      responses:
        '200':
          description: >-
            Inspect status. A successful fetch returns order; order.order_status
            is the payment state. Handled API errors can also return HTTP 200
            with status false and error.
          content:
            application/json:
              examples:
                Result:
                  summary: Successful fetch, response excerpt
                  value:
                    status: true
                    order:
                      order_id: '1111111111111111'
                      receipt_id: DEMO202611030001
                      amount: 10000
                      currency: INR
                      order_status: success
                      card_last_4: '6005'
                      card_issuer: amex
                InvalidInput:
                  value:
                    status: false
                    error:
                      message: Invalid Input Parameters Provided
                      code: 1001
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    example: true
                    default: true
                  error:
                    type: object
                    description: Present for a handled API error when status is false.
                    properties:
                      message:
                        type: string
                      code:
                        type: integer
                  order:
                    type: object
                    properties:
                      order_id:
                        type: string
                        example: '1111111111111111'
                      receipt_id:
                        type: string
                        example: MGI2222222222222333
                      pg_transaction_id:
                        type: string
                        example: '222222222222'
                      amount:
                        type: integer
                        example: 118
                        default: 0
                      currency:
                        type: string
                        example: INR
                      pg:
                        type: string
                        example: Paytm
                      method:
                        type: string
                        example: UPI
                      order_status:
                        type: string
                        example: success
                      unmapped_status:
                        type: string
                        example: TXN_SUCCESS
                      customer:
                        type: object
                        properties:
                          name:
                            type: string
                            example: Jhon Doe
                          email:
                            type: string
                            example: Jhon@doe.com
                          phone:
                            type: string
                            example: '917732887777'
                      notes:
                        type: object
                        properties:
                          udf1:
                            type: string
                            example: 'Sync with #122'
                          udf2:
                            type: string
                            example: ''
                          udf3:
                            type: string
                            example: ''
                          udf4:
                            type: string
                            example: ''
                          udf5:
                            type: string
                            example: ''
                          udf6:
                            type: string
                            example: ''
                          udf8:
                            type: string
                            example: ''
                          udf9:
                            type: string
                            example: ''
                          udf10:
                            type: string
                            example: ''
                      billing_address:
                        type: object
                        properties:
                          firstname:
                            type: string
                            example: Jhon
                          lastname:
                            type: string
                            example: LastName
                          phone:
                            type: string
                            example: '917732887777'
                          line1:
                            type: string
                            example: Gurugram
                          line2:
                            type: string
                            example: Gurugram
                          city:
                            type: string
                            example: Gurgaon
                          state:
                            type: string
                            example: Haryana
                          country:
                            type: string
                            example: IN
                          zipcode:
                            type: string
                            example: '122005'
                      shipping_address:
                        type: object
                        properties:
                          firstname:
                            type: string
                            example: Jhon
                          lastname:
                            type: string
                            example: LastName
                          phone:
                            type: string
                            example: '917732887777'
                          line1:
                            type: string
                            example: Gurugram
                          line2:
                            type: string
                            example: Gurugram
                          city:
                            type: string
                            example: Gurgaon
                          state:
                            type: string
                            example: Haryana
                          country:
                            type: string
                            example: IN
                          zipcode:
                            type: string
                            example: '122005'
                      additional_charges:
                        type: integer
                        example: 0
                        default: 0
                      mdr:
                        type: string
                        example: ''
                      tpv:
                        type: array
                      created_at:
                        type: string
                        example: '2024-04-05 12:19:24'
                      updated_at:
                        type: string
                        example: '2024-04-05 12:23:24'
                      card_last_4:
                        type: string
                        example: '6005'
                      card_issuer:
                        type: string
                        example: amex
        default:
          description: >-
            API error. Do not rely on the HTTP status alone; handled errors may
            also use HTTP 200.
          content:
            application/json:
              examples:
                Result:
                  value:
                    status: false
                    error:
                      message: Invalid Input Parameters Provided
                      code: 1001
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    example: false
                    default: true
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        example: Invalid Input Parameters Provided
                      code:
                        type: integer
                        example: 1001
                        default: 0
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: http
      scheme: basic

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.