npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wang.imchao.plugin.alipay

v0.0.2

Published

支付宝支付插件,alipay payment

Downloads

59

Readme

Cordova 支付宝支付插件

还在开发中,待加入订单信息

支持的系统

  • iOS
  • Android

手动安装

  1. 使用git命令将插件下载到本地,并标记为$CORDOVA_PLUGIN_DIR

     git clone https://github.com/charleyw/cordova-plugin-alipay.git && cd cordova-plugin-alipay && export CORDOVA_PLUGIN_DIR=$(pwd)
  2. 修改$CORDOVA_PLUGIN_DIR/plugin.xml,将

     <preference name="private_key" value="$PRIVATE_KEY" />

改成

	<preference name="PRIVATE_KEY" value="你生成的private key"/>

**注意**:总共有两处
  1. 安装

     cordova plugin add $CORDOVA_PLUGIN_DIR --variable PARTNER_ID=[你的商户PID可以在账户中查询] --variable SELLER_ACCOUNT=[你的商户支付宝帐号]

使用方法

window.alipay.pay({
	tradeNo: tradeNo,
	subject: "测试标题",
	body: "我是测试内容",
	price: 0.02,
	fromUrlScheme: "demoScheme://afterPaymentSuccess",
	notifyUrl: "http://your.server.notify.url"
});

参数说明

  • tradeNo 这个是支付宝需要的,应该是一个唯一的ID号
  • subject 这个字段会显示在支付宝付款的页面
  • body 订单详情,没找到会显示哪里
  • price 价格,支持两位小数
  • fromUrlScheme 支付完成跳转的URL Scheme(iOSAndroid),可以使用这个Cordova插件定义你的App的Scheme

调用pay方法会打开支付宝支付页面进行支付(如果有安装支付宝钱包的话会打开支付宝钱包),支付完成之后会跳回到程序,会跳到fromUrlScheme定义的程序页面, 如上面的例子会返回你的程序的/afterPaymentSuccess路径所定义的页面,并且支付结果会附加到这个url后面。你可以在程序中调试来确定该怎么处理。

为什么不能自动安装

正常情况下,应该是可以使用下面的命令安装的

cordova plugin add $CORDOVA_PLUGIN_DIR --variable PARTNER_ID=[你的商户PID可以在账户中查询] --variable SELLER_ACCOUNT=[你的商户支付宝帐号] --variable PRIVATE_KEY=[你生成的private key]

但是因为private key里面有时会有等号(=),而当前版本的cordova(v5.1.1)有一个bug,当参数中有等号(=)的时候就不能正常解析变量值了。这个bug已经在cordova的master上已经修好了,但是还没有发布。

Liscense

© 2015 Wang Chao. This code is distributed under the MIT license.