# Cancels a payment intent.

**PATCH** `/payment-intent/{payment_intent_id}`

Base URL: `https://api-sbx.pre.globalgetnet.com/dpy/web-checkout/v1`

Cancels (expires) a payment intent that has not yet been paid.

This is the only update operation available on a payment intent through the public API.

## Authorization

- PROD (oauth2)
- PRE (oauth2)

## Path parameters

- `payment_intent_id` (string, required)
  Payment intent unique identifier

## Body

Content type: `application/json`

- `status` ("cancelled", required)
  New status for the payment intent. Only `cancelled` is allowed, used to cancel/expire a payment intent that has not yet been paid.

Example:

```json
{
  "status": "cancelled"
}
```

## Responses

### 204

No content.

Payment intent cancelled successfully.

### 400

Bad request.

Only required fields are validated.

- `code` (string, required)
  Unique alphanumeric human readable error code
- `message` (string, required)
  Brief summary of the reported issue
- `details` (object[])
  Array of errors.

  The object type varies depending on the error context.

Example:

```json
{
  "code": "guid_error",
  "message": "x-seller-id must be a valid guid",
  "details": "[ {\"property\": \"x-seller-id\", \"constraint\":\"guid\"}]"
}
```

### 401

Unauthorized

- `code` (string)
  Unique alphanumeric human readable error code
- `message` (string, required)
  Brief summary of the reported issue
- `details` (object[])
  Array of errors.

  The object type varies depending on the error context.

Example:

```json
{
  "code": "validation_error",
  "message": "One or more fields failed validation",
  "details": "[ {\"field\": \"amount\", \"error\": \"amount is required\"} ]"
}
```

### 404

Not found

- `code` (string)
  Unique alphanumeric human readable error code
- `message` (string, required)
  Brief summary of the reported issue
- `details` (object[])
  Array of errors.

  The object type varies depending on the error context.

Example:

```json
{
  "code": "validation_error",
  "message": "One or more fields failed validation",
  "details": "[ {\"field\": \"amount\", \"error\": \"amount is required\"} ]"
}
```

### 422

Unprocessable entity.

Potential business error.

- `code` (string)
  Unique alphanumeric human readable error code
- `message` (string, required)
  Brief summary of the reported issue
- `details` (object[])
  Array of errors.

  The object type varies depending on the error context.

Example:

```json
{
  "code": "validation_error",
  "message": "One or more fields failed validation",
  "details": "[ {\"field\": \"amount\", \"error\": \"amount is required\"} ]"
}
```

### 500

Internal server error

- `message` (string, required)
  Brief summary of the reported issue
- `details` (object[])
  Array of errors.

  The object type varies depending on the error context.

Example:

```json
{
  "message": "Internal Server Error",
  "details": "[]"
}
```