inquiryPayment

The inquiryPayment API is called by the POS to query the payment status, typically when the POS does not receive a transaction response from the payment terminal.

Method signature

When calling this method, please use the following standard method signature format.

copy
fun inquiryPayment(
    queryPaymentRequest: QueryPaymentRequest,
    options: RequestOptions? = null,
    callBack: QueryPayResultListener? = null
)

Parameters

Parameter name

Type

Required

Description

queryPaymentRequest

QueryPaymentRequest

Yes

Indicates the object that contains the parameters for querying the payment result.

options

RequestOptions

No

Indicates the object that contains optional parameters in the API requests.

callback

QueryPayResultListener

No

The callback that is used to return the query result. See callback for details.

callback

Parameter name

Type

Required

Description

result

QueryPayResultData

No

Indicates the result of querying the payment result.

Return values

Parameter name

Type

Required

Description

result

Result

YesThe result of the API call.

paymentRequestId

String

Yes

The unique ID that is defined by the POS provider to identify a payment request.

  • Maximum length: 64 characters.
  • Only letters (a-z, A-Z), numbers (0-9), and underscores (_) are allowed.

Note: This parameter is unique for each store. Call the inquiryPayment API with the paymentRequestId to query the payment status. Each call returns the latest payment result.

paymentId

String

Yes

The unique ID that is defined by the POS provider to identify a payment and consistent with the paymentId in transaction reports.

paymentCreateTime

String

YesThe date and time when the payment is created. The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".

paymentTime

String

YesThe date and time when the payment reaches a final state of success. The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".

paymentStatus

String

Yes

Indicates the final status of payment. Valid values are:

  • SUCCESS: The payment is successful.
  • FAIL: The payment failed.
  • PROCESSING: The payment is under processing.
  • CANCELLED: The payment is canceled.
  • PENDINGThe payment completed, waiting for final payment result.

paymentAmount

Amount

YesThe payment amount that the merchant requests to receive in the order currency.

paymentMethod

String

Yes

The payment method that is used to collect the payment by the merchant or acquirer. For the supported payment methods, see Supported payment methods.

Result codes

resultCode

resultStatus

resultMessage

Further action

SUCCESS

S

Success.

No action is required.

PROCESS_FAIL

F

A general business failure occurred. Do not retry.

Contact Antom Technical Support to troubleshoot the issue.

PROCESS_FAIL

F

The data format is invalid.

Contact Antom Technical Support to troubleshoot the issue.

PROCESS_FAIL

F

The public key pairing failed.

Contact Antom Technical Support to troubleshoot the issue.

PARAM_ILLEGAL

F

Parameter names or values do not meet the specified requirements. The result message can vary according to the specific error encountered.Check whether the request parameters, including the header parameters and body parameters, are correct and valid.

TERMINAL_NOT_LOGIN

F

The payment terminal is not logged in.Log in to the payment terminal.

TERMINAL_BUSY

F

The payment terminal is busy.Try again later.

PAYMENT_NOT_EXIST

F

The payment does not exist.

Contact Antom Technical Support to troubleshoot the issue.

DEVICE_NOT_CONNECT

F

The USB connection failed.
  • Check whether the initialization connection has been completed in your code. If not, perform initialization connection.
  • Check whether both ends of the USB connection are securely connected in your code. If not, connect the two devices again.

TIMEOUT_EXCEPTION

U

Response timeout.Check whether the payment terminal app is active. If not, activate it again.

UNKNOWN_EXCEPTION

U

The API call failed, which is caused by unknown reasons.

Call the inquryPayment API

with the paymentRequestId to query the final payment status.

UNKNOWN_EXCEPTION

U

Failed to decrypt the data returned by the payment terminal.

Contact Antom Technical Support to troubleshoot the issue.

UNKNOWN_EXCEPTION

U

The message format is invalid.

Contact Antom Technical Support to troubleshoot the issue.

Samples

The following sample code shows how to call the inquiryPayment API:

copy
PaymentManager.inquiryPayment(
    request,
    null,
    object : QueryPayResultListener {
        override fun result(result: QueryPayResultData) {
            runOnUiThread {
                findViewById<TextView>(R.id.tv_response).text = result.toString()
            }
        }
    }
)

The following code shows a sample of the response:

copy
{
  "result":{
    "resultCode": "SUCCESS",
    "resultStatus": "S",
    "resultMessage": "Success."
  },
  "paymentRequestId": "pay_1089760038715669_1027757450XXXXX",
  "paymentId": "202502081140108001001888202003XXXXX",
  "paymentCreateTime": "2025-02-08T12:01:01+08:00",
  "paymentTime": "2025-02-08T12:01:01+08:00",
  "paymentStatus": "Success",
  "paymentAmount":{
    "currency": "SGD",
    "value": "50000"
  },
  "paymentMethod":"CARD"
}