Payments

inquiryPayment

Poll payment status when asynchronous notifications are delayed.

Overview

POST /v1/payments/inquiryPayment returns the latest status of a wallet payment. Merchants poll this API when asynchronous callbacks (for example via paymentNotifyUrl) do not arrive in time. Always send requests in the smallest currency unit (IQD fils).

  • Poll at a round-robin interval between 5 seconds and 1 minute to avoid throttling.
  • Monetary values must be expressed in the smallest currency unit (IQD fils). For example, 100 IQD is 100000.

  1. Mini Program calls my.getAuthCode with the required scopes to request authorization.
  2. Wallet app service processes the authorization request and displays the consent page to the user.
  3. User approves the authorization, and the wallet backend verifies the request and issues an authCode.
  4. Wallet app service returns the authCode to the Mini Program.
  5. Mini Program forwards the authCode to the merchant backend.
  6. Merchant backend calls applyToken with the authCode to obtain tokens.
  7. Wallet backend returns accessToken, refreshToken, and customerId information to the merchant backend.
  8. Mini Program creates the payment order using the received customerId and sends it to the merchant backend.
  9. Merchant backend invokes /v1/payments/pay to initiate the payment and receives a redirectionUrl and optional paymentNotifyUrl confirmation.
  10. Merchant backend relays the redirectionUrl to the Mini Program.
  11. Mini Program calls my.tradePay with the redirectionUrl to open the cashier experience.
  12. Wallet app service presents the cashier UI, the user confirms the payment, and the wallet backend processes the transaction.
  13. Wallet backend returns the payment result to the Mini Program and pushes notifications to the merchant backend via paymentNotifyUrl.
  14. Merchant backend polls /v1/payments/inquiryPayment with paymentId or paymentRequestId, and the wallet backend responds with the latest payment status and transaction details.

Endpoint

MethodPath
POST/v1/payments/inquiryPayment

API Structure

A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see: OpenAPIs Overview.

Request

FieldTypeRequiredDescriptionExample
paymentIdstringConditionalWallet-generated payment ID. Max 64 characters. Provide either paymentId or paymentRequestId."202312061112128001001660090000xxxx"
paymentRequestIdstringConditionalMerchant-generated payment ID. Max 64 characters. Used when paymentId is unavailable."20230101234567890133333xxxx"
{
  "paymentRequestId": "102217200000000000001xxxx"
}
{
  "paymentId": "202312061112128001001660090000xxxx"
}

Provide either paymentId or paymentRequestId (not both). If both are provided, paymentId takes precedence.

Response

FieldTypeRequiredDescriptionExample
resultobjectYesRequest outcome metadata (status and error codes).{ "resultCode": "SUCCESS", "resultStatus": "S", "resultMessage": "success" }
paymentIdstringNoWallet payment ID."202312061112128001001660090000xxxx"
paymentRequestIdstringNoMerchant payment ID."20230101234567890133333xxxx"
paymentAmountobjectNoAmount/value pair in smallest currency unit.{ "value": "100000", "currency": "IQD" }
paymentTimestringNoPayment completion timestamp in ISO 8601 format."2023-01-01T12:01:01+08:00"
paymentStatusstringNoStatus of the payment. Possible values: PROCESSING, AUTH_SUCCESS, SUCCESS, FAIL."SUCCESS"
transactionsarrayNoDetailed transaction records (amount, type, status, timestamp).[{"transactionAmount":{"value":"100000","currency":"IQD"},"transactionId":"20231206111212800100xxxx","transactionTime":"2023-01-01T12:01:01+08:30","transactionType":"PAY","transactionStatus":"SUCCESS"}]
extendInfostringNoAdditional information supplied by wallet or merchant. Max length 2048 characters."extendInfo": "additional information"
{
  "result": {
    "resultCode": "SUCCESS",
    "resultStatus": "S",
    "resultMessage": "success"
  },
  "paymentId": "202312061112128001001660090000xxxx",
  "paymentRequestId": "20230101234567890133333xxxx",
  "paymentAmount": {
    "value": "100000",
    "currency": "IQD"
  },
  "paymentTime": "2023-01-01T12:01:01+08:00",
  "paymentStatus": "SUCCESS",
  "transactions": [
    {
      "transactionAmount": {
        "value": "100000",
        "currency": "IQD"
      },
      "transactionId": "20231206111212800100xxxx",
      "transactionTime": "2023-01-01T12:01:01+08:30",
      "transactionType": "PAY",
      "transactionStatus": "SUCCESS"
    }
  ]
}

Result Processing Logic

StatusDescription
SInquiry succeeded. Check paymentStatus for the actual payment outcome.
UResult unknown (resultCode: UNKNOWN_EXCEPTION). Retry later and monitor notifications.
FInquiry failed. Review resultCode and resultMessage; see Error codes.

Error Codes

resultStatusresultCoderesultMessageRecommended Action
FORDER_NOT_EXISTOrder does not exist.Verify paymentId/paymentRequestId; treat as unpaid until clarified.