Cancel a Direct Debit {#bacs-services-cancel}
=============================================

You can cancel a direct debit payment when it has the `Pending` status or the `Settle_initiated` status. The status of the direct debit payment determines the cancel status message. Cancelling a direct debit requires the request ID from the sale response.

Endpoints
---------

Set the apCancelService_run field to `true`, and send the request to one of these endpoints:  
**Production:** `https://ics2ws.ic3.com/commerce/1.x/transactionProcessor`  
**Test:** `https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor`

Response Statuses
-----------------

This table describes the possible statuses that you can receive in a cancel response message. The status is found in the apCancelReply_status field.

| `Cybersource` Status | Description                                                                                                                                                                                                                       | Response Time              |
|:---------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------|
| `Accepted`           | The cancellation request is accepted and sent to the scheme to reverse the direct debit. This status is returned when the direct debit is canceled after the status of the sale has changed from `Pending` to `Settle_initiated`. | Immediate in API response. |
| `Cancelled`          | The cancellation request was processed successfully. The direct debit was cancelled while it was in the `Pending` status.                                                                                                         | Immediate in API response. |
| `Failed`             | The cancellation request was not accepted. The time period for cancellation might be expired.                                                                                                                                     | Immediate in API response. |
[Payment Statuses for Cancelling a Direct Debit]

The cancel service also responds with a reason code in the apCancelReply_reasonCode field. For more information about reason codes, see the [Reason Codes for Bacs Direct Debits for the Simple Order API](/docs/bacs/en-us/direct-debits/developer/all/so/direct-debits/bacs-reference/bacs-reference-codes.md "").
