订单退款接口

此接口用于对已支付的订单发起退款操作。需要先在商户后台开启订单退款API接口开关,才能调用该接口发起订单退款。

请求信息

请求URL /api/pay/refund
请求方式 POST

请求参数

参数名 类型 必填 示例值 说明
pid Int 1001 商户ID
trade_no String 特殊 20160806151343349 平台订单号,与商户订单号必传其一
out_trade_no String 特殊 20160806151343351 商户订单号,与平台订单号必传其一
money String 1.00 退款金额,单位:元
out_refund_no String 20160806151343391 商户退款单号,可避免出现重复请求退款
timestamp String 1721206072 当前时间戳,10位整数,单位秒
sign String 签名字符串,详见签名规则
sign_type String RSA 签名类型,默认为RSA

返回参数

参数名 类型 示例值 说明
code Int 0 返回状态码,0为成功,其它值为失败
msg String 返回信息,失败或成功时返回提示
refund_no String 20160806151343349 平台退款单号
out_refund_no String 20160806151343351 商户退款单号
trade_no String 20160806151343349 平台订单号
money String 1.00 退款金额
reducemoney String 1.00 扣减商户余额
timestamp String 1721206072 当前时间戳,10位整数,单位秒
sign String 签名字符串,详见签名规则
sign_type String RSA 签名类型,默认为RSA

返回示例

成功示例:

{
    "code": 0,
    "msg": "退款成功",
    "refund_no": "20160806151343349",
    "out_refund_no": "20160806151343391",
    "trade_no": "20160806151343349",
    "money": "1.00",
    "reducemoney": "1.00",
    "timestamp": "1721206072",
    "sign": "xxxxx",
    "sign_type": "RSA"
}

失败示例:

{
    "code": -1,
    "msg": "订单不存在"
}

其他说明

注意事项