/cancel_transaction
Cancel a pending Issue and Redeem Sila transaction under certain circumstances
Use this endpoint if you or your end users need to stop an Issue (pull) or Redeem (push) Sila transaction from being forwarded to the ACH network. However, there is a point in time beyond which a transaction cannot be canceled.
Which Transactions Can Be Canceled?
- Only ACH Issue/pull and Redeem/push transactions using Standard or Same Day ACH can be canceled.
- ACH transactions using Instant Settlement cannot be canceled.
- RTP/FedNow transactions cannot be canceled.
- Wire transactions cannot be canceled
- Internal transfers cannot be canceled.
- External origination transactions cannot be canceled.
When can transactions be canceled?
Typically, a transaction can only be canceled within the first 15 minutes of it being submitted. After that time, our ACH provider moves the transaction further along its processing pipeline and cancellation becomes impossible.
Too late to cancel?
Should you find yourself in the situation where a transaction cannot be canceled via our API, it would be wise to reach out to Sila support. Know that having the end users's bank account cancel the transaction will result in an unauthorized return for you, and you should never advise your customer to do this. Reach out to Sila support instead.
Requests
The request body at this endpoint is the header_msg
JSON object.
header.user_handle
should have the registered handle to be verified.
Authorization / Authentication
Apps using Access Token Authorization
Use a valid access token in an Authorization: Bearer request header.
See Authenticating with an Access Token for more details.
Apps using ECDSA Authentication
Both authsignature
and usersignature
headers are required for this request. The usersignature header should be generated with a keypair registered to the user (either registered from the /register endpoint or the /register_wallet endpoint).
See the section on ECDSA Authentication for more detail about ECDSA signature generation.
POST /0.2/cancel_transaction HTTP/1.1
sandbox.silamoney.com
Content-Type: application/json
// if using OAuth2
Authorization: Bearer [GENERATED JWT TOKEN HERE]
// if using ECDSA
authsignature: [GENERATED AUTHSIGNATURE HEX STRING HERE]
usersignature: [GENERATED USERSIGNATURE HEX STRING HERE]
{
"header": {
"created": 1234567890,
"app_handle": "app_handle",
"user_handle":"user_handle",
"version": "0.2",
"reference": "<your unique id>"
},
"transaction_id": "80aea226-76a3-4b60-a629-25a2db572ec8"
}
***
HTTP/1.1 200 OK
{
"success": true,
"status": "SUCCESS",
"response_time_ms": "171",
"message": "Transaction 80aea226-76a3-4b60-a629-25a2db572ec8 has been canceled.",
"reference": "<your unique id>",
"sila_reference_id": "sila_assigned_id"
}
const res = await sila.cancelTransaction(
userHandle,
userPrivateKey,
transactionid,
);
// Success Response Object
console.log(res.statusCode); // 200
console.log(res.data.reference);
console.log(res.data.success); // true
console.log(res.data.status); // SUCCESS
console.log(res.data.message); // Transaction some-uuid-code has been canceled.
payload = {
"user_handle": user_handle,
"transaction_id": transaction_id
}
response = silasdk.Transaction.cancelTransaction(app, payload, eth_private_key)
# Success Response Object
{
success: True,
message: 'Transaction 80aea226-76a3-4b60-a629-25a2db572ec8 has been canceled.',
reference: 'ref',
status: 'SUCCESS',
status_code: 200
}
# Failure Response Object
{
status: 'FAILURE'
}
CancelTransactionMessage cancelMsg = CancelTransactionMessage.builder()
.userHandle("user_handle")
.userPrivateKey("user_private_key")
.transactionId("some-uuid-code")
.build();
ApiResponse response = api.cancelTransaction(cancelMsg);
// Success response
System.out.println(response.getStatusCode()); // 200
BaseResponse parsedResponse = (BaseResponse) response.getData();
System.out.println(parsedResponse.getReference());
System.out.println(parsedResponse.getSuccess()); // true
System.out.println(parsedResponse.getStatus()); // SUCCESS
System.out.println(parsedResponse.getMessage()); // Transaction some-uuid-code has been canceled
$userHandle = 'user_handle';
$privateKey = 'some private key';
$transactionId = 'some-transac-id';
$response = $client->cancelTransaction($userHandle, $privateKey, $transactionId);
echo $response->getStatusCode(); // 200
echo $response->getData()->success; // TRUE
echo $response->getData()->status; // SUCCESS
echo $response->getData()->message; // Transaction some-transac-id has been canceled.
echo $response->getData()->reference; // Random number reference
ApiResponse<object> response = api.CancelTransaction(userHandle, privateKey, transactionId);
// Success Object Response
Console.WriteLine(response.StatusCode); // 200
var parsedResponse = (BaseResponse)response.Data;
Console.WriteLine(parsedResponse.Status); // SUCCESS
Console.WriteLine(parsedResponse.Success); // true
Console.WriteLine(parsedResponse.Message); // Transaction has been canceled
Console.WriteLine(parsedResponse.Reference); // some-uuid-code
/cancel_transation - The Unhappy Path
In sandbox only: you can pass the below
transaction_id
s to prompt error responses as shown.
transaction_id | Status Code | Success Attribute | Message |
---|---|---|---|
aaaaaaaa-bbbb-cccc-8de5-a3be64670b71 | 403 | false | Wallet associated with transaction may be frozen. |
bbbbbbbb-cccc-dddd-99ce-c45944174e0c | 403 | false | Transaction type does not support cancellation. Currently only "issue" transactions may be canceled. |
cccccccc-dddd-eeee-a989-76560f827b42 | 403 | false | Transaction already submitted to ACH network, no cancellation possible from this point. |
dddddddd-eeee-ffff-9f23-097bb9bf748d | 404 | false | Transaction not found or is currently being processed. |
Responses
Status Code | success Attribute | Description |
---|---|---|
200 | true | Transaction canceled |
400 | false | Bad request format - check validation_details for more information. |
400 | false | Insufficient wallet balance. |
403 | false | authsignature or usersignature header was absent or incorrect. |
403 | false | Wallet associated with transaction may be frozen. |
403 | false | Transaction type does not support cancellation. |
403 | false | Transaction already submitted to ACH network, no cancellation possible from this point. |
403 | false | One or both of the payment instruments from the transactions has since been deleted. |
403 | false | Transaction has already been canceled at an earlier time. |
404 | false | Transaction not found. |
409 | false | Transaction has not completed its initialization steps; typically only occurs within 10 seconds of original transaction submission. Wait 60 seconds and retry the cancellation request. |
Updated 14 days ago