Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

alipay.intl.acquiring.common.refund_2.0.2

The merchant and partner can use this interface to refund an existing payment. A refund can be partial and a transaction can have multiple refunds as long as the total refund amount is no greater than the original transaction amount. There is a refund window for each transaction. A refund request will be declined if it happens outside of the refund window.
To retry a refund in case of timeout or the returned resultStatus is U, use the same merchantRefundId.

Request

Service address

Request head

ParameterNameTypeLengthRequiredDescriptionSample
versionAPI versionString8YThe API version2.0.2
functionAPI nameString128YThe API namealipay.intl.acquiring.common.refund
clientIdClient IDString32YThe unique ID assigned by Alipay to identify a client that makes API calls211xxxxxxxxxxxxxxx044
reqTimeRequest timeDate time/YDate time with timezone, see RFC 3339 Section 5.6 for details.2001-07-04T12:08:56+05:30
reqMsgIdRequest message IDString64YThe unique ID assigned by client to identify a request message1234567asdfasdf1123fda
reserveReserved parameterString256NKey/Value formatted parameter for future use{key/value}
signTypeSign typeString64NThe signature typeRSA2

Request body

ParameterNameTypeLengthRequiredDescriptionSample
partnerIdPartner IDString32YThe unique partner ID assigned by Alipay. This parameter identifies the settlement target that Alipay settles to.211xxxxxxxxxxxxxxxx512
acquirementIdAlipay transaction IDString64YThe unique Alipay transaction ID.2015xxxxxxxxxxxxxxxxxxxxx678
merchantRefundIdMerchant refund IDString64YThe unique refund ID assigned by the merchant.Merchant_Refund_Id_93xxx
refundAmountRefund amountMoney/YThe refund amount in the pricing currency. The value can not be greater than the original order amount. refundAmount must be provided in the smallest common currency unit. For example, to create a refund for $1.00, you would set refundAmount value=100 (100 cents).
Note: This parameter is required when resultInfo or reultCode is SUCCESS.

See Money for details.

{"value":"10000", "currency":"USD" }
refundReasonRefund reasonString256NThe refund reason that is shown in the buyer's transaction details.

See Money for details.

Refund per customer request.
isSyncisSyncBoolean5NThis parameter specifies if the refund is synchronous. The value can be:
false (by default): asynchronous
true: synchronous
true

Response

Response head

ParameterNameTypeLengthRequiredDescriptionSample
versionAPI versionString8YThe API version2.0.2
functionAPI nameString128YThe API namealipay.intl.acquiring.common.refund
clientIdClient IDString32YThe unique ID assigned by Alipay to identify a client that makes API calls211xxxxxxxxxxxxxxx044
respTimeResponse timeDate time/YDate time with timezone, see RFC 3339 Section 5.6 for details.2001-07-04T12:08:56+05:30
reqMsgIdRequest message IDString64YThe unique ID assigned by client to identify a request message1234567asdfasdf1123fda
reserveReserved parameterString256NKey/Value formatted parameter for future use{key/value}

Response body

ParameterNameTypeLengthRequiredDescriptionSample
resultInfoResult infoResultInfo/YSee resultInfo for details.{
    "resultStatus": "S",
    "resultCodeId": "00000000",
    "resultCode":"SUCCESS",
    "resultMsg": "result message"
}
merchantRefundIdMerchant refund IDString64CThe unique refund ID assigned by the merchant.
Note: This parameter is required when reultCode is SUCCESS.
Merchant_Refund_Id_93xxx
acquirementIdAlipay transaction IDString64CThe unique Alipay transaction ID.
Note: This parameter is required when reultCode is SUCCESS.
2015xxxxxxxxxxxxxxxxxxxxx678
refundIdRefund IDString64NThe unique refund ID assigned by Alipay.2015xxxxxxxxxxxxxxxxxxxxx012
refundAmountRefund amountMoney/CThe refund amount in the pricing currency. The value can not be greater than the original order amount. refundAmount must be provided in the smallest common currency unit. For example, to create a refund for $1.00, you would set refundAmount value=100 (100 cents).
Note: This parameter is required when reultCode is SUCCESS.

See Money for details.

{"value":"10000", "currency":"USD" }
refundActualAmountThe actual refund amount that the buyer receives.Money/CThis parameter can be in a different currency with refundAmount.
Note: This parameter is required when reultCode is SUCCESS, or refundActualCurrencyDifferentWithRefundCurrency is true.

See Money for details.

{"currency":"CNY", "value":"1481"}
conversionRateConversion rateExchangeRate/CThe exchage rate between orderAmount and payAmount.
Note: This parameter is required when reultCode is SUCCESS, or refundActualCurrencyDifferentWithRefundCurrency is true.

See conversionRate for details.

{
"baseCurrency":"USD",
"exchangeCurrency":"CNY",
"rate":"6.9123"
}
refundTimeRefund timeDate time/CDate time with timezone, see RFC 3339 Section 5.6 for details.
Note: This parameter is required when reultCode is SUCCESS.
2001-07-04T12:08:56+05:30

Sub-parameters

resultInfo

