微信支付踩坑之旅

微信支付趟坑之旅之单页面应用 年初产品引入了微信支付到现在不到半年的时间,一直没有过太大的坑爹经历,自认为微信支付也能hold住了,没想到上周还是被微信支付团队的同学狠狠的摆了一道。在这里留个记录,希望同入此坑的同学能尽快爬上来。 背景:        上半年上线了商城的微信支付,此项目前端为angularjs 的SPA(single page application,单页面应用)。地址类似于:http://mall.zj 阅读详情
前言,作为一名有经验的开发人员,竟然被集成微信支付这么一个小小的功能坑的吐血。文档不详细不够规范,Demo可以说是小学生写的吗,而且几年未更新了。。。虽然代码量很少,但是坑实在是多。

一.客户端的坑

在调用IWXAPI对象的registerApp()之前,我们需要先创建IWXAPI对象,那么这个对象该如何创建呢?

Demo是这样写的:
IWXAPI api = WXAPIFactory.createWXAPI(this, "your app id");

文档是这么写的:
IWXAPI msgApi = WXAPIFactory.createWXAPI(context, null);

网上搜到还有一种写法是这样的:

IWXAPI api = WXAPIFactory.createWXAPI(this, "your app id", false);


经过实际测试后发现,其实这三种方式都可以。只是微信没有写清楚......


关于错误码error code。

当客户端无法调起微信窗口时,会有错误码给出。然而,微信就只给了一个错误码,-1。errCode=-1,解释是,可能的原因:签名错误、未注册APPID、项目设置APPID不正确、注册的APPID与设置的不匹配、其他异常等。尼玛,难道就不能细分下错误码吗。。。无法成功调起微信,有可能是客户端的问题,也有可能是服务端的问题,这给联调带来了很多麻烦。


二.服务端的坑


// TODO 未完,年后来填坑。
































android 分享微信小程序+压缩图片优化 实现分享微信小程序、图片到微信朋友圈、微信好友。解决因图片过大出现分享失败,内置图片压缩功能,内置截图功能。 立即下载

相关推荐

从‘静态拍照’到‘动态录像’:用Malmquist指数讲好你的效率变化故事(附Stata/R代码)

本文深入探讨了如何利用Malmquist指数构建动态效率分析框架,从静态数据到动态叙事的转变。通过分解技术效率变化(EC)和技术进步(TC),结合Stata/R代码实现四种动态可视化方法,帮助研究者更直观地展示效率变化的动态特征。文章还提供了诊断性叙事结构和比较叙事技巧,助力决策者理解效率提升的来源与趋势。

weixin_32678995的博客 603

Android 微信支付开发

在app包下新建wxapi包,在包下新建WXPayEntryActivity,继承自任意Activity实现微信支付回调接口。该Activity用以接收支付结果回调。注:统一下单接口由自己服务器的去请求下单,我们只需要请求自己服务器端定义的下单的接口,从而达到去微信服务器进行下单的操作,并拿到返回的数据。清单声明此Activity的格式为。申请APP_ID,添加依赖库。拿到下单返回数据调用支付接口。

chengzhenjia的博客 1248

【Java完整版 面试必备】Leetcode Top100题目和答案-滑动窗口篇

【Java完整版 面试必备】Leetcode Top100题目和答案-滑动窗口篇

weixin_43298211的博客 2245

android分享支付经验分享

最近由于公司向弄一个新手推荐活动,因为是推荐活动,必须借用现在流行的社交软件进行各种分享,只要形式有微信分享到好友或者朋友圈、QQ分享给好友或者空间、微博分享和短信分享等。下面我就跟大家一起聊下在分享的过程中所遇到的各种坑。本文来自于自己的经验,不足的地方还请指正。首先说下我是怎么实现的,然后给大家说下实现过程中应该注意的。

u010696065的专栏 1080

【论文笔记】Reaching agreement in the presence of faults (EIG)

