Alipay+ DocsAlipay+ Docs

createOriginalCredit

POST /aps/api/v1/funds/createOriginalCredit

The createOriginalCredit API is used by the Acquiring Service Provider (ACQP) to send a request to Alipay+ to create 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

originalCreditRequestId

String

Yes

The unique ID that is assigned by the ACQP to identify an OCT.

More information about this field:

  • This field is an API idempotency field. For requests that are initiated with the same originalCreditRequestId, Alipay+ regards the requests as repeated and processes the requests only once. If the values for the key parameters such as payerAmount, scenarioType, subScenarioType, and payee.userId in repeated requests are different, Alipay+ returns the REPEAT_REQ_INCONSISTENT result code. For details about API idempotency, see the Idempotency chapter.
  • Maximum length: 64 characters

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: For the same OCT, specify the value of this parameter as the actual refund amount that you specified in the payerAmount parameter of the evaluateOriginalCredit API request.

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.

payee

User

Yes

The information about the MPP user that receives the tax refund, including the user ID, user login ID, and user name.

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 a tax refund code is used to initiate a tax refund.

payerNotificationUrl

String

No

The URL that is used to receive the OCT result notification from Alipay+.

Specify this parameter if the ACQP integrates the notifyOriginalCredit API.

More information about this field:

  • Maximum length: 2048 characters

env

Env

No

The environment information about the device that is used by the payer for the OCT.

Specify this parameter if you have the information. This helps anti-money laundering and fraud detection, and increases OCT success rates.

memo

String

No

The additional message provided by the payer about the OCT, which will be displayed on the user's electronic bill in his or her wallet app.

Specify this parameter if the user's electronic bill is required to display the corresponding message.

More information about this field:

  • Maximum length: 64 characters

Response parameters

Field

Data type

Required

Description

result

Result

Yes

The result of the OCT, including the result status, result code, and result message. For more information about how to handle the result of the createOriginalCredit 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 OCT 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 OCT is successful.

More information about this field:

  • Maximum length: 64 characters

originalCreditId

String

No

The unique ID that is assigned by Alipay+ to identify an OCT.

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

More information about this field:

  • Maximum length: 64 characters

originalCreditTime

Datetime

No

The date and time when the OCT reaches a final state.

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

More information about this field:

  • The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".

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 OCT 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 OCT 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 OCT 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

OCT status

Actions

S

SUCCESS

The OCT is successful.

Update the status from your server side.

F

Multiple possible values exist, such as

USER_STATUS_ABNORMAL,

USER_AMOUNT_EXCEED_LIMIT, etc.

The OCT fails.

Take actions according to the error message in the result.resultMessage parameter.

U

ORIGINAL_CREDIT_IN_PROCESS

The OCT is in unknown status.

Call the inquireOriginalCredit API to inquire about the OCT result. It is recommended that you send the inquireOriginalCredit API request 10 to 20 times within the expiry time, which is 60 seconds by default.

U

Multiple possible values exist, such as

UNKNOWN_EXCEPTION,

REQUEST_TRAFFIC_EXCEED_LIMIT

The OCT is in unknown status.

Retry the same 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 OCT is in unknown status.

Contact connect_support@service.alipay.com.

Result codes

Result code

Result status

Result message

Further action

SUCCESS

S

Success

Update the status from your server side.

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

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.

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.

REPEAT_REQ_INCONSISTENT

F

Repeated requests are inconsistent.

Ensure that the values of the parameters in the repeated requests are the same.

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.

ORIGINAL_CREDIT_IN_PROCESS

U

The original credit transaction is being processed.

Call the inquireOriginalCredit API to inquire about the OCT result.

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",
  "payerNotificationUrl": "https://xmock.inc.alipay.net/api/Ipay/globalSite/automtion/notify.htm",
  "originalCreditRequestId": "gb_tax_1089760038715669_102775745070000",
  "payerAmount": {
    "currency": "USD",
    "value": "100"
  },
    "payee": {
    "userId": "2102582925174840000"
  },
  "payer": {
    "referenceMerchantId": "2188245U41144145",
    "merchantAddress": {
      "region":"DE"
    },
    "merchantName": "Global Blue",
    "merchantMCC": "5411"
  },
  "env": {
    "clientIp": "1.1.1.1",
    "storeTerminalId": "122222",
    "storeTerminalRequestTime": "2019-06-01T12:01:01+08:00"
  },
  "memo":"tax refund"
}

Response

copy
{
  "acquirerId": "1022188000000000000",
  "pspId": "1022160000000000000",
  "result": {
    "resultCode": "SUCCESS",
    "resultStatus": "S",
    "resultMessage": "Success"
  },
  "originalCreditTime": "2023-01-01T14:48:50+08:00",
  "originalCreditId": "20190608114010800100188820200350000",  
  "payeeAmount": {
    "value": "1000",
    "currency": "HKD"
  },
  "payeeQuote": {
    "quoteId": "1234567",
    "quoteCurrencyPair": "USD/HKD",
    "quotePrice": "10.0000"
  },
  "payee": {
    "userId": "2102582925174840000",
    "userLoginId": "+442056660000*"
  }
}