Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

alipay.intl.acquiring.offline.payQuery

Use this API to query transaction status and other information.

Request

Service address

Request head

ParameterDescription

version

String(8) Required

API version

Example:2.0.4

function

String(128) Required

API name 

Example:alipay.intl.acquiring.offline.payQuery

clientId

String(32) Required

A unique ID assigned by Alipay to identify a client that makes API calls.

Example:385xxxxxxxxx0001

reqTime

Date time(/) Required

Request time. The date time with timezone, see RFC 3339 Section 5.6 for details. 

Example:2001-07-04T12:08:56+05:30

reqMsgId

String(64) Required

Request message ID. A unique ID assigned by the client to identify a request message. This ID identifies a unique system request rather than a unique business request.

Example:123xxxxxxxxxxxxxxx3fda

reserve

String(256) Conditional

Reserved parameter. Key-value formatted parameter reserved for future use. This parameter is required when you are a system integrator. If you are a system integrator, you must provide the isvAccesstoken value. 

Example:{"isvAccesstoken":123123123sdfsddsf}

signType

String(64)

Sign type 

Example:RSA2

Request body

ParameterDescription

merchantId

String(64) Required

The unique merchant ID assigned by Alipay. This parameter identifies the settlement target that Alipay settles to.

Example:211xxxxxxxxxxxxxx2999

acquirementId

String(64) Conditional

The unique Alipay transaction ID that identifies the transaction to be queried. This parameter is required when merchantTransId is NULL. 

Example:201xxxxxxxxxxxxxxxxxxxxx5678

merchantTransId

String(64) Conditional

The unique merchant transaction ID assigned by the merchant to identify a transaction. This parameter is required when acquirementId is NULL. Note: If both the acquirementId and merchantTransId exist, the acquirementId prevails.

Example:510xxxxxxxxxxxxx0002

Response

Response head

ParameterDescription

version

String(8) Required

API version

Example:2.0.4

function

String(128) Required

API name

Example:alipay.intl.acquiring.offline.payQuery

clientId

String(32) Required

Client ID. A unique ID assigned by Alipay to identify a client that makes API calls.

Example:385xxxxxxxxx0001

respTime

Date time(/) Required

Response time. The date time with timezone, see RFC 3339 Section 5.6 for details. 

Example:2001-07-04T12:08:56+05:30

reqMsgId

String(64) Required

Request message ID. The unique ID assigned by client to identify a request message 

Example:123xxxxxxxxxxxxxxx3fda

reserve

String(256)

Reserved parameter. The key-value formatted parameter reserved for future use.

Example:{key/value}

signType

String(8)

Sign type 

Example:RSA2

Response body

ParameterDescription

resultInfo

ResultInfo(/) Required

Result info. See resultInfo for details. 

Example:{ "resultStatus": "S", "resultCodeId": "00000000", "resultCode":"SUCCESS", "resultMsg": "result message" }

payment

Payment(/) Conditional

The payment information. See payment for details. This parameter is required when resultInfo.resultCode is SUCCESS.

Example:{ "acquirementId": "2015xxxxxxxxxxxxxxxxxxxxx678", "merchantTransId": "510xxxxxxxxxxxxxx234", "payStatus": "PAY_SUCCESS", "orderAmount": { "currency": "CNY", "value": "2390"}, "paymentTime": "2001-07-04T12:08:56+05:30" }

userSite

enum<Site>(64) Conditional

The user site where the payment happens. This parameter is required when resultInfo.resultCode is SUCCESS. See Site for details. 

Example:ALIPAY_CN

userId

String(64)

An ID that identifies a user in the user site.

Example:208xxxxxxxxx9012

userLoginId

String(64)

An ID that the user uses to login to the payment site. The ID is masked to protect the customer privacy.

Example:c***@gmail.com

extendInfo

String(2048)

Extended information. Key-value formatted parameter reserved for future use.

Example:{"isEnterpriseUser":"true"}

Sub-parameters

resultInfo

ParameterDescription

resultStatus

String(2) Required

The request status can be:S: successF: failureU: unknown

Example:S

resultCodeId

String(8) Required

Result ID. An 8-digit code that is used to identify a result. When resultStatus is S, the value must be 00000000. When resultStatus is F or U, the value can be other result ID specified by the interface. 

Example:00000000

resultCode

String(64) Required

The result code

Example:SUCCESS

resultMsg

String(256)

Result message. When resultCode is S, this value can be empty. When resultCode is F or U, the error description is required.

Example:success

payment

ParameterDescription

acquirementId

String(64) Required

The unique Alipay transaction ID.

Example:201xxxxxxxxxxxxxxxxxxxxx5678

merchantTransId

String(64) Required

The unique ID assigned by the merchant to identify a transaction. 

Example:510xxxxxxxxxxxxx0002

payStatus

String(32) Required

Status can be: WAIT_PAY: Awaiting the payment PAY_SUCCESS: Payment success PAY_FAILED: Payment failed PAY_CANCELLED: Payment cancelled 

Example:PAY_SUCCESS

