Ai
1 Star 0 Fork 0

comm-package/calculation-core

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
wxpaydemo.php 1.79 KB
一键复制 编辑 原始数据 按行查看 历史
LiangMG 提交于 2022-12-13 14:17 +08:00 . 微信扫码支付
<?php
/**
* Created by PhpStorm.
* User: lmg
* Date: 2022/12/9 13:39
*/
require_once __DIR__ . '/vendor/autoload.php';
use Calculation\Payment\wxpay\Pay;
$config = [
// 公众账号ID
'appId' => 'wxf2892bd30a5fff83',
// 微信公众号appSecret
'appSecret' => '799d075e6b7c22e02066f3bf5b1bdaf3',
// 商户号
'mchId' => '1565611061',
// 支付密钥
'key' => 'uedjuuhGgyGGyygbh67t7buUFRttcvgg',
// 签名类型
'signType' => 'RSA2',
// 公众号ID
'publicAppId' => 'wx335071f7faf735e2',
// 小程序ID
'appletsAppId' => 'wxf2892bd30a5fff83',
// 异步通知地址
'notifyUrl' => 'api/v1/pays/wx_notify',
// 证书路径
'sslCertPath' => './src/Payment/wxpay/apiclient_cert.pem',
'sslKeyPath' => './src/Payment/wxpay/apiclient_key.pem',
];
// h5订单支付数据
$order = [
'body' => '测试购买商品',
'goods_name' => '人教版小学数学二年级',
'order_id' => rand(100000000000, 9999999999999),
'goods_total_price' => 0.01,
'return_url' => 'https://test.government.api.vars3cf.com',
];
// 小程序订单支付数据
$order1 = [
'body' => '测试购买商品',
'goods_name' => '人教版小学数学二年级',
'order_id' => rand(100000000000, 9999999999999),
'goods_total_price' => 0.01,
'return_url' => 'https://test.government.api.vars3cf.com',
'openid' => 'oisBUxImVfo30ICJgE5KbNqleM1U',
];
$wxPay = new Pay();
$wxPay->setOptions($config);
// wap支付
// $res = $wxPay->unifiedOrderForWap($order);
// 小程序支付
// $res = $wxPay->unifiedOrderForApplets($order1);
// 公众号支付
// $res = $wxPay->unifiedOrderForPublic($order1);
// 扫码支付
// $res = $wxPay->unifiedOrderForPublicNATIVE($order);
// 查询订单
// $res = $wxPay->query(167039003901800);
var_dump($res);die;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/comm-package/calculation-core.git
git@gitee.com:comm-package/calculation-core.git
comm-package
calculation-core
calculation-core
master

搜索帮助