Pay
Home
其他文档
冯奎博客
GitHub
Home
其他文档
冯奎博客
GitHub
  • 简介
    • 简介
    • 赞助与支持
    • 支持功能
    • 快速上手
  • 微信
    • 支付
    • 退款
    • 查询
    • 关闭
    • 接收回调
    • 分账
  • 支付宝
    • 支付
    • 退款
    • 查询
    • 关闭
    • 接收回调
    • 分账
    • 会员
  • 银联
    • 支付
    • 退款
    • 查询
    • 接收回调
  • 百度
    • 支付
    • 退款
    • 查询
    • 关闭
    • 接收回调
    • 确认回调
  • 字节跳动
    • 支付
    • 退款
    • 结算及分账
    • 接收回调
    • 确认回调
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); 不验证签名,直接返回支付信息

通知参数

支付通知参数

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

{
    "id": "EV-2018022511223320873",
    "create_time": "2015-05-20T13:29:35+08:00",
    "resource_type": "encrypt-resource",
    "event_type": "TRANSACTION.SUCCESS",
    "summary": "支付成功",
    "resource": {
        "original_type": "transaction",
        "algorithm": "AEAD_AES_256_GCM",
        "ciphertext": "",
        "associated_data": "",
        "nonce": ""
    }
}

对resource对象进行解密后,得到的资源对象示例

{
    "transaction_id":"1217752501201407033233368018",
    "amount":{
        "payer_total":100,
        "total":100,
        "currency":"CNY",
        "payer_currency":"CNY"
    },
    "mchid":"1230000109",
    "trade_state":"SUCCESS",
    "bank_type":"CMC",
    "promotion_detail":[
        {
            "amount":100,
            "wechatpay_contribute":0,
            "coupon_id":"109519",
            "scope":"GLOBAL",
            "merchant_contribute":0,
            "name":"单品惠-6",
            "other_contribute":0,
            "currency":"CNY",
            "stock_id":"931386",
            "goods_detail":[
                {
                    "goods_remark":"商品备注信息",
                    "quantity":1,
                    "discount_amount":1,
                    "goods_id":"M1006",
                    "unit_price":100
                },
                {
                    "goods_remark":"商品备注信息",
                    "quantity":1,
                    "discount_amount":1,
                    "goods_id":"M1006",
                    "unit_price":100
                }
            ]
        },
        {
            "amount":100,
            "wechatpay_contribute":0,
            "coupon_id":"109519",
            "scope":"GLOBAL",
            "merchant_contribute":0,
            "name":"单品惠-6",
            "other_contribute":0,
            "currency":"CNY",
            "stock_id":"931386",
            "goods_detail":[
                {
                    "goods_remark":"商品备注信息",
                    "quantity":1,
                    "discount_amount":1,
                    "goods_id":"M1006",
                    "unit_price":100
                },
                {
                    "goods_remark":"商品备注信息",
                    "quantity":1,
                    "discount_amount":1,
                    "goods_id":"M1006",
                    "unit_price":100
                }
            ]
        }
    ],
    "success_time":"2018-06-08T10:34:56+08:00",
    "payer":{
        "openid":"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"
    },
    "out_trade_no":"1217752501201407033233368018",
    "appid":"wxd678efh567hg6787",
    "trade_state_desc":"支付成功",
    "trade_type":"APP",
    "attach":"自定义数据",
    "scene_info":{
        "device_id":"013467007045764"
    }
}

转账通知参数

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

{
    "id": "EV-2018022511223320873",
    "create_time": "2015-05-20T13:29:35+08:00",
    "resource_type": "encrypt-resource",
    "event_type": "MCHTRANSFER.BILL.FINISHED",
    "summary": "商家转账单据终态通知",
    "resource": {
        "original_type": "mch_payment",
        "algorithm": "AEAD_AES_256_GCM",
        "ciphertext":"zTBf6DDPzZSoIBkoLFkC+ho97QrqnT6UU/ADM0tJP07ITaFPek4vofQjmclLUof78NqrPcJs5OIBl+gnKKJ4xCxcDmDnZZHvev5o1pk4gwtJIFIDxbq3piDr4Wq6cZpvGPPQTYC8YoVRTdVeeN+EcuklRrmaFzv8wCTSdI9wFJ9bsxtLedhq4gpkKqN5fbSguQg9JFsX3OJeT7KPfRd6SD1gu4Lpw5gwxthfOHcYsjM/eY5gaew8zzpN6mMUEJ1HqkNuQgOguHBxFnqFPiMz+Iadw7X38Yz+IgfUkOhN1iuvMhGYKbwKJ7rTiBVvGGpF6Wse1zFKgSiTLH2RnUAMkkHmxqk+JhbQKZpSWr6O8BfhHO1OKg7hpcHZtOJKNMjIF62WYDVf36w1h8h5fg==",
        "associated_data": "mch_payment",
        "nonce": "fdasflkja484w"
    }
}

确认回调

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

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

return $pay->success(); // 确认回调
Last Updated:
Contributors: kuifeng
Prev
关闭
Next
分账