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

sendPaymentResult

POST /v1/risk/payments/sendPaymentResult

Use this API to notify Ant of the payment result of the transaction when the payment processing reaches a final state of success or failure. This API is used for future risk evaluation.

Structure

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


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

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

Request parameters

referenceTransactionId String  REQUIRED

The unique ID assigned by the merchant that directly provides services or goods to users, to identify a transaction.

More information:

  • Maximum length: 64 characters

paymentStatus String  REQUIRED

Indicates the payment result. Valid values are: 

  • SUCCESS: Indicates that the payment succeeds. 
  • FAIL: Indicates that the payment fails. 

More information:

  • Maximum length: 16 characters

authorizationError Error  

The reason provided by a payment method provider for a failed card payment authorization.

Providing this information helps to increase the accuracy of fraud detection and improve payment success rates. 

Show child parameters

cardVerificationResult CardVerificationResult  

The verification result of the card payment method.

Specify this parameter when the payment is completed.

Show child parameters

paymentMethodProvider String  REQUIRED

Payment method provider.

Response parameters

result Result  REQUIRED

The result of the API call.

Show child parameters
API Explorer
Sample CodesRun in Sandbox

Request

URL
Request Body

Response

Response Body


Result/Error codes

CodeValueMessageFurther action
SUCCESSSSuccess

The API is called successfully, no further action is needed. 

ACCESS_DENIEDFAccess is denied.

Contact Alipay Technical Support for detailed reasons.

INVALID_APIFThe called API is invalid or not active.

Contact Alipay Technical Support to resolve the issue.

INVALID_CONTRACTFThe parameter values in the contract do not match those in the current transaction.

Check whether the parameter values in the contract match those in the current transaction. If the values match, contact Alipay Technical Support to troubleshoot the issue.

KEY_NOT_FOUNDFThe private key or public key of Alipay or the merchant is not found.

Check whether the private key or public key exists. If not, upload the private key in Alipay Developer Center.

MERCHANT_KYB_NOT_QUALIFIEDFThe payment failed because of the merchant's KYB status. The merchant is either not KYB compliant, or the KYB status is not qualified for this transaction.

Contact Alipay Technical Support for detailed reasons.

MERCHANT_NOT_REGISTEREDFThe merchant is not registered.

Please register the merchant by using the registration interface. Contact Alipay Technical Support if failed to call the registration interface.

NO_INTERFACE_DEFFAPI is not defined.

Check whether the URL is correct. Please refer to the endpoint in the API documentation.

REQUEST_TRAFFIC_EXCEED_LIMITUThe request traffic exceeds the limit.

Call the interface again to resolve the issue. If not resolved, contact Alipay Technical Support.

PARAM_ILLEGALFThe required parameters are not passed, or illegal parameters exist. For example, a non-numeric input, an invalid date, or the length and type of the parameter are wrong.

Check and verify whether the required request fields (including the header fields and body fields) of the current API are correctly passed and valid.

SYSTEM_ERRORFA system error occurred.

Do not retry, and contact Alipay Technical Support for more details.

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

Call the interface again to resolve the issue. If not resolved, contact Alipay Technical Support.