# Delete

## Delete

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

`Sandbox URL: https://api-test.payvalida.com/api/v3/`**`porders/{order}`**\
\
This action changes the order status from **PENDING (PENDIENTE)** to **CANCELLED (CANCELADA)**, in this case, notifications about the status change aren't sent. After elimination (cancellation), the order can't be paid.

#### Path Parameters

| Name  | Type   | Description                   |
| ----- | ------ | ----------------------------- |
| order | string | Order ID. Max. 200 characters |

#### Query Parameters

| Name     | Type   | Description                                                             |
| -------- | ------ | ----------------------------------------------------------------------- |
| merchant | string | ID of the commerce in Payvalida. Max. 50 characters.                    |
| checksum | string | Checksum encoded in SHA512(order+merchant+FIXED\_HASH). 512 caracteres. |

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

```css
{  
   "CODE":"0000",
   "DATA":{  
      "Reference":"3102292330",
      "Amount":"0.0",
      "Operation":"DELETED",
      "OrderID":"1496953766724_6",
      "PVOrderID":"95585"
   },
   "DESC":"OK"
}
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
Eliminating an order doesn't mean that is **not available** anymore.

You can't register a new order with the same order number of an eliminated one. The order number is unique regardless of its state.
{% endhint %}

{% hint style="success" %}
The commerce (merchant)  id and the FIXED\_HASH are provided when you [create an account](http://registro.payvalida.com) in our platform.
{% endhint %}

## Examples

* **Request**

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

* **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;
```

* **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"))
```

* **Java**

```java
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();
```

* **JavaScript**

```javascript
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/api-recaudo-en/purchase-orders/delete.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.
