/** * 生成静态NATIVE方式的微信订单第二步 * @param array $options 参数数组 * @return array */ public function createStaticNativeOrderSecond($options) { $resArr = ['code' => 0]; $goods_name = mb_strlen($options['goods_name']) > 32 ? mb_substr($options['goods_name'], 0, 32) : $options['goods_name']; //使用统一支付接口 $unifiedOrderModel = new WxPayUnifiedOrder($this->wx_config); //设置必填参数 $unifiedOrderModel->setParameter("body", $goods_name); //商品描述 $unifiedOrderModel->setParameter("out_trade_no", $options['order_sn']); //商户订单号 $unifiedOrderModel->setParameter("attach", $options['attach']); //附加数据 $unifiedOrderModel->setParameter("total_fee", $options['amount'] . ""); //总金额 $unifiedOrderModel->setParameter("notify_url", $options['notify_url']); //通知地址 $unifiedOrderModel->setParameter("trade_type", "NATIVE"); //交易类型 $unifiedOrderModel->setParameter("product_id", $options['product_id']); //用户标识 $resArr['data'] = ['prepay_id' => $unifiedOrderModel->getPrepayId()]; return $resArr; }