# Cancel Bill

{% hint style="info" %}
**API Endpoint**

**POST** [**/client/bills/**](https://xpay.stream/client/bills/save)[**cancel**](https://xpay.stream/client/bills/cancel)
{% endhint %}

***

{% hint style="info" %}
**Request Headers:**

Authorization: Bearer [\<access\_token>](https://docs.xpay.stream/authentication-api)

Content-Type: application/json\
\
**Request Body:**

{% code lineNumbers="true" %}

```json
{
    "reference":"<billRef>" // bill unique reference
}
```

{% endcode %}
{% endhint %}

{% hint style="success" %}
**Success Response**

{% code lineNumbers="true" fullWidth="true" %}

```json
{
    "success": {
        "message": "Bill Canceled",
        "data": null
    },
    "uuid": "d8012583-e2c5-4778-9eda-bbf0313c1646"
}
```

{% endcode %}
{% endhint %}

***

{% tabs %}
{% tab title="CURL Example" %}
{% code lineNumbers="true" fullWidth="true" %}

```bash
curl 'https://apis.xpay.stream/client/wallets/save'    \
  -H 'Content-Type: application/json'                  \
  -H 'Authorization: Bearer <access_token>'            \
  --data-raw '{"reference":"<billRef>"}'              
```

{% endcode %}
{% endtab %}

{% tab title="NodeJS Example" %}
{% code lineNumbers="true" %}

```javascript
// npm i cross-fetch
const fetch = require("cross-fetch");

const API_URL = "https://apis.xpay.stream/client/wallets/save";

const method = "POST";

const headers = { 
    "Content-Type": "application/json",
    "Authorization": "Bearer <access_token>"
};

const body = JSON.stringify({
    "reference":"<billRef>"
});

fetch(API_URL, { headers, body, method })
.then(async res =>  await res.json())
.then(result => {
    if(result.error)
        console.log("Bill Cancel Error", result);
    if(result.success)
        console.log("Bill Canceled", result);
})
.catch((err) => {
    console.error("Bill Cancel API Exception", err);
});
```

{% endcode %}

{% endtab %}
{% endtabs %}
