Alipay+ DocsAlipay+ Docs

payAlipay+ → MPP

In the Easy Pay scenario, the pay API is used by Alipay+ to send a request to the MPP to check the user's MPP account and create a payment order. 

Note:

In the following sections, Mobile Payment Provider (MPP) is also known as Payment Service Provider (PSP). 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. 

Samples

Check the user's MPP account

After obtaining the user's MPP account, Alipay+ calls the pay API for the first time to request the MPP to check whether the user's MPP account supports the payment. 

The following samples illustrate the accounting checking flow:

1. Alipay+ sends a request to the MPP.

Sample Code

2. The MPP returns a response to Alipay+

Sample Code

Create a payment order

After the user confirms the MPP account to continue the payment on the authorization and payment page, Alipay+ calls the pay API for the second time to request the MPP to create a payment order and notifies the MPP of whether the user enables the one-click payment.

The following samples illustrate the process:

  1.  Alipay+ sends a request to the MPP. 
Sample Code
  1. The MPP returns a response to Alipay+ 
Sample Code

Request parameters

acquirerId String  REQUIRED

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

More information about this field

  • Maximum length: 64 characters

pspId String  REQUIRED

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

More information about this field

  • Maximum length: 64 characters

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.

For different payment scenarios, the following optional child parameters are also specified by Alipay+ apart from the required child parameters:

  • For the User-presented Mode Payment scenario, order.merchant.store is specified.

This parameter is specified by Alipay+ if paymentFactor.isVerificationAndPay is not specified or its value is set as false.  

Show child parameters

paymentRequestId String  REQUIRED

The unique ID that is assigned by Alipay+ to identify a payment order.

More information about this field

  • This field is an API idempotency field.For requests that are initiated with the same paymentRequestId, the MPP must regard the requests as repeated and process the requests only once. The MPP is recommended to check the consistency of the following key request parameters: paymentAmount, payToAmount, surchargeInfo, paymentMethod, and paymentPromoInfo. If any of their values is different from that in the previous request, the MPP needs to return the REPEAT_REQ_INCONSISTENT result code.
  • Maximum length: 64 characters

paymentAmount Amount object 

The amount that Alipay+ requests to receive from the MPP. The currency of the amount is the one that Alipay+ uses to create the payment order. If a promotion exists, this amount does not include the promotion amount.

For more information about how does Alipay+ calculate the different amounts involved in a payment order, see How are the different amounts calculated in the More information section of this topic. 

This parameter is specified by Alipay+ if paymentFactor.isVerificationAndPay is not specified or its value is set as false.  

Show child parameters

payToAmount Amount object 

The amount that the MPP settles to Alipay+. The currency of the amount is the MPP's currency.

For more information about how does Alipay+ calculate the different amounts involved in a payment order, see How are the different amounts calculated in the More information section of this topic.

This parameter is specified by Alipay+ if paymentFactor.isVerificationAndPay is not specified or its value is set as false.  

Show child parameters

paymentQuote Quote object 

The exchange rate between paymentAmount.currency and payToAmount.currency.

This parameter is specified by Alipay+ if payToAmount.currency is different from paymentAmount.currency.

Show child parameters

surchargeInfo SurchargeInfo object 

The information about the surcharge that Alipay+ collects on behalf of the MPP after authorization by the MPP. This is a value-added service provided by Alipay+

For more information about how does Alipay+ calculate the different amounts involved in a payment order, see How are the different amounts calculated in the More information section of this topic.

This parameter is specified by Alipay+ if the value of paymentFactor.needSurcharge is true.

Show child parameters

paymentMethod PaymentMethod object REQUIRED

The payment method that is used to collect the payment.

For different payment scenarios, the following optional child parameters are also specified by Alipay+ apart from the required child parameters:

  • For the User-presented Mode Payment scenario, 
    • paymentMethod.paymentMethodId is specified as the payment code that is presented by the user in the MPP app. 
    • paymentMethod.paymentMethodMetaData.paymentCodeRegion is specified if the value of the region parameter in the getPaymentCode API is specified.
  • For the Auto Debit scenario, paymentMethod.paymentMethodId is specified as the access token.

  • For the Easy Pay scenario, paymentMethod.paymentMethodMetaData.userLoginId and paymentMethod.paymentMethodMetaData.userLoginType are specified by Alipay+ if the paymentMethod.paymentMethodId parameter is not specified when the MPP checks whether the user's account supports the payment. For more information, see How to check the user's MPP account in the More information section.
