API reference
MessageStatusParam Object
The Transaction Query API allows you to retrieve the status and details of a transaction. It can be used both for querying completed transactions and monitoring transactions in progress.
When there is no ongoing transaction, you can use this API to query the result of completed transactions.
This is typically used in the following scenarios:
Response recovery
When the original transaction response is lost or not received in time, this API can be used for reconciliation or recovery purposes.
Transaction verification
To confirm the final transaction status for reporting, reconciliation, or settlement processing.
During transaction processing, you can call this API to check the current execution status via the processStatus field.
This enables the client to:
MessageStatusParam param = MessageStatusParam.newBuilder()
.orgExchangeIdentification("000000001")
.initiatingPartyIdentification("Cashier1")
.build();
RetailerManager.getInstance()
.provideSystemService()
.newMessageStatusExchange(param)
.startAsyncExchange(new Exchange.RetailerSDKCallback<MessageStatusResult>() {
@Override
public void onError(int code, String msg) {
Log.e(TAG, "failed: " + code + ", " + msg);
}
@Override
public void onResult(MessageStatusResult result) {
Log.i(TAG, "result: " + GsonUtils.toJson(result));
}
}); using System;
using PayExplorerConnect;
public void HandleMessageStatusError(int code, string message)
{
Console.WriteLine($"Error: {code}, Message: {message}");
}
public void HandleMessageStatusResult(MessageStatusResult result)
{
Console.WriteLine($"Query response: {result.Response}");
}
public string StartMessageStatus()
{
// Replace the sample ID with the exchange ID of the request to query.
MessageStatusParam param = new MessageStatusParam.Builder()
.OrgExchangeIdentification("000000001")
.InitiatingPartyIdentification("Cashier1")
.Build();
string exchangeId = RetailerManager
.ProvideSystemService()
.NewMessageStatusExchange(param)
.StartAsyncExchange(
HandleMessageStatusResult,
HandleMessageStatusError);
return exchangeId;
}#import <PayExplorerConnect/RetailerManager.h>
#import <PayExplorerConnect/MessageStatusParam+Builder.h>
// Use the exchange ID saved when the original request started.
MessageStatusParam *params = [MessageStatusParam makeWithBuilder:^(MessageStatusParamBuilder *builder) {
builder.orgExchangeIdentification(@"000000001");
builder.receiptReprintFlag(YES);
builder.documentQualifier(@[@"CRCP"]);
}];
[[RetailerManager sharedManager] messageStatus:params block:^(NSString *exchangeId) {
// Save the exchange ID to track this request.
} result:^(id result, NSInteger errcode, NSString *msg) {
if (errcode != 0 && result == nil) {
// Handle request error.
return;
}
MessageStatusResult *statusResult = (MessageStatusResult *)result;
// Handle message status result.
}];