GithubHelp home page GithubHelp logo

liumingxing / titanium_module_pingplusplus Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 14.15 MB

Appcelerator module for ping++(a mobile payment sdk in china) / ping++支付模块module

License: Other

JavaScript 2.07% Java 3.90% Objective-C 48.88% Python 6.44% Ruby 15.22% CSS 0.50% HTML 6.13% Makefile 16.87%

titanium_module_pingplusplus's Introduction

pingplusplus_module

在国内做手机支付功能是一个老大难问题,还好ping++这家公司做了一些很好地工作,大大简化了支付功能的实现难度。此module是Appcelerator平台对ping++的封装,同时支持ios和android。

使用方法:

var pingpay = require("com.mamashai.pingxx");
pingpay.addEventListener("ping_paid", function(e){
	//code的值可能为success, fail, cancel, invalid, error
	show_alert("提示", "收到了ping_paid信息 code: " + e.code + " text:" + e.text);
});
	
function ios_resume(e){
	var args = Ti.App.getArguments();
	var code = args.url.split("=")[1];
	pingpay.fireEvent("ping_paid", {code: code, text: ''});
}
Ti.App.addEventListener("resumed", ios_resume);
win.addEventListener("close", function(e){
    Ti.App.removeEventListener("ios_resumed", ios_resume);
});

btn.addEventListener("click", function(e){
	pingpay.pay({
		url: "http://bak.mamashai.com:3000/pay/make_payment",
		order_no: "100023",
		amount: "8",					//以分为单位
		channel: "alipay", 				//可选项为:alipay,wx,upmp,jdpay_wap,百度钱包不支持
		url_scheme: "bizsim"
	});
})

参数解释: url:ping++需要在服务端进行配置,这个URL接受客户端的付款请求 order_no:付款之前肯定得先生成订单,付款时传入订单号即可 amount:订单要付款的金额,以分位单位,不是元 channel:可选项为:alipay,wx,upmp,jdpay_wap,bfb安卓下百度钱包不支持 url_scheme:ios下必须传入,付完款后跳回app用的,用xcode打开项目,项目属性->INFO中可以查看,IOS下微信支付对url_scheme参数有特殊要求,详情可见https://pingxx.com/guidance/client/sdk/ios

3:客户端付完款后,ping++会回调server端的notify url,这个比较简单,不涉及到本地端技术,在notify url中获得详细参数,回填各种信息(比如付款时间,付款是否成功等)到付款记录中即可。

4:注意事项 百度钱包android module开发比较麻烦,在国内使用者群体也很小,干脆就没有支持。

titanium_module_pingplusplus's People

Contributors

liumingxing avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.