Alipay+ DocsAlipay+ Docs

userInitiatedPay (private order code)Alipay+ ACQP

The userInitiatedPay API is used when the user initiates a payment request by scanning a private order code in Merchant-presented Mode Payment (Push Mode). Alipay+ calls this API to send the decoding request to the Acquiring Service Provider (ACQP) and then processes the payment according to the response returned by the ACQP.

Note: In the following sections, Mobile Payment Provider (MPP) is also known as Payment Service Provider. For example, the pspId parameter specifies the ID that identifies an MPP.

Structure

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

Note:

1. Set the data type of each parameter (except array) as String. This means that you must use double quotation marks (" ") to enclose the parameter value. Examples:

  • If the data type of a parameter is Integer and its value is 20, set it as "20". 
  • If the data type of a parameter is Boolean and its value is true, set it as "true".

2. For optional parameters that are not required in your case, you can take one of the following actions:

  • Exclude the parameters from the request body. 
  • Set the parameter values as null (without the double quotation marks).

Do NOT leave the optional parameters empty by setting their values as ""; otherwise, an error might occur. 

Request parameters

acquirerId String  

The unique ID that is assigned by Alipay+ to identify an ACQP.

More information:

  • Maximum length: 64 characters

pspId String  

The unique ID that is assigned by Alipay+ to identify an MPP.

More information:

  • Maximum length: 64 characters

codeValue String  REQUIRED

The code value that the user scans.

More information:

  • Maximum length: 512 characters

customerId String  

The unique ID that is assigned by Alipay+ to identify an MPP user.

This parameter is specified by Alipay+ if the relevant information is passed in by the MPP.

More information:

  • Maximum length: 64 characters

Response parameters

result Result object REQUIRED

The result of the business processing, including the result status, result code, and result message. For more information about how to return the result, see How to return the result.

Show child parameters

codeType String  

The type of code that the user scans.

In the Merchant-presented Mode Payment Private Order Code scenario, the valid value is:

  •  ORDER_CODE: indicates an order code.

Return this parameter if the value of the result.resultCode parameter is SUCCESS, which means that the decoding succeeds.

paymentRequestId String  

The unique ID that is assigned by the ACQP to identify a payment order.

Return this parameter if the value of the result.resultCode parameter is SUCCESS, which means that the decoding succeeds. 

More information:

  • Maximum length: 64 characters

paymentFactor PaymentFactor object 

Factors that impact payment-related items such as service fee, interchange fee (also known as interpartner fee), and regulatory reporting. This parameter is used to identify the payment scenario.

If the value of the result.resultCode parameter is SUCCESS and the value of the codeType parameter is ORDER_CODE, which means that the code is decoded as an entry code, return the following child parameters as follows:

  • isInStorePayment: set the value to true
  • isCashierPayment: set the value to true
  • inStorePaymentScenario: set the value to OrderCode
Show child parameters

order Order object 

The order details that are agreed upon by the buyer and the merchant, including the information about the buyer, the merchant, the goods, the initial order amount, and so on. The order details are displayed in purchase records and used for risk and regulatory reporting.

Return this parameter if the value of the result.resultCode parameter is SUCCESS and the value of the codeType parameter is ORDER_CODE, which means that the code is decoded as an order code.

It is recommended to return the following child parameters:

  • env.storeTerminalId
  • env.storeTerminalRequestTime
Show child parameters

paymentAmount Amount object 

The amount that the ACQP requests to receive from Alipay+. The currency of the amount must be specified to the one that the ACQP uses to create the payment order.

Return this parameter if the value of the result.resultCode parameter is SUCCESS and the value of the codeType parameter is ORDER_CODE, which means that the code is decoded as an order code.

Show child parameters

paymentExpiryTime Datetime  

The time after which the payment order is expired. If the payment transaction is not completed before the time that is specified for this parameter, Alipay+ informs the MPP to close the order.

Return this parameter if the value of the result.resultCode parameter is SUCCESS and the ACQP wants the payment transaction to be completed before a specific time. The default expiration time is 3 minutes. The returned expiration time must be shorter than the default expiration time; otherwise, the default expiration time takes effect instead of the returned expiration time.

More information:

  • The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".

settlementStrategy SettlementStrategy object 

The settlement strategy that is applied to the payment order. For example, the currency that the ACQP wants to be settled against.

Return this parameter if the value of the result.resultCode parameter is SUCCESS.

Important: If the settlement currency is different from the payment currency, that is specified on the paymentAmount.currency or paymentCurrency parameter, you must return this parameter correctly; otherwise, you can

  • Set the value of this parameter to that of the paymentAmount.currency or paymentCurrency parameter.
  • Set the value of this parameter to null (without double quotation marks).
  • Exclude this parameter from the response body.

In the latter case, the value of the paymentAmount.currency or paymentCurrency parameter is used as that of the settlementCurrency parameter.

Show child parameters
API Explorer
Sample CodesRun in Sandbox

Request

Request Body

Response

Response Body

More information

How to return the result 

  • If the decoding succeeds, set the value of result.resultStatus to S and the value of result.resultCode to SUCCESS.
  • If the decoding fails, set the value of result.resultStatus to F.
  • If the decoding result is unknown, set the value of result.resultStatus to U and the value of result.resultCode to UNKNOWN_EXCEPTION.

Result/Error codes

CodeValueMessage
SUCCESSSSuccess
ACCESS_DENIEDFAccess is denied.
BUSINESS_NOT_SUPPORTFThe payment business is not supported.
CURRENCY_NOT_SUPPORT FThe currency is not supported.
EXPIRED_CODEFThe code is expired.
INVALID_CLIENTFThe client is invalid.
INVALID_CODEFThe code is invalid.
INVALID_CONTRACTFThe contract is invalid.
INVALID_MERCHANT_STATUSFThe merchant status is abnormal due to restrictions, for example, the merchant's operation has been suspended.
INVALID_SIGNATUREFThe signature is invalid.
KEY_NOT_FOUNDFThe key is not found.
MEDIA_TYPE_NOT_ACCEPTABLEFThe server does not implement the media type that is acceptable to the client.
MERCHANT_KYB_NOT_QUALIFIEDFThe merchant's KYB failed or KYB level is not high enough.
MERCHANT_NOT_REGISTEREDFThe merchant is not registered.
METHOD_NOT_SUPPORTEDFThe server does not implement the requested HTTPS method.
NO_INTERFACE_DEFFAPI is not defined.
ORDER_IS_CLOSEDFThe order is closed.
PARAM_ILLEGALFIllegal parameters. For example, non-numeric input, invalid date.
PAYMENT_AMOUNT_INVALIDFPayment amount is invalid.
PROCESS_FAILFA general business failure occurred. Do not retry.
REQUEST_TRAFFIC_EXCEED_LIMITUThe request traffic exceeds the limit.
UNKNOWN_EXCEPTIONUAn API call failed, which is caused by unknown reasons.