# Eliminar

<div align="left"><img src="https://1217586153-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ly_b6lZywQ5rYRHAN2H%2F-MNLvqZ6lfE3yVVXjSXP%2F-MNPeesAefQTDq0P6tQL%2Fimage.png?alt=media&#x26;token=72f20176-4f26-4b83-b043-c2ea29b5a58b" alt=""></div>

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

{% hint style="success" %}
**Sandbox:** [**https://api-test.payvalida.com/api/v3/porders/{order}**](https://api-test.payvalida.com/api/v3/porders/%7Border%7D)
{% 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));
```