Show child parameters

paymentFactor PaymentFactor object REQUIRED

Factors that impact payment-related items such as the quote price, fee, and regulatory reporting. 

The MPP can identify the payment scenario based on the following child parameters: 

  • isInStorePayment
  • isAgreementPayment
  • isPaymentEvaluation 
  • isEasyPayScenario
  • isVerificationAndPay

For more information, see How to identify the payment scenarios in the More information section of this topic.

Show child parameters

paymentExpiryTime Datetime  

The time after which the payment order is expired. If the payment order is not completed before the time that is specified for this parameter, Alipay+ closes the order.

This parameter is specified by Alipay+ in all payment scenarios except for when the value of the paymentFactor.isPaymentEvaluation parameter is true.

More information about this field

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

paymentNotifyUrl URL  

The URL that is used to receive payment result notifications from the MPP.

Important: The MPP must send payment result notifications to the URL that is specified on the paymentNotifyUrl parameter.

More information about this field

  • Maximum length: 2048 characters

paymentRedirectUrl URL  

The URL where the user is redirected to after the payment order is completed.  

This parameter is specified by Alipay+ if the user needs to be redirected from the MPP's payment result page to a predetermined page, for example, the merchant result page. For the Easy Pay scenario, this parameter is specified as a redirection URL with which the MPP can redirect users to the Alipay+ payment result page after completing the verification. 

More information about this field

  • Maximum length: 2048 characters

paymentPromoInfo PaymentPromoInfo object 

The information about the promotion that is applied to the payment order, including the promotion ID, promotion type, and the saved amount after the promotion is applied.

This parameter is specified by Alipay+ if a promotion is applied to the payment order.

Show child parameters

authorizationInfo AuthorizationInfo object 

The authorization information.

This parameter is specified by Alipay+ if the value of paymentFactor.isAuthorizationAndPay is true.

Show child parameters

otpVerification OtpVerification object 

The information about the One-Time Password (OTP) verification.

This parameter is specified by Alipay+ in the Auto Debit scenario if OTP verification is required.

Show child parameters

passThroughInfo String  

The information that is passed through by Alipay+ to the MPP. The value of this parameter is in a set of key-value pairs.

This parameter is specified by Alipay+ if the ACQP wants to pass information to the MPP. 

More information about this field

  • Maximum length: 2000 characters

Response parameters

result Result object REQUIRED

The result of the business processing, including the result code, result status, and result message. For more information about how to return the result in different payment scenarios, see How to return the result in the More information section of this topic.

Show child parameters

paymentId String  

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

For the Auto Debit and User-presented Mode Payment scenarios, return this parameter if the value of result.resultCode is SUCCESS, which means that the payment succeeds.

More information about this field

  • Maximum length: 64 characters

paymentUrl URL  

The URL where the user is redirected to confirm the payment.

For the Easy Pay scenario, it is the URL where the user is redirected to complete the verification. 

More information about this field

  • Maximum length: 2048 characters

paymentTime Datetime  

The date and time when the payment order reaches a final state.

For the Auto Debit and User-presented Mode Payment scenarios, return this parameter if the value of result.resultCode is SUCCESS, which means that the payment succeeds.

More information about this field

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

customerId String  

The unique ID that is assigned by the MPP to identify a user.

For the Auto Debit and User-presented Mode Payment scenarios, return this parameter if the value of result.resultCode is SUCCESS, which means that the payment succeeds.

More information about this field

  • Maximum length: 64 characters

customsDeclarationAmount Amount object 

The maximum amount that is to be declared by the ACQP to customs. The currency of the amount is the currency used by the MPP's user. For example, if the user uses ALIPAY_CN to pay, the currency is CNY.

For the Auto Debit and User-presented Mode Payment scenarios, return this parameter if the value of result.resultCode is SUCCESS and customs declaration is required by the MPP's local authority (for now this only includes the Chinese Mainland).

Show child parameters

passThroughInfo String  

The information that is passed through by the MPP to Alipay+. The value of this parameter is in a set of key-value pairs.

Return this parameter if the MPP wants to pass information to the ACQP.

More information about this field

  • Maximum length: 20000 characters
API Explorer

Request

Request Body

Response

Response Body

More information

How to check the user's MPP account

The MPP can use the paymentMethod.paymentMethodId or paymentMethod.paymentMethodMetadata.userLoginId parameter to check whether the user's MPP account can support the payment. In case both parameters are passed in by Alipay+, paymentMethod.paymentMethodId takes precedence.

How are the different amounts calculated

This section introduces how are paymentAmount, payToAmount, and surchargeAmount calculated when Alipay+ calls the pay API and provides calculation cases to illustrate the process.

Note: Alipay+ calculates the values of all amounts in the smallest currency unit. For example, if the currency is HKD and the amount is $1.00, the value of the amount is set to 100; or if the currency is JPY and the amount is ¥1, the value of the amount is set to 1. 

paymentAmount

  • paymentAmount.currency = The one that Alipay+ uses to create the payment order.
  • paymentAmount.value = Payment amount that is requested by the ACQP from Alipay+ - Promotion amount that is provided by Alipay+ 
    • If the promotion amount is in the MPP's currency, the promotion amount is converted to the currency that is used by the ACQP based on paymentQuote.

payToAmount

  • payToAmount.currency = The currency that is used by the MPP.
  • payToAmount.value = Payment amount that is requested by the ACQP from Alipay+ * paymentQuote - Promotion amount that is provided by Alipay+
    • If the promotion amount is in the currency used by the ACQP, the promotion amount is converted to the MPP's currency based on paymentQuote.

surchargeAmount

  • surchargeAmount.currency = The currency that is used by the MPP.
  • surchargeAmount.value = Payment amount that is requested by the ACQP from Alipay+ * surchargeQuote - Promotion amount that is provided by Alipay+
    • If the promotion amount is in the currency used by the ACQP, the promotion amount is converted to the MPP's currency based on surchargeQuote.

Calculation cases

The following two cases are provided for your reference.

Case 1

In this case, a Hong Kong user purchases a 1000 JPY merchandise from a Japanese merchant and applies a 5 JPY coupon provided by Alipay+ to the order. Besides, Alipay+ collects a surcharge on behalf of the MPP.

Known conditions

  • Initial order amount (paymentAmount specified by the ACQP): 1000 JPY
  • Instant discount: 5 JPY
  • Payment quote between JPY and HKD (paymentQuote): 1 JPY = 8.5614 HKD
  • Surcharge quote between JPY and HKD (surchargeQuote): 1 JPY = 8.9614 HKD

Calculation results

  • paymentAmount = 1000 JPY - 5 JPY = 995 JPY
  • savingsAmount = 5 JPY * 8.5614 = 43 HKD
  • payToAmount = 1000 JPY * 8.5614 - 5 JPY* 8.5614 = 8518 HKD
  • surchargeAmount = 1000 JPY * 8.9614 - 5 JPY* 8.9614 = 8916 HKD

Case 2

In this case, a Hong Kong user purchases a 10000 USD merchandise from an American merchant and applies a 500 HKD coupon provided by Alipay+ to the order. No surcharge is collected.

Known conditions

  • Initial order amount (paymentAmount specified by the ACQP): 10000 USD
  • Instant discount: 500 HKD
  • Payment quote between USD and HKD (paymentQuote): 1 USD = 9.3307 HKD

Calculation results

  • paymentAmount = 10000 USD - 500 HKD / 9.3307 = 9946 USD
  • savingsAmount = 500 HKD
  • payToAmount = 10000 USD * 9.3307 - 500 HKD = 92807 HKD

How to identify the payment scenarios

The following table shows how the key payment factors are specified by Alipay+ for each payment scenario. The MPP can identify which payment scenario is in process according to the configuration of the paymentFactor parameter.

