二维码无法失效;之前有人测算过,即使全球几十亿人天天用,也得到时空俱灭的时候才能枚举完,订单失效就行了,无须再管二维码的“有效期”了
微信支付扫码支付native:怎么设置二维码的失效时间?微信支付扫码支付native:生成的二维码,怎么设置二维码的失效时间?
2021-10-28<?php interface Native { /** * 合单下单-Native支付(同步模式) * @param array<string,mixed> $options * @link https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_10.shtml */ public function post(array $options = [ 'json' => [ 'combine_appid' => 'wxd678efh567hg6787', 'combine_mchid' => '1900000109', 'combine_out_trade_no' => 'P20150806125346', 'scene_info' => [ 'device_id' => 'POS1:1', 'payer_client_ip' => '14.17.22.32', ], 'sub_orders' => [[ 'mchid' => '1900000109', 'attach' => '深圳分店', 'amount' => [ 'total_amount' => 100, 'currency' => 'CNY', ], 'out_trade_no' => '20150806125346', 'sub_mchid' => '1900000109', 'goods_tag' => 'WXG', 'description' => '腾讯充值中心-QQ会员充值', 'settle_info' => [ 'profit_sharing' => true, 'subsidy_amount' => 10, ], ],], 'time_start' => '2019-12-31T15:59:60+08:00', 'time_expire' => '2019-12-31T15:59:60+08:00', 'notify_url' => 'https://yourapp.com/notify', ], ]): ResponseInterface; /** * 合单下单-Native支付(异步模式) * @param array<string,mixed> $options * @link https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_10.shtml#async */ public function postAsync(array $options = [ 'json' => [ 'combine_appid' => 'wxd678efh567hg6787', 'combine_mchid' => '1900000109', 'combine_out_trade_no' => 'P20150806125346', 'scene_info' => [ 'device_id' => 'POS1:1', 'payer_client_ip' => '14.17.22.32', ], 'sub_orders' => [[ 'mchid' => '1900000109', 'attach' => '深圳分店', 'amount' => [ 'total_amount' => 100, 'currency' => 'CNY', ], 'out_trade_no' => '20150806125346', 'sub_mchid' => '1900000109', 'goods_tag' => 'WXG', 'description' => '腾讯充值中心-QQ会员充值', 'settle_info' => [ 'profit_sharing' => true, 'subsidy_amount' => 10, ], ],], 'time_start' => '2019-12-31T15:59:60+08:00', 'time_expire' => '2019-12-31T15:59:60+08:00', 'notify_url' => 'https://yourapp.com/notify', ], ]): PromiseInterface; } 以函数默认值的形式,说明参数数据格式如上,composer require iwechatpay/openapi 可能适合你。 为 wechatpay-php 增加IDE提示的接口描述包 iwechatpay/openapi 介绍wechapay-php 开发包的辅助包
微信支付财付通合单支付,多个子单如何拼写参数?array(7) { ["combine_appid"]=> string(18) "wx948d4e11762e6bac" ["combine_mchid"]=> string(10) "1606143582" ["combine_out_trade_no"]=> string(23) "810688748219833539-mini" ["time_expire"]=> string(25) "2021-10-28T16:14:00+08:00" ["notify_url"]=> string(80) "https://mlsldshop.codechain.shop/cmobile/api/payment/xcx_jsapi_v3/notify_url.php" ["sub_orders"]=> array(2) { [0]=> array(7) { ["mchid"]=> string(10) "1606143582" ["attach"]=> string(23) "product_buy-wxpay_jsapi" ["out_trade_no"]=> string(23) "810688748219833539-mini" ["sub_mchid"]=> string(10) "1606794343" ["description"]=> string(31) "实物订单_810688748219833539" ["amount"]=> array(2) { ["total_amount"]=> int(1) ["currency"]=> string(3) "CNY" } ["settle_info"]=> array(2) { ["profit_sharing"]=> bool(true) ["subsidy_amount"]=> int(0) } } [1]=> array(7) { ["mchid"]=> string(10) "1606143582" ["attach"]=> string(23) "product_buy-wxpay_jsapi" ["out_trade_no"]=> string(23) "810688748219833539-mini" ["sub_mchid"]=> string(10) "1606995864" ["description"]=> string(31) "实物订单_810688748219833539" ["amount"]=> array(2) { ["total_amount"]=> int(1) ["currency"]=> string(3) "CNY" } ["settle_info"]=> array(2) { ["profit_sharing"]=> bool(true) ["subsidy_amount"]=> int(0) } } } ["combine_payer_info"]=> array(1) { ["openid"]=> string(28) "o4baQ0njOxeXDO4yZ0fPXH3lgkuc" } } w我是这样拼的,报错Client error: `POST https://api.mch.weixin.qq.com/v3/combine-transactions/jsapi` resulted in a `400 Bad Request` response
2021-10-28不是自动关闭,是无法唤醒支付,相当于票据失效
微信扫码支付NATIVE->统一下单?比如设置了交易开始时间:20211028160500,交易结束时间:20211028160600,两者相差1分钟, 是不是表示1分钟后,微信会自动关闭订单吗?
2021-10-28我在用的实例,供参考: <?php require_once('./vendor/autoload.php'); use WeChatPay\Builder; use WeChatPay\Crypto\Rsa; use WeChatPay\Crypto\Hash; use GuzzleHttp\Psr7\Uri; use GuzzleHttp\Psr7\Utils; use GuzzleHttp\Psr7\InflateStream; use Psr\Http\Message\ResponseInterface; $instance = Builder::factory([ 'mchid' => '', 'serial' => '', 'privateKey' => $privateKey, 'certs' => ['' => $publicKey], ]); $handler = clone $instance->getDriver()->select()->getConfig('handler'); $handler->remove('verifier'); $tradeBill = $instance ->v3->bill->tradebill ->getAsync([ 'query' => [ 'bill_date' => $billDate, 'bill_type' => 'ALL', 'tar_type' => 'GZIP', ], ]) ->then(static function(ResponseInterface $response) { return (array) json_decode($response->getBody()->getContents(), true); }) ->wait(); $hashAlgo = strtolower($tradeBill['hash_type'] ?? 'sha1'); $hashValue = $tradeBill['hash_value'] ?? null; $previous = new Uri($tradeBill['download_url'] ?? ''); $baseUri = $previous->composeComponents($previous->getScheme(), $previous->getAuthority(), '/', '', ''); $savedTo = fopen('/tmp/all.' . $billDate . '.csv.gz', 'w+'); $stream = Utils::streamFor($savedTo); $message = $instance ->chain(ltrim($previous->getPath(), '/')) ->getAsync([ 'sink' => $stream, 'handler' => $handler, 'query' => $previous->getQuery(), 'base_uri' => $baseUri, ]) ->then(static function(ResponseInterface $response) use($hashValue, $hashAlgo) { if (Hash::equals(Utils::hash(new InflateStream($response->getBody()), $hashAlgo), $hashValue)) { return 'Verified with digest(' . $hashValue . ') OK'; } $response->getBody()->close(); throw new UnexpectedValueException('Bad digest verification'); }) ->wait(); print_r($message);
微信支付下载账单使用文档中的demo生成的地址不能下载?接口文档中说要先获取账单,通过API v3标准对download_url进行签名 我使用了文档中的demo 但是一直报错:"Http头Authorization值格式错误,请参考《微信支付商户REST API签名规则》" 生成连接: https://api.mch.weixin.qq.com/v3/billdownload/file?token=ICNRgTSPv6dxsvlmhQhy9d1xLCQFf2mhNMqTxrBbHKRe2ZViVtb6XCSvEgssNTpT -H 'Authorization: WECHATPAY2-SHA256-RSA2048 mchid="1610661703",nonce_str="593BEC0C930BF1AFEB40B4A08C8FB242",signature="jYyzep3KWGnCxB43CnObJUhKqZjNMRK6ThfOqilgFWmdg4WnpvlcuDb0ul/Avbgny4n7/rL35QWOsOzgs5lSkKk8jmnp/of7emVbFg5Ji1v2tB8sraqMNMJE2/L6Ohuq/cePjDsBceJmna3OO988xTSDnsAz3MjcgeD6FquUo0LwuoPLI2LCii2mi4N4mS4Pcz9JEO98zKtBTyXP9p7IEIWDkQNUaTUTkQQFYWnWW9CazjJ1o7buXSt1cewtui7NMz5OmbUUxuD0X/9wfnkTam8NhtBthSIZrkp6S2YdBkyYPA0+ajUItY4psYw/btWSjL/hbDkJEE5ajYy5YJlGUg==",timestamp="1635398934",serial_no="401F9FABBB243E274F3C278582DB8F7FF946E5A8"'
2021-10-28key.pem 是RSA私钥,错误提示应该指你没有提供 apiclient_cert.pem 文件,这个文件是「证书」你把这个也加上试试。
现金红包,一直提示:证书出错,请登录微信支付商户平台下载证书调用发放红包接口一直提示:<![CDATA[证书出错,请登录微信支付商户平台下载证书]]> 该证书是新下载的,用的Linux 绝对路径:“/wwwroot/cert/aaa/key.pem” 请教一下大家,有哪里不对的嘛?
2021-10-28编码上 ^M = \r\n,一般经过HTTP传输都会被带上这个\r\n,建议还是检查一下自己的程序逻辑,解析XML/JSON时,同时忽略掉\r及或\n。
微信支付回调通知,出现^M,是正常的吗?最近微信支付回调通知,偶尔会出现^M,导致收到程序异常通知,想问一下,这个是官方推送的吗?
2021-10-25需要开通「免充值代金券」产品权限,之后才能上传券用图片素材。
上传图片提示“暂无图片上传权限,请检查后重试”,怎么开通这个权限?微信支付服务商接口上传素材提示“暂无图片上传权限,请检查后重试”,请问怎么开通这个接口权限?麻烦详细告知方法,比较着急。谢谢了。
2021-10-25<?php // 参考上上述说明,引入 `WeChatPay\Crypto\Rsa` use WeChatPay\Crypto\Rsa; // 做一个匿名方法,供后续方便使用,$platformCertificateInstance 见初始化章节 $encryptor = static function(string $msg) use ($platformCertificateInstance): string { return Rsa::encrypt($msg, $platformCertificateInstance); }; $instance->v3->transfer->batches->postAsync([ 'json' => [ 'appid' => 'wxf636efh567hg4356', 'out_batch_no' => 'plfk2020042013', 'batch_name' => '2019年1月深圳分部报销单', 'batch_remark' => '2019年1月深圳分部报销单', 'total_amount' => 4000000, 'total_num' => 200, 'transfer_detail_list' => [[ 'out_detail_no' => 'x23zy545Bd5436', 'transfer_amount' => 200000, 'transfer_remark' => '2020年4月报销', 'openid' => 'o-MYE42l80oelYMDE34nYD456Xoy', 'user_name' => $encryptor('张三'), 'user_id_card' => $encryptor('110'), ],], ], 'headers' => [ // $platformCertificateSerial 见初始化章节 'Wechatpay-Serial' => $platformCertificateSerial, ], ]) ->then(static function ($res) { echo $response->getBody(), PHP_EOL; return $response; }) ->otherwise(static function ($res) { // 异常错误处理 echo $e->getMessage(), PHP_EOL; if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) { $r = $e->getResponse(); echo $r->getStatusCode() . ' ' . $r->getReasonPhrase(), PHP_EOL; echo $r->getBody(), PHP_EOL, PHP_EOL, PHP_EOL; } echo $e->getTraceAsString(), PHP_EOL; }) ->wait();
有没有关于微信批量转账接口的参考demo?文档确实不好理解。看了一下文档 不是很清楚 获取到公私钥以后 要怎么对数据进行加密 加签 解密解签操作 或者有么有什么工具类可以提供 或者文档哪里有体现呢?
2021-10-19tarType = GZIP, 你获取的stream是gzip流,需要先解压。。。
下载微信交易账单出现乱码?首先按照接口文档进行参数组装: [图片] 经过调用得到如下响应: [图片] 请问是什么原因呢?看了错误码才知道是缺少参数,于是我就传了后面注释了2个参数,得到了一堆的乱码:(已解决) [图片] 经过 gzip解压reader.Read读取后,得到了: [图片] 感觉这内容为啥颠倒顺序了呢?!
2021-10-193、 用标准的RSA加密库对敏感信息进行加密,选择RSA_PKCS1_OAEP_PADDING填充模式 (eg:Java的填充方式要选 " RSA/ECB/OAEPWITHSHA-1ANDMGF1PADDING") https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay_yhk.php?chapter=24_7
调用提现到银行卡问题?<xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[参数错误,请检查参数]]></return_msg> <result_code><![CDATA[FAIL]]></result_code> <err_code><![CDATA[PARAM_ERROR]]></err_code> <err_code_des><![CDATA[解密真实姓名或银行卡号出错]]></err_code_des> <nonce_str><![CDATA[c5deffbc3469404fa58f8d8f18c842ed]]></nonce_str> <mch_id><![CDATA[1582653711]]></mch_id> <partner_trade_no><![CDATA[wd20211018212829936100000]]></partner_trade_no> <amount>1</amount> </xml> 确定了公钥是正确的的,填充方式是Pkcs1
2021-10-19