Alipay+Alipay+

declareACQP → Alipay+

POST /aps/api/v1/customs/declare

The declare API is used by the Acquiring Service Provider (ACQP) to send a customs declaration request to Alipay+. Currently, only for payments that are processed by the AlipayCN wallet, declarations are required.

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:

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

paymentRequestId String  REQUIRED

The unique ID that is assigned by the ACQP to identify a payment request for the order. The value of this parameter is the same as paymentRequestId that is specified in the pay API. 

This paramter is used as the order ID for declaration only if the value of isSplit is false

More information about this field:

  • Maximum length: 64 characters

customsDeclarationRequestId String  REQUIRED

The unique ID that is assigned by the merchant to identify a customs declaration request. This parameter is not provided for the customs. 

More information about this field:

  • This field is an API idempotency field.
  • Maximum length: 64 characters

customs CustomsInfo object REQUIRED

The customs information, including customs code and region. 

Show child parameters

merchantCustomsInfo MerchantCustomsInfo object REQUIRED

The merchant information that is registered in the customs system. 

Show child parameters

declarationAmount Amount object REQUIRED

The customs declaration amount.

Note: When specifying the child parameters:

  • declarationAmount.currency: the value of this parameter needs to be fixed as CNY.
  • declarationAmount.value: the value of this parameter and the accumulated declaration amount for the same paymentRequestId cannot exceed the original payment amount, namely the value of customsDeclarationAmount.value in the inquiryPayment and notifyPayment APIs. 
Show child parameters

isSplit Boolean  REQUIRED

This parameter indicates whether the payment order needs to be split for declaration. Valid values are:

  • true: indicates that order splitting is needed.
  • false: indicates that order splitting is not needed.

Note: The value of this parameter affects the value of order ID for declaration. 

  • If isSplit is true, the order ID for declaration is the value of referenceOrderId.
  • If isSplit is false, the order ID for declaration is the value of paymentRequestId

More information about this field:

  • Maximum length: 1 character

referenceOrderId String  

The unique ID that is assigned by the merchant to identify an order that needs to be declared to the customs. This paramter is used as the order ID for declaration only if isSplit is true.

Note: Required if isSplit is true

More information about this field:

  • Maximum length: 64 characters

buyerCertificate Certificate object 

The buyer's identity information, including name, certificate type, and certificate number.

Note: Specify this parameter if the merchant wants to ensure that the buyer's identity is consistent with the payer's identity. If so, Alipay+ returns the identity result, which can help improve the customs declaration success rate. 

Show child parameters

Response parameters

result Result object REQUIRED

The result of the business processing, including the result status, result code, and the result message.

Note: This parameter only indicates whether the request is accepted by Alipay+, but not indicates whether the declaration is approved by the customs or not. For the declaration result, see the declarationRequestStatus parameter in the inquireDeclarationRequests API. 

Show child parameters

pspPaymentId String  

The payment ID that is provided for the customs by the AlipayCN wallet. 

More information about this field:

  • Maximum length: 64 characters

pspDeclarationRequestId String  

The declaration request ID that is assigned by the AlipayCN wallet. This ID is not provided for the customs.

Note: Returned by Alipay+ if result.resultStatus is S

More information about this field:

  • Maximum length: 64 characters

pspCustomsCode String  

The AlipayCN wallet's registration ID in the customs system.

Note: Returned by Alipay+ if result.resultStatus is S

More information about this field:

  • Maximum length: 32 characters

clearingChannel String  

The clearing channel of the merchant. Valid values are:

  • CUP: indicates that the clearing channel is Unionpay.
  • NUCC: indicates that the clearing channel is NetsUnion.
  • OTHER: indicates that the clearing channel is others.

Note: Returned by Alipay+ if result.resultStatus is S.  

clearingTransactionId String  

The clearing organization's clearing serial number, which be verified by organizations trusted by the People's Bank of China.

Note: Returned by Alipay+ if result.resultStatus is S.  

