Giter VIP home page Giter VIP logo

react-native-wechat's Introduction

react-native-wechat Node.js CI

[React Native] bridging library that integrates WeChat SDKs

本库是在 react-native-wechat 基础上进行重写; 优化了类型定义,方法调用,并且使用CocoaPodsgradle来管理原生模块依赖的wechat SDK.

Table of Contents

Getting Started

$ npm install @shm-open/react-native-wechat

API Documentation

[react-native-wechat] uses Promises, therefore you can use Promise or async/await to manage your dataflow.

registerApp(appId, universalLink)

  • appId {String} the appId you get from WeChat dashboard
  • universalLink {String} the iOS universalLink setting
  • returns {Boolean} explains if your application is registered done

This method should be called once globally.

import * as WeChat from 'react-native-wechat';

WeChat.registerApp('your wxid', 'your universal setting');

isWXAppInstalled()

  • returns {Boolean} if WeChat is installed.

Check if the WeChat app is installed on the device.

isWXAppSupportApi()

  • returns {Boolean} Contains the result.

Check if wechat support open url.

getApiVersion()

  • returns {String} Contains the result.

Get the WeChat SDK api version.

openWXApp()

  • returns {Boolean}

Open the WeChat app from your application.

sendAuthRequest(scope, state)

  • scope {String} Scopes of auth request. snsapi_userinfo or snsapi_base
  • state {String} 用于保持请求和回调的状态,授权请求后原样带回给第三方
  • returns {Object}

Send authentication request, and it returns an object with the following fields:

field type description
errCode Number Error Code
errStr String Error message if any error occurred
code String Authorization code
state String state_wx_login

pay(payload)

  • partnerId {String} 商家向财付通申请的商家 id
  • prepayId {String} 预支付订单 ID
  • nonceStr {String} 随机串,防重发
  • timeStamp {String} 时间戳,防重发
  • package {String} 商家根据财付通文档填写的数据和签名
  • sign {String} 商家根据微信开放平台文档对数据做的签名
  • returns {Object}

Sends request for proceeding payment, then returns an object:

name type description
errCode Number 0 if pay successed
errStr String Error message if any error occurred

Installation

$ npm install react-native-wechat --save

License

MIT

react-native-wechat's People

Contributors

yorkie avatar rocwind avatar renovate-bot avatar xing-zheng avatar tdzl2003 avatar richard-cao avatar sunzhongliangde avatar kingamo avatar seanbot avatar llearn avatar ineedtocopy avatar dioxide avatar dvlprliu avatar lijinchao2007 avatar litingjun2015 avatar liuchungui avatar messense avatar robinv8 avatar febobo avatar sunxingz avatar anjianshi avatar bobcyw avatar chenjsa avatar buhe avatar alsotang avatar zhigang1992 avatar gitter-badger avatar simman avatar littlexianyu avatar zidail 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.