This commit is contained in:
2022-09-09 13:40:45 +08:00
parent d219da7cc8
commit b76aa4de0e
3 changed files with 117 additions and 21 deletions

View File

@@ -66,9 +66,21 @@ class Wechat
* @Date : 2022/9/9 11:32
* @Author : <Jason.C>
*/
public function payment()
public function payment(): string
{
return View::fetch();
$config = Config::get('wechat.payment');
$payment = Factory::payment($config);
$unify = $payment->order->unify([
'body' => '商品订单',
'out_trade_no' => time(),
'total_fee' => 100,
'notify_url' => '',
'trade_type' => 'JSAPI',
'openid' => '$openid',
]);
$prepayId = $unify->prepay_id;
$jssdk = $payment->jssdk->bridgeConfig($prepayId);
return View::fetch('', ['jssdk' => $jssdk]);
}
/**