orderAmount

Money(/) Required

The orderAmount is provided in the smallest common currency unit. For example, to create a charge for $1.00, set orderAmount value to 100 (100 cents). 

Example:{"currency":"USD", "value":"239"}

conversionRate

ExchangeRate(/) Conditional

The exchage rate between orderAmount and payAmount. Note: This parameter is required when payCurrencyDifferentWithOrderCurrency is true. See conversionRate for details. 

Example:{ "baseCurrency":"USD", "exchangeCurrency":"CNY", "rate":"6.9123" }

paymentTime

Date time(/)

The time when the transaction is paid. Date time with timezone, see RFC 3339 Section 5.6 for details.

Example:2016-07-04T12:08:56+05:30

extendInfo

String(2048)

Extended information. Key-value formatted parameter reserved for future use.

Example:{Key, Value}

payAmount

Money(/)Conditional

The actual amount the buyer paid. 
Example:{"currency":"CNY", "value":"1481"}

Money

ParameterDescription

currency

String(3) Required

The 3-letter currency code. See Supported currencies for details. 

Example:USD

value

Number(16) Required

The amount. This value must be provided in the smallest common currency unit. For example, to create a charge for $1.00, you can set orderAmount: value=100 (100 cents). 

Example:239

conversionRate

ParameterDescription

baseCurrency

String(3) Required

The base currency

Example:USD

exchangeCurrency

String(3) Required

The exchange currency 

Example:CNY

rate

String(16) Required

The exchange rate of baseCurrency against exchangeCurrency

Example:6.9123

Site

Name

Type

Description

ALIPAY_CN

String

Alipay site for Chinese mainland

ALIPAY_HK

String

Alipay site for Hong Kong, China

KAKAOPAY

String

Kakao Pay 

TNG

String

Touch'n Go eWallet

Result code

Functional logic result code

resultCodeId

resultCode

resultStatus

Remarks

12005003

ORDER_STATUS_INVALID

F

The transaction status is invalid.

12005004

ORDER_NOT_EXIST

F

The transaction does not exist.

12005134

SIGN_TYPE_INVALID

F

The signature type is invalid.

Basic result code

resultCodeId

resultCode

resultStatus

Remarks

00000000

SUCCESS

S

Success

00000019

PROCESS_FAIL

F

General business failure

00000901

UNKNOWN_EXCEPTION

U

API failed because of unknown reasons

00000004

PARAM_ILLEGAL

F

The parameter is incorrect.

00000007

INVALID_SIGNATURE

F

The signature is invalid.

00000008

KEY_NO_FOUND

F

The key is not found.

00000013

NO_INTERFACE_DEF

F

The API is undefined.

00000014

API_IS_INVALID

F

The API is invalid or nonactivated.

00000021

ACCESS_DENIED

F

Access denied

12014155

UNKNOWN_CLIENT

F

Unknown client

12014156

INVALID_CLIENT_STATUS

F

Invalid client status

00000024

REQUEST_TRAFFIC_EXCEED_LIMIT

F

The request traffic exceeds the limit.

12003001

MERCHANT_NOT_EXIST

F

The merchant doesn't exist.

Sample

Sample request

copy
{
    "request":{
        "head":{
            "version":"2.0.4",
            "function":"alipay.intl.acquiring.offline.payQuery",
            "clientId":"385xxxxxxxxx0001",
            "reqTime":"2001-07-04T12:08:56+05:30",
            "reqMsgId":"123xxxxxxxxxxxxxxx3fda",
            "signType":"RSA2"
        },
        "body":{
            "merchantId":"211xxxxxxxxxxxxxx2999",
            "acquirementId":"201xxxxxxxxxxxxxxxxxxxxx5678"
        }
    },
    "signature":"signature string"
}

Sample response

copy
{
    "response":{
        "head":{
            "version":"2.0.4",
            "function":"alipay.intl.acquiring.offline.payQuery",
            "clientId":"385xxxxxxxxx0001",
            "respTime":"2001-07-04T12:08:56+05:30",
            "reqMsgId":"123xxxxxxxxxxxxxxx3fda",
            "reserve":"{}",
            "signType":"RSA2"
        },
        "body":{
            "resultInfo":{
                "resultStatus":"S",
                "resultCodeId":"00000000",
                "resultCode":"SUCCESS",
                "resultMsg":"success"
            },
            "payment":{
                "acquirementId":"201xxxxxxxxxxxxxxxxxxxxx5678",
                "merchantTransId":"510xxxxxxxxxxxxx1234",
                "payStatus":"PAY_SUCCESS",
                "orderAmount":{
                    "currency":"USD",
                    "value":"239"
                },
                "paymentTime":"2001-07-04T12:08:56+05:30",
                "extendInfo":"{}"
            },
            "userSite":"ALIPAY_CN",
            "userId":"208xxxxxxxxx9012",
            "userLoginId":"c***@gmail.com",
            "extendInfo":"{\"isEnterpriseUser\":\"true\"}"
        }
    },
    "signature":"signature string"
}