TLingC's Zone
TLingC's Zone

easywechat小程序支付

$this->pay = Factory::payment(Config::get('pay'));

$pay_params = [
    'out_trade_no' => $order->out_trade_no,
    'total_fee' => $order->pay_amount*100,
    'body' => $order->name,
    'trade_type' => 'JSAPI',
    'openid' => $user->openid
];

$res = $this->pay->order->unify($pay_params);

if ($res['return_code'] != 'SUCCESS') {
    throw new DisplayException("[{$res['return_code']}] {$res['return_msg']}");
} elseif ($res['result_code'] != 'SUCCESS') {
    throw new DisplayException("[{$res['err_code']}] {$res['err_code_des']}");
}

// 小程序需要使用jssdk处理参数
$res = $this->pay->jssdk->sdkConfig($res['prepay_id']);

return $res;
本文采用 CC BY-SA 4.0 协议进行许可。如需转载,请附上本文链接和本声明。
本文链接:https://tlingc.com/2021/08/easywechat-pay-in-miniprogram/
#
首页      开发      easywechat小程序支付

推荐文章

发表评论

textsms
account_circle
email

TLingC's Zone

easywechat小程序支付
$this->pay = Factory::payment(Config::get('pay')); $pay_params = [ 'out_trade_no' => $order->out_trade_no, 'total_fee' => $order->pay_amount*100, …
扫描二维码继续阅读
2021-08-02