Cancel a Direct Debit

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.
Payment Statuses for Cancelling a Direct Debit
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.
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.

Required Fields for Cancelling a Direct Debit

Set to
true
.
Set to the request ID from the sale response.
Set to
STL
.

Test Triggers for Cancelling a Direct Debit

In the
Cybersource
test environment, you can simulate specific response messages that you receive from transaction requests by including certain values in your transaction requests. The simulated environment enables you to become familiar with the response messages and develop methods for error handling.
Your account must be configured for testing trigger values. Contact your
Cybersource
account manager for more details.

Test Endpoint

For test transactions, send an API request to the test endpoint.
Test:
https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor

Trigger Values

To test, send a cancel request and set the
apCancelService_reconciliationID
field to a value listed in the Trigger Value column. The
Cybersource
response status is returned in the
apCancelReply_status
field.
Direct Debit Test Triggers for Cancellations
Cybersource
Response Status
Trigger Value
Cancelled
Any value except
TC400000
Failed
TC400000

Simple Order Example: Cancelling a Direct Debit

Light Dark
Request
12345678
<="urn:schemas-cybersource-com:transaction-data-1.214"> <merchantID>test-merchant</merchantID> <merchantReferenceCode>refnum-1234</merchantReferenceCode> <apPaymentType>STL</apPaymentType> <apCancelService run="true"> <saleRequestID>5235449962346004801064</saleRequestID> </apCancelService> </>
Response to a Successful Request
12345678910111213141516
<:c="urn:schemas-cybersource-com:transaction-data-1.214"> <merchantReferenceCode>refnum-1234</merchantReferenceCode> <requestID>7103599858616262503009</requestID> <decision>ACCEPT</decision> <reasonCode>100</reasonCode> <requestToken>AxjnrwSTgRZAYu0pZKph//8ZYjWmdmpJk12EVgnvv7M5jedC/oH9MMmkmXoxX9xYJOBFkAAoyjyQSMAAgv/Z</requestToken> <apCancelReply> <reasonCode>100</reasonCode> <status>CANCELLED</status> <processorResponse>00009</processorResponse> <dateTime>2024-03-13T19:59:47Z</dateTime> <paymentStatus>cancelled</paymentStatus> <responseCode>00009</responseCode> <reconciliationID>XFZ3YTIIW0E0</reconciliationID> </apCancelReply> </>