Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信支付接口不知道还能不能用 #71

Closed
aka99 opened this issue Jan 30, 2015 · 7 comments
Closed

微信支付接口不知道还能不能用 #71

aka99 opened this issue Jan 30, 2015 · 7 comments

Comments

@aka99
Copy link

aka99 commented Jan 30, 2015

小弟菜鸟,最近自己学习微信公众平台,现在0.6版本的微信支付接口还能不能用?

@tg123
Copy link
Contributor

tg123 commented Jan 30, 2015

支付相关代码是我贡献的
我这边有个项目 实际使用 werobot 的
支付相关代码也是一致的

那个时候还没有微小店 现在好像有小店 API
不过我没有用到

如果你遇到问题 可以给提 issue 的

@aka99
Copy link
Author

aka99 commented Feb 1, 2015

看了源码,有几个问题请教:
1、不知道是否微信支付版本差异,现在的接口地址变了,参数也不同了,详见http://pay.weixin.qq.com/wiki/doc/api/index.php
2、是否支持JsApi 场景发起支付

谢谢

@tg123
Copy link
Contributor

tg123 commented Feb 1, 2015

1 目前 我的应用还可以用
2 支持 我的应用就是通过jsapi 发起的

@aka99
Copy link
Author

aka99 commented Feb 1, 2015

谢谢!
如果用JsApi发起支付,WeixinPayClient 大致操作思路能否指点一下?

@tg123
Copy link
Contributor

tg123 commented Feb 1, 2015

大致流程代码 我贴下 删减了 可能不能直接运行

首先 网页段发起 创建请求 把创建订单 必要的参数传递给后端

                $.post('/pay/create', {
                    item_id : {{id}}
                }).success(function(data){
                    WeixinJSBridge.invoke('getBrandWCPayRequest', data, function(res){
                        if(res.err_msg == "get_brand_wcpay_request:ok"){
                            alert("购买成功");
                        }
                        WeixinJSBridge.log(res.err_msg);
                    });

服务器端生成 js 需要的 数据 对应上端代码中的 data , pay_params 就是 data
用来创建订单的

    pay_params = wxclient.create_js_pay_params(body=商品名称,
                                               out_trade_no=外部订单号, total_fee=价格分,
                                               notify_url=回调地址,
                                               spbill_create_ip=request.environ.get('REMOTE_ADDR'), )

@aka99
Copy link
Author

aka99 commented Feb 6, 2015

谢谢耐心答复。
因用的微信支付3.3.7接口,目前还没用微信支付组件,使用比较笨办法实现了支付。

@aka99 aka99 closed this as completed Feb 6, 2015
@aetherwu
Copy link

aetherwu commented Feb 4, 2016

能否请问一下怎么获取 wxclient? 谢谢……

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants