Alipay+ DocsAlipay+ Docs

notifyPaymentMPP Alipay+

POST /aps/api/v1/payments/notifyPayment

The notifyPayment API is used by the Mobile Payment Provider (MPP) to notify the payment result to Alipay+ when payment processing reaches a final state of success or failure. 

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:

  • exclude them from the request body. 
  • set the 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

paymentResult Result object REQUIRED

The result of the payment. The value of the paymentResult.resultStatus parameter represents the payment status, where S represents success and F represents failure. The value of the paymentResult.resultStatus parameter cannot be U when this API is called to send the payment result. See the Payment result codes table for more details.  

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, Alipay+ regards the requests as repeated and processes the requests only once. Alipay+ checks the consistency of the following key request parameters: paymentAmount, paymentResult, paymentId, payToAmount, customerId, and customsDeclarationAmount. If any of their values is different from that in the previous request, Alipay+ returns the REPEAT_REQ_INCONSISTENT result code.
  • Maximum length: 64 characters

paymentId String  

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

Specify this parameter if the value of the paymentResult.resultStatus parameter is S, which means that the payment succeeds. 

More information about this field

  • Maximum length: 64 characters

paymentAmount Amount object REQUIRED

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

Specify this parameter if the value of the paymentResult.resultStatus parameter is S, which means that the payment succeeds. 

Show child parameters

payToAmount Amount object 

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

Specify this parameter if the value of the paymentResult.resultStatus parameter is S and payToAmount.currency is different from paymentAmount.currency. When this parameter is specified, payToAmount.value is calculated based on paymentAmount.value and paymentQuote.quotePrice by using the rounding mode of HALF EVEN. 

Show child parameters

paymentTime Datetime  

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

Specify this parameter if the value of the paymentResult.resultStatus parameter is S, 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.

Specify this parameter if the value of the paymentResult.resultStatus parameter is S, which means that the payment succeeds. 

More information about this field

  • Maximum length: 64 characters

customsDeclarationAmount Amount object 

The 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.

Specify this parameter if the value of the paymentResult.resultStatus parameter is S 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. 

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

More information about this field

  • Maximum length: 20000 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 handle the result of notifyPaymet API, see How to handle the result

Show child parameters

acquirerId String  

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

This parameter is returned by Alipay+ if the value of the result.resultCode parameter is SUCCESS, which means that the notification succeeds. 

More information about this field

  • Maximum length: 64 characters

pspId String  

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

This parameter is returned by Alipay+ if the value of the result.resultCode parameter is SUCCESS, which means that the notification succeeds. 

More information about this field

  • Maximum length: 64 characters
API Explorer
Sample CodesRun in Sandbox

Request

URL
Request Body

Response

Response Body

More information

How to handle the result

You might receive different results from Alipay+. Follow the instructions below to handle the result. 

result.resultStatus

result.resultCode

Notification status

Actions

S

SUCCESS

Notification succeeds.

N/A

F

Multiple possible values exist, such as

ACCESS_DENIED,

KEY_NOT_FOUND, etc.

Notification fails.

Take actions according to the result code (specified on the result.resultCode parameter). For more information, see Result codes section below.

U

Multiple possible values exist, such as

UNKNOWN_EXCEPTION,

REQUEST_TRAFFIC_EXCEED_LIMIT, etc.

Unknown.

Retry the same request.

No result received

Unknown.

Retry the same request.

Result/Error codes

CodeValueMessageFurther action
SUCCESSSSuccess

N/A 

ACCESS_DENIEDFAccess is denied.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. 

INVALID_CLIENTFThe client is invalid.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. 

INVALID_SIGNATUREFThe signature is invalid.

Check whether the public key, signed message, and signature algorithm are as expected. 

KEY_NOT_FOUNDFThe key is not found.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. 

MEDIA_TYPE_NOT_ACCEPTABLEFThe server does not implement the media type that is acceptable to the client.

Use a media type that is accepted by Alipay+

METHOD_NOT_SUPPORTEDFThe server does not implement the requested HTTPS method.

Ensure the HTTP method is POST. 

NO_INTERFACE_DEFFAPI is not defined.

Check whether the request URL is correct. Ensure that the endpoint of the called API is correct. 

PARAM_ILLEGALFIllegal parameters. For example, non-numeric input, invalid date.

Check whether the request parameters, including the header parameters and body parameters, are correct and valid. For more information about the parameters of each API, see the Structure section of the specific API reference topic. 

PROCESS_FAILFA general business failure occurred. Do not retry.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. 

REQUEST_TRAFFIC_EXCEED_LIMITUThe request traffic exceeds the limit.

Reduce the frequency of API calls. 

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

Try to recall the API. 

Payment result codes

CodeValueMessage
SUCCESSSSuccess
BUSINESS_NOT_SUPPORTFThe payment business is not supported.
CURRENCY_NOT_SUPPORTFThe currency is not supported.
EXPIRED_CODEFThe code is expired.
INVALID_CONTRACTFThe contract is invalid.
INVALID_TOKENFThe access token is invalid.
MERCHANT_NOT_REGISTEREDFThe merchant is not registered.
ORDER_IS_CLOSEDFThe order is closed.
PAYMENT_AMOUNT_EXCEED_LIMITFThe payment amount exceeds the limit that is specified by <span>Alipay+</span>.
PAYMENT_COUNT_EXCEED_LIMITFThe number of payments exceeds the limit.
PROCESS_FAILFA general business failure occurred. Do not retry.
REGULATION_RESTRICTIONFThe payment failed due to regulatory restriction.
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 payment limit that is specified by the user's digital wallet.
USER_BALANCE_NOT_ENOUGHFThe user balance is not enough for the payment.
USER_NOT_EXISTFThe user does not exist.
USER_PAYMENT_VERIFICATION_FAILEDFUser fails to pass the payment verification in the methods like OPT, PIN, and so on.
USER_STATUS_ABNORMALFThe user status is abnormal.