inquireOriginalCredit
POST /aps/api/v1/funds/inquireOriginalCredit
The inquireOriginalCredit API is used by the Acquiring Service Provider (ACQP) to send a request to Alipay+ to inquire about the result of an Original Credit Transaction (OCT). Currently, an OCT can be processed by Alipay+ only in relation to Tax Refund.
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 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".
- 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
Field | Data type | Required | Description |
originalCreditRequestId | String | No | The unique ID that is assigned by the ACQP to identify an OCT. Specify this parameter if the originalCreditId parameter is not specified. More information about this field:
|
originalCreditId | String | No | The unique ID that is assigned by the Alipay+ to identify an OCT. Specify this parameter if the originalCreditRequestId parameter is not specified. More information about this field:
|
Response parameters
Field | Data type | Required | Description |
result | Yes | The result of the inquiry, including the result status, result code, and result message. For more information about how to handle the result of the inquireOriginalCredit API, see How to handle the result. | |
acquirerId | String | No | The unique ID that is assigned by Alipay+ to identify an ACQP. This parameter is returned by Alipay+ if the value of the result.resultStatus parameter is More information about this field:
|
pspId | String | No | The unique ID that is assigned by Alipay+ to identify an MPP. This parameter is returned by Alipay+ if the value of the result.resultStatus parameter is More information about this field:
|
originalCreditResult | No | The result of the OCT. See the OCT result codes table below for details. This parameter is returned by Alipay+ if the value of the result.resultStatus parameter is | |
scenarioType | String | No | The business scenario in which the OCT is initiated. This parameter is returned by Alipay+ if the value of the originalCreditResult.resultStatus parameter is Valid values are:
|
subScenarioType | String | No | The secondary scenario of the business scenario that is specified on the scenarioType parameter. This parameter is returned by Alipay+ if the value of the originalCreditResult.resultStatus parameter is Valid values are:
|
originalCreditRequestId | String | No | The unique ID that is assigned by the ACQP to identify an OCT. This parameter is returned by Alipay+ if the value of the originalCreditResult.resultStatus parameter is More information about this field:
|
originalCreditId | String | No | The unique ID that is assigned by the Alipay+ to identify an OCT. This parameter is returned by Alipay+ if the value of the originalCreditResult.resultStatus parameter is More information about this field:
|
originalCreditTime | Datetime | No | The date and time when the OCT reaches a final state. This parameter is specified by Alipay+ if the value of the originalCreditResult.resultStatus parameter is More information about this field:
|
payerAmount | No | The amount of funds that the ACQP requests to transfer to Alipay+. The currency of the amount must be specified as the one that the ACQP uses to create the OCT and is used by Alipay+ as the settlement currency in reconciliation. This parameter is returned by Alipay+ if the value of the originalCreditResult.resultStatus parameter is | |
payeeAmount | No | The amount of funds that Alipay+ transfers to the MPP. This parameter is returned by Alipay+ if the value of the originalCreditResult.resultStatus parameter is | |
payeeQuote | No | The exchange rate between the currency used by the payer (specified on the payerAmount.currency parameter) and the currency used by the payee (specified on the payeeAmount.currency parameter). This parameter is specified by Alipay+ if the currency used by the payer is different from the currency used by the payee and the value of the originalCreditResult.resultStatus parameter is | |
payer | No | The information about the merchant that pays the tax refund amount, including the merchant ID, merchant legal name, merchant display name, and merchant address. This parameter is returned by Alipay+ if the value of the originalCreditResult.resultStatus parameter is More information about child parameters: The payer.merchantDisplayName parameter is returned by Alipay+ if the display name of the merchant is different from the legal name of the merchant. | |
payee | No | The information about the MPP user that receives the tax refund, including the user ID, user login ID, and user name. This parameter is returned by Alipay+ if the value of the originalCreditResult.resultStatus parameter is More information about child parameters: The payee.userLoginId and payee.userName parameters are returned by Alipay+ if the information is returned by the MPP. |
How to handle the result
Alipay+ returns the following two kinds of results:
- result: specifies whether the inquireOriginalCredit API request is received successfully.
- originalCreditResult: specifies the OCT result.
You might receive different results from Alipay+. Follow the instructions below to handle the result.
result.resultStatus | originalCreditResult.resultStatus | OCT status | Actions |
S | S | The OCT succeeds. | Update the status from your server side. |
S | F | The OCT fails. | Take actions according to the result code (specified on the originalCreditResult.resultCode parameter). For more information, see the OCT result codes section below. |
S | U | The OCT is in processing. | Keep inquiring within the transaction expiry time.
If you still receive the same result of |
F | F | The OCT fails or the OCT does not exist. |
|
U | U | Unknown exception | Keep inquiring within the transaction expiry time.
If you still receive the same result of |
No result received | Unknown | Keep inquiring within the transaction expiry time.
If still no result is returned after the OCT is expired or the maximum number of inquiries is exceeded, contact the technical support team at connect_support@service.alipay.com. |
Result codes
Result code | Result status | Result 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. |
INVALID_CLIENT | F | The client is invalid. | It is recommended that you 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 that 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. | For cases where the OCT does not exist, the reason might be:
If you still receive the same result code of |
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. |
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. |
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. |
OCT result codes
Result code | Result status | Result message | Further action |
SUCCESS | S | Success | Update the status from the ACQP side. |
BUSINESS_NOT_SUPPORT | F | The original credit transaction business is not supported. | Check whether the parameter values in the request message when you call the createOriginalCredit API, such as payer.referenceMerchantId and payerAmount.currency, conform to the contract. If yes, it is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue; otherwise, correct the parameters to align with the contract. |
CURRENCY_NOT_SUPPORT | F | The currency is not supported. | Ensure that the currencies used in the request message when you call the createOriginalCredit API, such as payerAmount.currency and settlement currency, conform to the contract. If the issue persists, it is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. |
EXPIRED_CODE | F | The code is expired. | Instruct the user to refresh the tax refund code. |
INVALID_CODE | F | The code is invalid. | Ensure that the tax refund code is valid. If invalid, instruct the user to refresh the tax refund code. |
INVALID_CONTRACT | F | The contract is invalid. | Check whether the parameter values in the request message when you call the createOriginalCredit API, such as payer.referenceMerchantId and payerAmount.currency, conform to the contract. If yes, it is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue; otherwise, correct the parameters to align with the contract. |
RISK_REJECT | F | The request is rejected because of the risk control. | It is recommended that you inform the user of the error. |
USER_AMOUNT_EXCEED_LIMIT | F | The refundable amount exceeds the limit that is specified by the user's digital wallet. | It is recommended that you inform the user of the error. |
USER_KYC_NOT_QUALIFIED | F | User is not qualified for the KYC verification. | It is recommended that you inform the user of the error. |
USER_NOT_EXIST | F | The user does not exist. | It is recommended that you inform the user of the error. |
USER_STATUS_ABNORMAL | F | The user status is abnormal. | It is recommended that you inform the user of the error. |
ORIGINAL_CREDIT_IN_PROCESS | U | The original credit transaction is being processed. | Call the inquireOriginalCredit API to inquire about the OCT result. |
UNKNOWN_EXCEPTION | U | An API call failed, which is caused by unknown reasons. | Try to recall the API. |
Samples
Request
{
"originalCreditRequestId": "gb_tax_1089760038715669_102775745070000"
}
Response
{
"acquirerId": "A10221XX000000000000",
"pspId": "1022160000000000000",
"result": {
"resultCode": "SUCCESS",
"resultStatus": "S",
"resultMessage": "Success"
},
"originalCreditResult": {
"resultCode": "SUCCESS",
"resultStatus": "S",
"resultMessage": "Success"
},
"scenarioType":"TAX_REFUND",
"subScenarioType":"PORT_INSTANT_TAX_REFUND",
"originalCreditRequestId": "gb_tax_1089760038715669_102775745070000",
"originalCreditId": "20190608114010800100188820200350000",
"payerAmount": {
"currency": "USD",
"value": "100"
},
"payeeAmount": {
"value": "1000",
"currency": "HKD"
},
"payeeQuote": {
"quoteId": "1234567",
"quoteCurrencyPair": "USD/HKD",
"quotePrice": "10.0000"
},
"payer": {
"referenceMerchantId": "2188245U41144145",
"merchantAddress": {
"region":"DE"
},
"merchantName": "Global Blue",
"merchantMCC": "5411"
},
"payee": {
"userId": "2102582925174840000",
"userLoginId": "+442056660000*"
},
"originalCreditTime": "2023-01-01T14:48:50+08:00"
}