> For the complete documentation index, see [llms.txt](https://docs.payvalida.com/api-recaudo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payvalida.com/api-recaudo/api-recaudo-en/purchase-orders/delete.md). Agents can also search and read this documentation through its [MCP server](https://docs.payvalida.com/api-recaudo/~gitbook/mcp).

# Delete

Only orders with a PENDING (PENDIENTE) status can be eliminated

This action changes the order status from **PENDING (PENDIENTE)** to **CANCELLED (CANCELADA)**, in this case, no status-change notifications are sent. Once an order is deleted (cancelled), it can no longer be paid.

<figure><img src="https://2646475391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ly_b6lZywQ5rYRHAN2H-1525464909%2Fuploads%2FdurqgpwKI7SjYEHJieW0%2Fimage.png?alt=media&amp;token=59e3bdce-7214-4512-b4e9-28050ab7d3bf" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
**Production:** [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" %}

| Field        | Type                    | Required | Description                                                         |
| ------------ | ----------------------- | -------- | ------------------------------------------------------------------- |
| order        | string (**pathParam**)  | yes      | Order identifier, unique for the merchant.                          |
| merchant     | string (**queryParam**) | yes      | Merchant identifier in Payvalida.                                   |
| checksum     | string (**queryParam**) | yes      | Verification string using SHA512 (`order + merchant + FIXED_HASH`). |
| {% endtab %} |                         |          |                                                                     |

{% tab title="Request (example)" %}
{% code overflow="wrap" %}

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

{% endcode %}
{% endtab %}

{% tab title="Response" %}

| Field        | Structure | Type   | Description                                                        |
| ------------ | --------- | ------ | ------------------------------------------------------------------ |
| CODE         | -         | string | Response code. **0000** means **OK**.                              |
| DESC         | -         | string | Response description.                                              |
| DATA         | -         | object | Registration data.                                                 |
| Amount       | DATA      | string | Operation amount.                                                  |
| Operation    | DATA      | string | Result of the order deletion.                                      |
| OrderID      | DATA      | string | Unique order ID associated with the merchant.                      |
| PVOrderID    | DATA      | string | Unique order ID in Payvalida.                                      |
| Reference    | DATA      | string | Reference number the customer would have used to make the payment. |
| {% endtab %} |           |        |                                                                    |

{% tab title="Response (example)" %}
{% code overflow="wrap" %}

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

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="danger" %}
Deleting the order means it is **no longer** available.

A new order cannot be registered with the order number of a DELETED order. The order number is unique regardless of its status.
{% endhint %}

{% hint style="success" %}
The merchant identifier (merchant) and the FIXED\_HASH are provided when you create an account on our platform.
{% endhint %}

### Code examples <a href="#user-content-code-examples" id="user-content-code-examples"></a>

#### 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

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

#### 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 <a href="#user-content-javascript" id="user-content-javascript"></a>

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