# Consult

## Consult

<mark style="color:blue;">`GET`</mark> `https://api.payvalida.com/api/v3/porders/{order}`

`Sandbox URL: https://api-test.payvalida.com/api/v3/`**`porders/{order}`**\
\
This method retrieves all the details of a specific order registered in our system.

#### Path Parameters

| Name                                    | Type   | Description                    |
| --------------------------------------- | ------ | ------------------------------ |
| order<mark style="color:red;">\*</mark> | string | Order ID. Max. 200 characters. |

#### Query Parameters

| Name                                       | Type   | Description                                                                  |
| ------------------------------------------ | ------ | ---------------------------------------------------------------------------- |
| merchant<mark style="color:red;">\*</mark> | string | ID of the commerce in Payvalida. Max. 50 characters.                         |
| checksum<mark style="color:red;">\*</mark> | string | Checksum encoded in SHA512 (order + merchant + FIXED\_HASH). 512 characters. |
| aditionalinfo                              | string | ADITIONAL\_INFO DATA. You can send "cuspse"                                  |

{% tabs %}
{% tab title="200 The execution returns a JSON following this structure:" %}

```json
{
  "CODE": "0000",
  "DESC": "OK",
  "DATA": {
    "CURRENCY": "COP",
    "NOTIFICATION_RESPONSE": "Error al procesar los datos",
    "UDPATE_DATE": "2022-02-07 10:48:21",
    "CREATION_DATE": "2022-02-07 10:45:57",
    "STATE": "APROBADA",
    "PAYMNENT_METHOD": "PSE",
    "EMAIL": "someone@example.com",
    "LIFE_TIME": "445h",
    "ORDER": "prue303459",
    "CODE": 2202776,
    "AMOUNT": "120.00",
    "DESCRIPTION": "prueb040",
    "REFERENCE": "80011572",
    "checkout": "sandbox-checkout.payvalida.com?token=tokencheckout",
    "TRANSACTION": {},
    "ADITIONAL_INFO": {
      "CUS": "2539443"
    }
  }
}
```

{% endtab %}
{% endtabs %}

## Example

* Request

```bash
curl --location --request GET 'https://api-test.payvalida.com/api/v3/porders/prue303459?merchant=kuanto&checksum=cheksuminvalido&aditionalinfo=cuspse'The commerce (merchant) id and the FIXED_HASH are provided when you create an account in our platform.
```

* **GO**

```go
package main
import (
  "fmt"
  "net/http"
  "io/ioutil"
)
func main() {
  url := "https://api-test.payvalida.com/api/v3/porders/9022932?merchant=kuanto&checksum=7CA708050F7F5B3EB5B9FD271D375DCEFCA71BDEFDF91C96A4C38F906EFA133E95675D332279C89F999B1909ECF2EBCA7EC177ACED6EA56D1A72244145E377B7"
  method := "GET"
  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)
  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

* **PHP**

```php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api-test.payvalida.com/api/v3/porders/9022932?merchant=kuanto&checksum=7CA708050F7F5B3EB5B9FD271D375DCEFCA71BDEFDF91C96A4C38F906EFA133E95675D332279C89F999B1909ECF2EBCA7EC177ACED6EA56D1A72244145E377B7",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

* **Java**

```java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://api-test.payvalida.com/api/v3/porders/9022932?merchant=kuanto&checksum=7CA708050F7F5B3EB5B9FD271D375DCEFCA71BDEFDF91C96A4C38F906EFA133E95675D332279C89F999B1909ECF2EBCA7EC177ACED6EA56D1A72244145E377B7")
  .method("GET", null)
  .build();
Response response = client.newCall(request).execute();
```

* **Python**

```python
import http.client
import mimetypes
conn = http.client.HTTPSConnection("api-test.payvalida.com")
payload = ''
headers = {}
conn.request("GET", "/api/v3/porders/9022932?merchant=kuanto&checksum=7CA708050F7F5B3EB5B9FD271D375DCEFCA71BDEFDF91C96A4C38F906EFA133E95675D332279C89F999B1909ECF2EBCA7EC177ACED6EA56D1A72244145E377B7", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

* **JavaScript**

```javascript
var myHeaders = new Headers();
var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};
fetch("https://api-test.payvalida.com/api/v3/porders/9022932?merchant=kuanto&checksum=7CA708050F7F5B3EB5B9FD271D375DCEFCA71BDEFDF91C96A4C38F906EFA133E95675D332279C89F999B1909ECF2EBCA7EC177ACED6EA56D1A72244145E377B7", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.payvalida.com/api-recaudo/api-recaudo-en/purchase-orders/consult.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
