react-native library for wechat app

Usage no npm install needed!

<script type="module">
  import shmOpenReactNativeWechat from 'https://cdn.skypack.dev/@shm-open/react-native-wechat';


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');


  • returns {Boolean} if WeChat is installed.

Check if the WeChat app is installed on the device.


  • returns {Boolean} Contains the result.

Check if wechat support open url.


  • returns {String} Contains the result.

Get the WeChat SDK api version.


  • 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


  • 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


$ npm install react-native-wechat --save