Giter VIP home page Giter VIP logo

uepay-wallet-sdk-react-demo's Introduction

uepay-wallet-sdk-react-demo

uepay钱包SDK调用例
开发环境:Reat
UI: antd-moblie
uepa钱包SDK:https://www.npmjs.com/package/uepay-wallet-js-sdk (SDK安装说明,接口使用请参考该网站)

安装

  1. git clone 代码到本地
  2. npm i 安装
  3. npm run dev 运行

分别执行以下命令

  1. git clone https://github.com/Jamin-Deng/uepay-wallet-sdk-react-demo.git
  2. $ cd uepay-wallet-sdk-react-demo
  3. $ npm i 安装必须有的nodejs环境
  4. $ npm run dev

实例使用方法

步骤:1、app扫描H5 URL 生产的二维码。 2、进入H5页面,点击“在线支付”按钮。

uepay钱包接口

1、获取版本号

import UePay from 'uepay-wallet-js-sdk/index';
 
const agent = UePay.getUserAgent();    // 获取当前浏览代理头
var serverSide = agent.UePay;      // 服務端版本
var clientSide = agent.UePayClient;    // 客戶端版本

2、判断当前是否为钱包内核

import UePay from 'uepay-wallet-js-sdk/index';
 
const isUePay = UePay.isUePayApp();    // true为UePay钱包内核,false为非UePay钱包内核

3、异步方法用于注册被监听的全局文件准备就绪事件

import UePay from 'uepay-wallet-js-sdk/index';
 
const isUePay = UePay.onReady();
/**
 * (uePay) => {
 *     uePay && uePay.payment();
 * }
 */

4、实例化UePayJsApi并发起支付

import UePay from 'uepay-wallet-js-sdk/index';

var paySdk = UePay.build(function(res) {});
paySdk.payment(req);

build里面参数为支付结果回调函数,支付成功res返回{'ret_code':'complete','ret_msg':'successful'}JOSN字符串,支付失败res返回{'ret_code':'fail','ret_msg':'cancel'}JOSN字符串。

req为支付信息参数对象,结果为appId(分配给商户的)、timeStamp(时间戳)、nonceStr(由服务器生产的随机串,用于验证前后端交互的一致性)、prepayid(预支付订单的传递订单号)、signType(签名散列算法,现在固定为'MD5')、paySign(验签参数)

uepay-wallet-sdk-react-demo's People

Contributors

jamin-deng avatar qwe12369 avatar

Watchers

 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.