ParameterNameTypeLengthRequiredDescriptionSample
resultStatusResult statusString2YThe request status can be:
  • S: success
  • F: failure
  • U: unknown
  • S
    resultCodeIdResult IDString8YAn 8-digit code that is used to identify a result. When resultStatus is S, the value must be 00000000. When resultStatus  is F or U, the value can be other result ID specified by the interface.00000000
    resultCodeResult codeString64YThe result codeSUCCESS
    resultMsgResult messageString256NWhen resultCode is S, this value can be empty. When resultCode is F or U, the error description is required.success

    conversionRate

    ParameterNameTypeLengthRequiredDescriptionSample
    baseCurrencyBase currencyString3YThe base currencyUSD
    exchangeCurrencyExchange currencyString3YThe exchange currencyCNY
    rateRateString16YThe exchange rate of baseCurrency against exchangeCurrency6.9123

    Money

    ParameterNameTypeLengthRequiredDescriptionSample
    currencyCurrencyString3YThe 3-letter currency code. See supported currencies for details.USD
    valuevalueNumber16YThe amount. This value must be provided in the smallest common currency unit. For example, to create a charge for $1.00, you would set orderAmount value=100 (100 cents).239

    Result code

    Functional logic result code

    ResultIDResultCodeResultStatusRemarks
    00000025REPEAT_REQ_INCONSISTENTFRepeated or inconsistent requests
    12002005USER_NOT_EXISTFThe user does not exist.
    12002006USER_STATUS_ABNORMALFAbnormal user status
    12005001CURRENCY_NOT_SUPPORTFThe transaction currency is not supported. See supported currencies for details.
    12005004ORDER_NOT_EXISTFThe transaction does not exist.
    23005302REFUND_AMOUNT_EXCEEDFThe refund amount exceeds the limit.
    12005014REFUND_TIME_EXCEED_LIMITFThe refund time exceeds the limit.
    12005003ORDER_STATUS_INVALIDFThe transaction status is invalid.
    12005134SIGN_TYPE_INVALIDFThe signature type is invalid.
    12005135SIGN_TYPE_NOT_SUPPORTFThe signature type is not supported.

    Basic result code

    ResultIDResultCodeResultStatusRemarks
    00000000SUCCESSSSuccess
    00000019PROCESS_FAILFGeneral business failure
    00000901UNKNOWN_EXCEPTIONUAPI failed because of unknown reasons
    00000004PARAM_ILLEGALFThe parameter is incorrect.
    00000007INVALID_SIGNATUREFThe signature is invalid.
    00000008KEY_NO_FOUNDFThe key is not found.
    00000013NO_INTERFACE_DEFFThe API is undefined.
    00000014API_IS_INVALIDFThe API is invalid or nonactivated.
    00000016OAUTH_FAILEDFThe oAuth authentication failed.
    00000021ACCESS_DENIEDFAccess denied
    12014152CLIENT_FORBIDDEN_ACCESS_APIFThe Client is not authorized to use this API.
    12014155UNKNOWN_CLIENTFUnknown client
    12014156INVALID_CLIENT_STATUSFInvalid client status
    00000024REQUEST_TRAFFIC_EXCEED_LIMITFThe request traffic exceeds the limit.

    Sample

    Sample request

    copy
    { 
        "request":{ 
            "head":{ 
                "version":"2.0.2", 
                "function":"alipay.intl.acquiring.common.refund", 
                "clientId":"211xxxxxxxxxxxxxxx044", 
                "reqTime":"2001-07-04T12:08:56+05:30", 
                "reqMsgId":"1234567asdfasdf1123fda", 
                "reserve":"{}",
                "signType":"RSA2"
            }, 
            "body":{ 
                "partnerId":"218820000000000000023", 
                "acquirementId":"2015xxxxxxxxxxxxxxxxxxxxx678", 
                "merchantRefundId":"Merchant_Refund_Id_93xxx", 
                "refundAmount":{ 
                    "currency":"USD", 
                    "value":"239" 
                }, 
                "refundReason":"refund per customer request", 
                "isSync":“true”
            } 
        }, 
        "signature":"signature string" 
    }

    Sample response

    copy
    { 
        "response":{ 
            "head":{ 
                "version":"2.0.2", 
                "function":"alipay.intl.acquiring.common.refund", 
                "clientId":"211xxxxxxxxxxxxxxx044", 
                "respTime":"2001-07-04T12:08:56+05:30", 
                "reqMsgId":"1234567asdfasdf1123fda", 
                "reserve":"{}" 
            }, 
            "body":{ 
                "resultInfo":{ 
                    "resultStatus":"S", 
                    "resultCodeId":"00000000", 
                    "resultCode":"SUCCESS", 
                    "resultMsg":"success" 
                }, 
                "merchantRefundId":"Merchant_Refund_Id_93xxx", 
                "acquirementId":"2015xxxxxxxxxxxxxxxxxxxxx678", 
                "refundId":"2015xxxxxxxxxxxxxxxxxxxxx012", 
                "refundAmount":{ 
                    "currency":"USD", 
                    "value":"239" 
                }, 
                "refundTime":"2001-07-04T12:08:56+05:30" 
            } 
        }, 
        "signature":"signature string" 
    }