Alipay+ DocsAlipay+ Docs

evaluateOriginalCredit

POST /aps/api/v1/funds/evaluateOriginalCredit

The evalutateOriginalCredit API is used by the Acquiring Service Provider (ACQP) to send a request to Alipay+ to evaluate whether the user's MPP account supports 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:

  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".
  1. 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

payerAmount

Amount

Yes

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.

Important: You may specify the value of the payerAmount.value parameter to 0; otherwise, you need to specify the same value for this parameter in the evaluateOriginalCredit and createOriginalCredit API requests for the same OCT.

payer

Merchant

Yes

The information about the merchant that pays the tax refund amount, including the merchant ID, merchant legal name, merchant display name, and merchant address.

More information about child parameters:

Specify the payer.merchantDisplayName parameter if the merchant display name is different from the legal name. If you do not specify this parameter, the value of the payer.merchantName parameter is used.

payeeMethod

PaymentMethod

Yes

The payment method that is used by the payee to receive the tax refund.

In the Tax Refund scenario, the payee is an MPP user and you must set the value of the payeeMethod.paymentMethodId parameter to the tax refund code that is presented by the MPP user.

evaluationType

String

Yes

The type of evaluation. The parameter specifies how the evaluation is performed.

Valid values are:

  • BY_CODE: indicates that the evaluation is performed based on the tax refund code.

scenarioType

String

Yes

The business scenario in which the OCT is initiated.

Valid values are:

  • TAX_REFUND: indicates the tax refund scenario.

subScenarioType

String

Yes

The secondary scenario of the business scenario that is specified on the scenarioType parameter.

Valid values are:

  • PORT_INSTANT_TAX_REFUND: indicates the secondary scenario in which users submit tax refund requests at airports, ports, or borders to receive refunds in real time.

Response parameters

Field

Data type

Required

Description

result

Result

Yes

The result of the evaluation, including the result status, result code, and the result message.

For more information about how to handle the result of the evalutateOriginalCredit 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 S, which indicates that the evaluation is successful.

More information about this field:

  • Maximum length: 64 characters

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 S, which indicates that the evaluation is successful.

More information about this field:

  • Maximum length: 64 characters

payeeAmount

Amount

No

The amount of funds that Alipay+ transfers to the MPP.

This parameter is returned by Alipay+ if the value of the result.resultStatus parameter is S, which indicates that the evaluation is successful.

payeeQuote

Quote

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 result.resultStatus parameter is S, which indicates that the evaluation is successful.

payee

User

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 result.resultStatus parameter is S, which indicates that the evaluation is successful.

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

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

result.resultStatus

result.resultCode

Evaluation status

Actions

S

SUCCESS

The evaluation is successful.

Call the createOriginalCredit API to send a request to Alipay+ to create an OCT.

F

Multiple possible values exist, such as

USER_STATUS_ABNORMAL,

USER_AMOUNT_EXCEED_LIMIT, etc.

The evaluation failed.

Take actions according to the error message specified on the result.resultMessage parameter.

U

Multiple possible values exist, such as

UNKNOWN_EXCEPTION and

REQUEST_TRAFFIC_EXCEED_LIMIT.

The evaluation is in unknown status.

Use the same parameters to retry the evaluateOriginalCredit API request. It is recommended that you keep trying several times. If you keep receiving the same result indicating the unknown status, contact connect_support@service.alipay.com.

No result received after trying several times

The evaluation is in unknown status.

Contact connect_support@service.alipay.com.

Result codes

Result code

Result status

Result message

Further action

SUCCESS

S

Success

Call the createOriginalCredit API to send a request to Alipay+ to create an OCT.

ACCESS_DENIED

F

Access is denied.

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

BUSINESS_NOT_SUPPORT

F

The original credit transaction business is not supported.

Check whether the parameter values in the request message, 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 the currencies used in the request, 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_CLIENT

F

The client is invalid.

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

INVALID_CODE

F

The code is invalid.

Ensure 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, such as 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.

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.

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.

RISK_REJECT

F

The request is rejected because of the risk control.

It is recommended that you inform the user of the error.

SERVER_UNDER_MAINTENANCE

F

The request failed because our partner's server is under maintenance.

Contact your solution architect to confirm the maintenance schedule.

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

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

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.

Samples

Request

copy
{
  "scenarioType":"TAX_REFUND",
  "subScenarioType":"PORT_INSTANT_TAX_REFUND",
  "payerAmount": {
    "currency": "USD",
    "value": "100"
  },
  "payer": {
    "referenceMerchantId": "2188245U41144145",
    "merchantAddress": {
      "region":"DE"
    },
    "merchantName": "Global Blue",
    "merchantMCC": "5411"
  },
  "evaluationType": "BY_CODE",
  "payeeMethod": {
    "paymentMethodType": "CONNECT_WALLET",
    "paymentMethodId": "28100602000000000000"
  }
}

Response

copy
{
  "result": {
    "resultCode": "SUCCESS",
    "resultStatus": "S",
    "resultMessage": "Success"
  },
  "acquirerId": "A10221XX000000000000",
  "pspId": "1022160000000000000",
  "payeeAmount": {
    "value": "1000",
    "currency": "HKD"
  },
  "payeeQuote": {
    "quoteId": "1234567",
    "quoteCurrencyPair": "USD/HKD",
    "quotePrice": "10.0000"
  },
  "payee": {
    "userId": "2102582925174840000",
    "userLoginId": "+442056660000*"
  }
}