Table 1: Payment factors and scenarios

Payment scenario

isInStorePayment

isAgreementPayment

isPaymentEvaluation

isEasyPayScenario

User-presented Mode Payment

TRUE

Auto Debit

TRUE

Payment Evaluation for Auto Debit

TRUE

TRUE

Easy Pay

TRUE

How to return the result

For different payment scenarios, according to the business processing result, the MPP needs to return the corresponding result (specified on the result parameter) and specify some optional parameters.

For the Auto Debit and User-presented Mode Payment scenarios:

  • If the payment succeeds, set the value of result.resultStatus to S and specify the following optional parameters: paymentId, paymentTime, and customerId.
  • If the payment fails, set the value of result.resultStatus to F.
  • If the payment result is unknown, set the value of result.resultStatus to U and the value of result.resultCode to UNKNOWN_EXCEPTION.

For the Auto Debit payment evaluation scenario:

  • If the payment evaluation result is successful, set the value of result.resultStatus to S.
  • If the payment evaluation result is unsuccessful, set the value of result.resultStatus to F.
  • If the payment evaluation result is unknown, set the value of result.resultStatus to U and the value of result.resultCode to UNKNOWN_EXCEPTION.

For the Easy Pay scenario, the pay API is used in the following three situations:

  • Check the user's MPP account: 
    • If the checking result is successful, set the value of result.resultStatus to S
    • If the checking result is unsuccessful, set the value of result.resultStatus to F
    • If the checking result is unknown, set the value of result.resultStatus to U

  • Create a payment order: 
    • In this stage, never set the value of result.resultStatus to S because this parameter indicates the payment result status and the payment can not be successful before the MPP completes the verification.
    • If the MPP detects certain risks and needs to implement verification, set the value of result.resultStatus to U.
    • If the MPP rejects the verification, set the value of result.resultStatus to F. 

 

Result/Error codes

CodeValueMessage
SUCCESSSSuccess
ACCESS_DENIEDFThe access is denied.
BUSINESS_NOT_SUPPORTFThe payment business is not supported.
CURRENCY_NOT_SUPPORTFThe 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_SIGNATUREFThe signature is invalid.
INVALID_TOKENFThe access token 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_NOT_REGISTEREDFThe merchant is not registered.
METHOD_NOT_SUPPORTEDFThe server does not implement the requested HTTP method.
NO_INTERFACE_DEFFAPI is not defined.
ORDER_IS_CLOSEDFThe order is closed.
PARAM_ILLEGALFIllegal parameters exist. For example, a non-numeric input, or an invalid date.
PAYMENT_AMOUNT_EXCEED_LIMITFThe payment amount exceeds the limit.
PAYMENT_COUNT_EXCEED_LIMITFThe number of payments exceeds the limit.
PROCESS_FAILFA general business failure occurred. Don't retry.
REGULATION_RESTRICTIONFThe payment failed due to regulatory restriction.
REPEAT_REQ_INCONSISTENTFRepeated requests are inconsistent.
RISK_REJECTFThe request is rejected because of the risk control.
UNAVAILABLE_PAYMENT_METHODFThe payment method is unavailable.
USER_AMOUNT_EXCEED_LIMITFThe payment amount exceeds the user payment limit.
USER_BALANCE_NOT_ENOUGHFThe user balance is not enough for the payment.
USER_KYC_NOT_QUALIFIEDFThe user is not KYC compliant.
USER_NOT_EXISTFThe user does not exist.
USER_PAYMENT_VERIFICATION_FAILEDFUser fails to pass the payment verification in the methods like OTP, PIN, and so on.
USER_STATUS_ABNORMALFThe user status is abnormal.
OTP_VERIFICATION_FAILEDUThe OTP verification failed.
PAYMENT_IN_PROCESSUThe payment is being processed.
REQUEST_TRAFFIC_EXCEED_LIMITUThe request traffic exceeds the limit.
UNKNOWN_EXCEPTION UAn API calling is failed, which is caused by unknown reasons.
VERIFICATION_IN_PROCESSUThe OTP verification is in process.