# Eliminar

<div align="left"><img src="/files/-MNPeesAefQTDq0P6tQL" alt=""></div>

{% hint style="success" %}
**Producción:** [**https://api.payvalida.com/api/v3/porders/{order}**](https://api.payvalida.com/api/v3/porders/{order})
{% endhint %}

{% hint style="success" %}
**Sandbox:** [**https://api-test.payvalida.com/api/v3/porders/{order}**](https://api-test.payvalida.com/api/v3/porders/{order})
{% endhint %}

{% tabs %}
{% tab title="Request" %}

|              | Tipo                                           | Requerido | Descripción                                                   |
| ------------ | ---------------------------------------------- | --------- | ------------------------------------------------------------- |
| order        | <p>string<br>(<strong>pathParam</strong>)</p>  | si        | Identificador de la orden único en el comercio.               |
| merchant     | <p>string<br>(<strong>queryParam</strong>)</p> | si        | Identificador del comercio en Payvalida.                      |
| checksum     | <p>string<br>(<strong>queryParam</strong>)</p> | si        | Cadena consultada con SHA512(order + merchant + FIXED\_HASH). |
| {% endtab %} |                                                |           |                                                               |

{% tab title="Request (Ejemplo)" %}

```bash
curl --location --request DELETE 'https://api-test.payvalida.com/api/v3/porders/test11031?merchant=kuanto&checksum=9D96D9213893F3070C77215FC460E6432AA2052FC1B72375983B5A38D1FBC4BB98C21F8D81EAB1A35534D977A2C19171E44C949C4B508645402C3EB8BD7F7BF6'
```

{% endtab %}

{% tab title="Response" %}

| Campo        | Estructura | Tipo   | Descripción                                                       |
| ------------ | ---------- | ------ | ----------------------------------------------------------------- |
| CODE         | -          | string | Código de respuesta **0000** para **OK.**                         |
| DESC         | -          | string | Descripción de la respuesta.                                      |
| DATA         | -          | string | Datos del registro                                                |
| Amount       | DATA       | string | Monto de la operación.                                            |
| Operation    | DATA       | string | Resultado de la eliminación de la orden.                          |
| OrdenID      | DATA       | string | ID único de la orden asociado al comercio.                        |
| PVordenID    | DATA       | string | ID único asociado a la orden para Payvalida.                      |
| Referencia   | DATA       | string | Numero de la referencia con la cual el cliente realizara el pago. |
| {% endtab %} |            |        |                                                                   |

{% tab title="Response (ejemplo)" %}

```java
{
    "CODE": "0000",
    "DESC": "OK",
    "DATA": {
        "OrderID": "test11031",
        "Amount": "2589.0",
        "PVOrderID": "1934631",
        "Reference": "10522318",
        "Operation": "DELETED"
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
Eliminar la orden significa que ésta ya **no** está disponible.

No se puede registrar una nueva orden con número de orden de una ELIMINADA. El número de orden es único sin importar su estado.
{% endhint %}

{% hint style="success" %}
La identificación del comercio (merchant) y FIXED\_HASH, se proporcionan al momento de [crear una cuenta](https://registro.payvalida.com) en nuestra plataforma.
{% endhint %}

## Ejemplo

* **GO**

```go
package main
import (
  "fmt"
  "net/http"
  "io/ioutil"
)
func main() {
  url := "https://api-test.payvalida.com/api/v3/porders/test11031?merchant=kuanto&checksum=9D96D9213893F3070C77215FC460E6432AA2052FC1B72375983B5A38D1FBC4BB98C21F8D81EAB1A35534D977A2C19171E44C949C4B508645402C3EB8BD7F7BF6"
  method := "DELETE"
  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/test11031?merchant=kuanto&checksum=9D96D9213893F3070C77215FC460E6432AA2052FC1B72375983B5A38D1FBC4BB98C21F8D81EAB1A35534D977A2C19171E44C949C4B508645402C3EB8BD7F7BF6",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "Cookie: __cfduid=db2ca6d84048cb8569438db5fe37b82a01606749049"
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

* **Java**

```php
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://api-test.payvalida.com/api/v3/porders/test11031?merchant=kuanto&checksum=9D96D9213893F3070C77215FC460E6432AA2052FC1B72375983B5A38D1FBC4BB98C21F8D81EAB1A35534D977A2C19171E44C949C4B508645402C3EB8BD7F7BF6")
  .method("DELETE", body)
  .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("DELETE", "/api/v3/porders/test11031?merchant=kuanto&checksum=9D96D9213893F3070C77215FC460E6432AA2052FC1B72375983B5A38D1FBC4BB98C21F8D81EAB1A35534D977A2C19171E44C949C4B508645402C3EB8BD7F7BF6", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

* **JavaScript**

```python
var myHeaders = new Headers();
var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};
fetch("https://api-test.payvalida.com/api/v3/porders/test11031?merchant=kuanto&checksum=9D96D9213893F3070C77215FC460E6432AA2052FC1B72375983B5A38D1FBC4BB98C21F8D81EAB1A35534D977A2C19171E44C949C4B508645402C3EB8BD7F7BF6", 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/ordenes-de-compra/eliminar.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.
