方法名参数返回值
refundarray $orderCollection

退款操作

$pay = new \fengkui\Pay\Wechat($wechatConfig);

$order = [
    'refund_sn'     => time(), // 商户退款单号
    'refund_amount' => 1, // 退款金额
    'order_sn'      => 'codexxxxxxxx', # 商户订单号(order_sn或transaction_id两者必传其一)
    'transaction_id'=> 'openidxxxxxxxx', // 微信支付订单号
];

$result = $pay->refund($order);
// 返回 Collection 实例包含退款相关信息
// $order['reason'] // 退款原因选填

退款请求参数

所有订单配置参数和官方无异,参数请参考这里open in new window,查看「请求参数」一栏。

退款返回参数

相关返回参数说明,请参考这里open in new window,查看「返回参数」一栏。

返回示例

{
    "refund_id": "50000000382019052709732678859",
    "out_refund_no": "1217752501201407033233368018",
    "transaction_id": "1217752501201407033233368018",
    "out_trade_no": "1217752501201407033233368018",
    "channel": "ORIGINAL",
    "user_received_account": "招商银行信用卡0403",
    "success_time": "2020-12-01T16:18:12+08:00",
    "create_time": "2020-12-01T16:18:12+08:00",
    "status": "SUCCESS",
    "funds_account": "UNSETTLED",
    "amount": {
        "total": 100,
        "refund": 100,
        "from": [
            {
                "account": "AVAILABLE",
                "amount": 444
            }
        ],
        "payer_total": 90,
        "payer_refund": 90,
        "settlement_refund": 100,
        "settlement_total": 100,
        "discount_refund": 10,
        "currency": "CNY"
    },
    "promotion_detail": [
        {
            "promotion_id": "109519",
            "scope": "SINGLE",
            "type": "DISCOUNT",
            "amount": 5,
            "refund_amount": 100,
            "goods_detail": [
                {
                    "merchant_goods_id": "1217752501201407033233368018",
                    "wechatpay_goods_id": "1001",
                    "goods_name": "iPhone6s 16G",
                    "unit_price": 528800,
                    "refund_amount": 528800,
                    "refund_quantity": 1
                }
            ]
        }
    ]
}
Last Updated:
Contributors: kuifeng