More information about this field:

  • Maximum length: 64 characters

pspOrderAmount Amount object 

The transaction amount that was paid with the AlipayCN wallet.

Note: Returned by Alipay+ if result.resultStatus is S

Show child parameters

identityCheckResult String  

The verification result that indicates whether the buyer's identity is consistent with the payer's identity. Valid values are:

  • CHECK_PASSED: indicates that the buyer's name and ID card number are the same as the payer's.
  • CHECK_NOT_PASSED: indicates that the buyer's name and ID card number are not the same as that of the payer's.

Note: Returned by Alipay+ if

  • resultStatus is S, and
  • buyerCertificate is specified by the ACQP/merchant. 
API Explorer
Sample CodesRun in Sandbox

Request

URL
Request Body

Response

Response Body

More information

Payment information retransmission

Currently, the digital wallet that requires customs declaration is only AlipayCN, and for payments made with AlipayCN, you can change the information of a declared payment and submit it again by using the declare API.

The retransmission function can be used if:

  • the payment data is missing in the customs system; or
  • the previous declaration data contains the wrong information, including but not limited to the values of merchantCustomsInfo.merchantCustomsCode, merchantCustomsInfo.merchantCustomsName and customsInfo.customsCode.

The declarationAmount in the retransmitted request is not stacked in the total amount of the customs declaration, but replaces the previous amount.

Retransmission conditions

All declarations can be retried. Before retransmitting the request, make sure that the following conditions are met:

  • The declaration with the same customsDeclarationRequestId exists in the Alipay+ system.
  • More than 5 minutes have passed since the last API call. (Alipay+ might adjust this time value according to the actual situation.)
  • All information must be the same as that of the original request, except the values of the following paramerters:
    • merchantCustomsCode
    • merchantCustomsName
    • customsCode
    • declarationAmount
  • If declarationAmount has changed, the new accumulated declaration amount cannot exceed the original total transaction amount.

Retransmission response

The following list describes the responses under different situations:

  • If retransmission conditions are not met and none of the parameter values is changed, Alipay+ returns idempotent success.
  • If retransmission conditions are not met but one or more parameter values are changed, Alipay+ returns REPEAT_REQ_INCONSISTENT or other error codes.
  • If retransmission conditions are met and retransmission is successful, the response is the same as what was returned for the first successful transmission.

Customs code

Customs District

Unified Customs Solution

Customs Code

AlipayCN Registration ID

General Administration of Customs P.R. China

Transmit to ZONGSHU

ZONGSHU

31222699S7

Henan Bonded Logistics Center

Transmit to ZHENGZHOU

ZHENGZHOU

31222699S7

Ningbo Customs District P.R. China

Transmit to NINGBO

NINGBO

31222699S7

Shanghai Customs

Transmit to SHANGHAI_CBT

SHANGHAI_CBT

31222699S7

Note:

Use ZONGSHU to declare to the customs districts that are not included in the table above, for example, Hangzhou Customs District, Guangzhou Customs District, and Tianjin Customs District. 

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. 

DECLARED_AMOUNT_EXCEED_LIMITFThe accumulated declared amount exceeds the total transaction amount.

Ensure that the accumulated declared amount is not greater than the total transaction amount at the digital wallet side. 

DUPLICATED_DECLARATIONFAn order can only be declared once at the same customs.

Check if the order is declared by a previous request. 

INVALID_CLIENTFThe client is invalid.

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

INVALID_ORDER_STATUSFThe order status is invalid for this operation.

Check the payment order status. If the order status is normal, 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. 

ORDER_NOT_EXISTFThe order doesn't exist.

Ensure that the value of paymentRequestId 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. 

REPEAT_REQ_INCONSISTENTFRepeated requests are inconsistent.

Ensure the parameters in the repeated requests have the same values. 

USER_STATUS_ABNORMALFThe user status is abnormal.

Contact connect_support@service.alipay.com for help. 

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.