method参数返回值
notify无/array/ServerRequestInterfaceCollection

支付回调

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

// 支付回调
try {
    $data = $pay->notify(); // 验签并获取支付回调相关参数
    if ($data) { // 支付成功
        return $pay->success(); // 异步通知
    }
} catch (\Exception $e) {
    $e->getMessage(); // 错误信息
}
// 当回调数据为空时,请打印错误信息
// $pay->notify(false); 不验证签名,直接返回支付信息

通知参数

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

{
    "mchid": "",
    "appid": "",
    "out_trade_no": "order_snxxxxxxxx",
    "transaction_id": "transaction_idxxxxxxxx",
    "trade_type": "JSAPI",
    "trade_state": "SUCCESS",
    "trade_state_desc": "支付成功",
    "bank_type": "OTHERS",
    "attach": "",
    "success_time": "2022-04-30T18:47:25+08:00",
    "payer": {
        "openid": "openidxxxxxxxx"
    },
    "amount": {
        "total": 2,
        "payer_total": 2,
        "currency": "CNY",
        "payer_currency": "CNY"
    }
}

确认回调

通知微信端,支付完成,收到通知参数

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

return $pay->success(); // 确认回调
Last Updated:
Contributors: kuifeng