---
title: "Cleanup charges with Gateway"
method: POST
path: "/v1/tasks/gateway-cleanup-sweep"
tags: ["Tasks"]
---

# Cleanup charges with Gateway

`POST /v1/tasks/gateway-cleanup-sweep`

## Request

- The document declares no server URL.
- Auth: none declared

Finds all charges (ePDQ, Worldpay, Stripe) which have a status of AUTHORISATION ERROR, AUTHORISATION UNEXPECTED ERROR, AUTHORISATION TIMEOUT and checks what their status is with the payment gateway. If the charges exist on the gateway and are in a non-terminal state, e.g. AUTHORISATION SUCCESS, a request is sent to cancel the charge on the gateway.<br>The job will move the charge into one of three statuses when it has successfully handled it:<br> - AUTHORISATION ERROR CANCELLED - the charge was authorised on the gateway but has now been cancelled. <br> - AUTHORISATION ERROR REJECTED - the authorisation was rejected on the gateway and no action needed to be taken to clean up.<br> - AUTHORISATION ERROR CHARGE MISSING - the charge was not found on the gateway, most likely because the error was before the gateway processed the authorisation.

## Query parameters

- `limit` integer, required

## Response `200`

OK

- string

## Other responses

- `500`: Internal server error

---

[API](https://skmtc.dev/government-digital-service/apis/connector-api.md) - [All operations](https://skmtc.dev/government-digital-service/apis/connector-api/llms.txt) - [OpenAPI document](https://skmtc.dev/government-digital-service/apis/connector-api/revisions/7f294e492d3c?raw)
