declareACQP → Alipay+
The declare API is used by the Acquiring Service Provider (ACQP) to declare a payment to customs or update an existing declaration.
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".
For optional parameters that are not required in your case, you can:
- exclude it from the request body.
- set its value as
null
(without the double quotation marks).
Do NOT leave it empty by setting its value as ""
; otherwise, an error might occur.
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:
- 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:
- This field is an API idempotency field.
- Maximum length: 64 characters
customs CustomsInfo REQUIRED
The customs information, including customs code and region.
merchantCustomsInfo MerchantCustomsInfo REQUIRED
The merchant information that is registered in the customs system.
declarationAmount Amount REQUIRED
The customs declaration amount. When specifying the child parameters of this parameter, note that:
- 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.
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:
- 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:
- Maximum length: 64 characters
buyerCertificate Certificate
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.
Response parameters
result Result REQUIRED
The result of the business processing, including the result status, result code, and the result message.
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.
pspPaymentId String
The payment ID that is provided for the customs by the AlipayCN wallet.
More information:
- 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.
This parameter is returned by Alipay+ if result.resultStatus is S
.
More information:
- Maximum length: 64 characters
pspCustomsCode String
The AlipayCN wallet's registration ID in the customs system.
This parameter is returned by Alipay+ if result.resultStatus is S
.
More information:
- 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.
This parameter is 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.
This parameter is returned by Alipay+ if result.resultStatus is S
.
More information:
- Maximum length: 64 characters
pspOrderAmount Amount
The transaction amount that was paid with the AlipayCN wallet.
This parameter is returned by Alipay+ if result.resultStatus is S
.
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.
This parameter is returned by Alipay+ if
- resultStatus is
S
, and - buyerCertificate is specified by the ACQP/merchant.
Request
Response
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 | Declaration status | Actions |
|
| The declaration is successfully accepted by Alipay+. | Call the inquireDeclarationRequests API to inquire about the declaration result. |
| Multiple possible values exist, such as
| The declaration fails to be accepted by Alipay+. | Take actions according to the result code (specified on the result.resultCode parameter). For more information, see the Result codes section below. |
| Multiple possible values exist, such as
| Unknown | Use the same parameters to retry the declare request. If you keep receiving the same result indicating the unknown status, contact connect_support@service.alipay.com. |
No result received | Unknown | Use the same parameters to retry the declare request. If you keep receiving no result, contact connect_support@service.alipay.com. |
How to retransmit a declaration
For payments made with AlipayCN, you can retransmit an existing declaration by calling the declare API when:
- 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.
Preconditions
When calling the declare API to retransmit an existing declaration, 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. However,Alipay+ might adjust this time value according to the actual situation.
- All values of the parameters must be the same as those in the existing declaration, except for the following parameters:
- merchantCustomsCode
- merchantCustomsName
- customsCode
- declarationAmount.value
- If the value of declarationAmount.value is updated, note that:
- the new value of declarationAmount.value rewrites the previous value of declarationAmount.value for the same referenceOrderId.
- the newly accumulated declaration amount for the same paymentRequestId, which includes the new value of declarationAmount.value, cannot exceed the payment amount, namely the value of customsDeclarationAmount.value in the inquiryPayment and notifyPayment APIs.
Responses
You might receive different responses from Alipay+. The following list describes the details.
- If the preconditions are not fully met and none of the parameter values is changed, Alipay+ returns
DUPLICATED_DECLARATION
. - If the preconditions are not fully met but one or more parameter values are changed, Alipay+ returns
REPEAT_REQ_INCONSISTENT
. - If the preconditions are met and the request is sent successfully, handle the result by following the instructions in the How to handle the result section.
Customs code
This section gives additional information about the 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
Code | Value | Message | Further action |
---|---|---|---|
SUCCESS | S | Success | N/A |
ACCESS_DENIED | F | Access is denied. | It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. |
DECLARED_AMOUNT_EXCEED_LIMIT | F | The 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_DECLARATION | F | An order can only be declared once at the same customs. | Check if the order is declared by a previous request. |
INVALID_CLIENT | F | The client is invalid. | It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. |
INVALID_ORDER_STATUS | F | The 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_SIGNATURE | F | The signature is invalid. | Check whether the public key, signed message, and signature algorithm are as expected. |
KEY_NOT_FOUND | F | The key is not found. | It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. |
MEDIA_TYPE_NOT_ACCEPTABLE | F | The server does not implement the media type that is acceptable to the client. | Use a media type that is accepted by Alipay+. |
METHOD_NOT_SUPPORTED | F | The server does not implement the requested HTTPS method. | Ensure the HTTP method is POST. |
NO_INTERFACE_DEF | F | API is not defined. | Check whether the request URL is correct. Ensure that the endpoint of the called API is correct. |
ORDER_NOT_EXIST | F | The order doesn't exist. | Ensure that the value of paymentRequestId is correct. |
PARAM_ILLEGAL | F | Illegal 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_FAIL | F | A general business failure occurred. Do not retry. | It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. |
REPEAT_REQ_INCONSISTENT | F | Repeated requests are inconsistent. | Ensure the parameters in the repeated requests have the same values. |
USER_STATUS_ABNORMAL | F | The user status is abnormal. | Contact connect_support@service.alipay.com for help. |
REQUEST_TRAFFIC_EXCEED_LIMIT | U | The request traffic exceeds the limit. | Reduce the frequency of API calls. |
UNKNOWN_EXCEPTION | U | An API call failed, which is caused by unknown reasons. | Try to recall the API. |