1 问题定义 2 交互一致性 3 单点故障 m=1 n=4 4 多点故障(n>=3m+1) 计算过程 m=2 n=7 5 n<3m+1不能达成协定 6 带认证的算法 7 总结 这篇论文在1980年发表,是1982年著名的拜占庭将军问题论文的前身。作者Leslie Lamport是2013图灵奖得主,两篇论文引用次数分别为5000+和2000+。该论文提出的算法现在被...

zjwreal 2993

slam_toolbox 简介和使用

专为移动机器人在未知环境中实时构建地图和定位设计。它适用于2D和3D环境,支持多种机器人平台和传感器配置。

weixin_74808846的博客 3305

Android支付开发(微信)

微信接入支付流程跟支付宝差不多,这里介绍一下接入流程以及注意事项。接入流程:1.1、到微信开放平台添加移动应用,申请权限到微信开放平台注册开发者账号,并添加应用,申请支付权限,等待审核,需要提前做,审核需要时间,一般在7个工作日内。获取的参数配置:1.2、后台设置这里应用跟应用签名和包名挂钩,也就是说一个移动应用对应一个APPID,表明了配置参数的不可公用性。另外要注意调试的时候签名问题,可以先设置

隔壁小王的博客 6540

SAP 零售 FMS 物料主数据(一)

SAP 零售 FMS 物料主数据(一) SAP 对于鞋服行业最新的解决方案-FMS(相当于原来的AFS+Retail);更偏向与零售; 商品主数据与原来的AFS大不相同,取消了原来的Grid的网格概念,取而代之的是变式;商品主数据维护也偏向于Retail的维护模式;事物代码也不是MM01而是MM41 /MM46; 在维护商品主数据前,需要与商品部沟通定义各种商品相关的规范如编码规则,大中小类 ,颜色库,尺码库等,此处不赘述; 创建商品需要确定哪些物料是变式物料,哪些是常规不带特性的单一物料;这决定了在创建商

weixin_45518759的博客 5061

android studio调起微信支付、分享、登陆

android studio接入微信支付、分享、登陆。手把手教你调起微信SDK

liaozan8888的博客 4081

OpenClaw(原Clawdbot/Moltbot)本地部署快速指南

支持Telegram、Slack、Discord、iMessage等多平台接入,通过配置文件或环境变量填写对应平台的Token,配置后执行。支持对接OpenAI、Anthropic、阿里云百炼等云端模型,也可搭配Ollama使用本地模型。默认仅允许已配对用户交互,群聊场景建议开启Docker沙箱模式,在配置文件设置。执行后跟随指引确认安全说明,进入QuickStart模式,默认网关端口为。可查看已加载模型,通过绑定的通讯通道发送测试指令,响应正常即部署完成。,限制非主会话操作权限,提升安全性。

wukangjupingbb的博客 8474

【ComfyUI专栏】ComfyUI 常用工作流下载与分享网址

首先我们来分享第一个网站,Openart 网站,这个网站同时也能提供比较多的其他类型。但是如果希望下载工作流,我们可以访问到如下的这个站点。作为ComfyUI的学习用户来说,我们通常需要借助他山之石来帮助我们快速成长,因此我们需要找到能够分享和下载的网址。,当前网站是综合性网站,在网站中可以下载各种不同的类型,其中工作流只是可以下载的非常小的部分。这个网站也可以浏览不同的工作流,这个工作流的地址和访问如下的站点。

技术与管理的平衡木- 7778

一次痛苦又甜蜜的微信支付踩坑之旅

凡是和钱打交道的事,没有一样是容易的。这是我第一次接触微信支付,发现网上还是有很多同学在求助,XXX了怎么办?XXX是什么情况?为了帮助更多的小伙伴脱离“苦海”,我决定写下这次的踩坑之旅,给更多的人帮...

qq_36320160的博客 391

【AI智能体】Codex 开发聚合搜索应用项目实战操作详解

Codex 开发聚合搜索应用项目实战操作详解

congge 3094

android微信支付错误码,Android接入微信支付之-1错误码踩坑之旅

