Sometimes your shoppers change their mind about mid-purchase, or store staff realize they've made a mistake while the shopper is using the terminal.
A cancel request lets either a shopper or store staff abort an in-progress transaction. When the cancel request is received before a payment is approved, the payment is cancelled.
Global reference of the original sale transaction for the sale system. Not required when clearing a Display using orgExchangeIdentification.
Reason for aborting a transaction.
Unique identification of original exchange occurrence.
Unique identification of the partner that is the recipient of the message exchange.
For example, the POS SN
Result of the requested transaction.
Detail of the response.
Additional information to be logged for further examination.
AbortParam param = AbortParam.newBuilder()
.orgExchangeIdentification("000000001")
.abortReason("User cancel")
.build();
RetailerManager.provideSystemService()
.newAbortExchange(param)
.startAsyncExchange(new Exchange.RetailerSDKCallback<AbortResult>() {
@Override
public void onError(int code, String msg) {
Log.e(TAG, "failed: " + code + ", " + msg);
}
@Override
public void onResult(AbortResult result) {
Log.i(TAG, "result: " + GsonUtils.toJson(result));
}
});using System;
using PayExplorerConnect;
public void HandleAbortError(int code, string message)
{
Console.WriteLine($"Error: {code}, Message: {message}");
}
public void HandleAbortResult(AbortResult result)
{
Console.WriteLine($"Response: {result.Response}");
}
public string StartAbort()
{
// Replace the sample ID with the exchange ID returned by the original request.
AbortParam param = new AbortParam.Builder()
.OrgExchangeIdentification("000000001")
.AbortReason("User cancel")
.Build();
string exchangeId = RetailerManager
.ProvideSystemService()
.NewAbortExchange(param)
.StartAsyncExchange(HandleAbortResult, HandleAbortError);
return exchangeId;
}#import <PayExplorerConnect/RetailerManager.h>
#import <PayExplorerConnect/AbortParam+Builder.h>
// Use the exchange ID saved when the original request started.
AbortParam *params = [AbortParam makeWithBuilder:^(AbortParamBuilder *builder) {
builder.orgExchangeIdentification(@"000000001");
builder.abortReason(@"User cancel");
}];
[[RetailerManager sharedManager] abort:params block:^(NSString *exchangeId) {
// Save the exchange ID to track this request.
} result:^(NSInteger errcode, NSString *msg) {
if (errcode != 0) {
// Handle abort error.
return;
}
// Handle abort result.
}];