# Cancel Payment

Use the `cancelHostedPayment` mutation to cancel a hosted payment that is still in the **`created`** state.

{% code overflow="wrap" %}

```graphql
mutation {
  cancelHostedPayment(
    paymentRequest: "VHlwZXM6OkNhc2hyYW1wOjpBUEk6Ok1lcmNoYW50UGF5bWVudFJlcXVlc3QtMTFlZDhkZjUtZDI4Ni00MTI3LWJjZjktMTA3NTFkZTYxN2I4"
  )
}
```

{% endcode %}

### Argument

<table><thead><tr><th width="150.33331298828125">Name</th><th width="75.66668701171875">Type</th><th width="101">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>paymentRequest</code></td><td><code>ID!</code></td><td><strong>Yes</strong></td><td>Global ID of the hosted-payment request to cancel.</td></tr></tbody></table>

{% hint style="warning" %}
You can only cancel requests whose `status` is **`created`**.\
Once a payment has progressed to **`picked_up`**, **`completed`**, or **`canceled`**, it can no longer be voided with this mutation.
{% endhint %}