一、引言微信支付文档写的真的棒啊!少林功夫真的好啊!永远猜不到-1错误码是啥问题。文档写的棒呀二、注意事项1.在开放平台绑定商户的应用签名不像别家SDK使用签名文件的sha1值,而是使用MD5值。并且要去掉中间所有的 " : " 冒号 ,最好英文字母改成小写。顺便介绍下签名文件:debug.keystore:在Android Stduio中系统默认内置了一个签名文件debug.keystore,用...

weixin_36248959的博客 606

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

微信支付android错误码-1,Android接入微信支付之-1错误码踩坑之旅

一、引言微信支付文档写的真的棒啊!少林功夫真的好啊!永远猜不到-1错误码是啥问题。 文档写的棒呀二、注意事项1.在开放平台绑定商户的应用签名不像别家SDK使用签名文件的sha1值,而是使用MD5值。并且要去掉中间所有的 " : " 冒号 ,最好英文字母改成小写。顺便介绍下签名文件:debug.keystore:在Android Stduio中系统默认内置了一个签名文件debug.keystore,...

weixin_39926613的博客 765

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

移动H5页面微信支付踩坑之旅(微信支付、单页面路由模拟、按钮加锁、轮询等常见功能)...

开发背景: .net混合开发的vue模板语法的单页面应用,所以不存在脚手架以及没有路由可以跳转。 项目描述: 需要写两个页面,在订单详情页需要点击“请输入手机号”进入手机号绑定页面,手机号绑定成功后自动跳转到订单详情页,如果该手机号已经绑定成功,则不显示“请输入手机号”(即不可点击进入下一个页面),只显示该手机号。 项目思路: 在单页面中使用v-show控制两个页面的切换,所以需要模拟真实两个页面...

weixin_33924770的博客 1398

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

android微信支付坑,微信支付踏坑之旅

其实微信支付的集成步骤也就那么几步,奈何第一次接触无论是微信官方文档还是5+SDK文档都看的晕头转向,于是我换个思路(以下只针对android app支付功能,服务端为java)1、首选确定app已经开通支付功能,确保 包名、应用签名、appid、mchid、apikey(包名、应用签名、appid 在https://open.weixin.qq.com/中查看;mchid、apikey 在htt...

weixin_34952710的博客 219

微信支付--公众号支付及退款,采坑之旅

微信支付开发文档中的坑坑 微信支付官方文档地址:微信支付官方文档 ​ 首先,使用的最知名语言-- Java,然后我们说一下在支付上微信提供的API 微信支付API: 统一下单 https://api.mch.weixin.qq.com/pay/unifiedorder 不需要使用证书 查询订单 https://api.mch.weixin.qq.com/pay/orderquery ...

qq_36994538的博客 2476

android 微信、支付宝支付踩坑之旅

这两天为项目集成微信、支付宝支付功能写demo。多多少少遇到些坑,把这些记录一下,防止再掉进去。 自动代扣 又称“委托代扣”,“委托扣费”。使用不当会造成很严重的结果。也是比较流氓的功能。功能例子嘛:参考微博会员,爱奇艺会员,滴滴打车,Uber。基本就是在一次购买之后,每月会自动扣费,一旦中招很难察觉。但是无论微信还是支付宝,会员自动扣费的功能都是没有对普通开发者开放的,需要深度合作,查了半天资料...

weixin_34310369的博客 105

React Native微信支付开发爬坑之旅

早闻微信支付一直为移动开发者所诟病,这次公司项目新增微信支付需求,一试果然是一把辛酸泪,从配置到与后台调试真是一波三折,整整花了一天的时间才从坑里爬出来,效率也是低。所以有必要做下总结,日后再有微信支付,三两下便可完事。   因为公司项目是RN写的,我这边选用了目前在RN上使用较广泛的微信支付组件,基本上都封装好了,github直通车:react-native-wechat ...

weixin_34050005的博客 188
上一篇: Android中主流状态栏效果实现
下一篇: TabLayout属性介绍
ruancoder
博客等级 码龄10年 42粉丝 66原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值