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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dfeidao/fd-am000049

v4.6.201909191745

Published

调起微信支付

Downloads

10

Readme

微信支付

Installation

yarn add --dev @dfeidao/fd-am000049

支付配置

IOS配置

  1. 安装完成后Link导入依赖包,可直接在VSCode,该项目文件夹下中执行链接命令react-native link @yyyyu/react-native-wechat,可以在Libraries文件夹下找到该项目配置
  2. 添加如下两个依赖libsqlite3.tbdlibRNLWeChat,其中第一个是自带的,可以直接搜索加入,第二个是@yyyyu/react-native-wechat中的,libRNLWeChat这个包可以在项目的Products文件夹下可以找到
  • 3.1. 自带库导入导入
  • 3.2. 微信支付库导入导入
  1. 将以下代码复制到info.plist文件中的Information Property List节点下,或直接在Info选项卡下按照图示添加节点,具体步骤
  • 4.1. 点击项目主文件夹 project
  • 4.2. 点击Info选项卡
  • 4.3. 在图示第一个红框处添加节点
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>weixin</string>
</array>
  1. 在Info 下的URL types添加一项,其中Identifier 配置为weixin,Role 为Editor,URL Schemes中输入申请的wxid 配置
  2. 修改AppDelegate.m文件,将以下代码添加到AppDelegate.m文件中
#import <React/RCTLinkingManager.h>

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
  return [RCTLinkingManager application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
}

android配置

注意, 配置示例中的xxxxx请根据自己的项目替换, 如android/app/src/main/AndroidManifest.xml文件的package="com.demo", 则 xxxxx就替换为demo

android/settings.gradle

rootProject.name = 'xxxxx'

// 添加以下配置
include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
include ':@yyyyu_react-native-wechat'
project(':@yyyyu_react-native-wechat').projectDir = new File(rootProject.projectDir, '../node_modules/@yyyyu/react-native-wechat/android')

android/app/build.gradle

dependencies {
	// 添加以下配置
	implementation project(':react-native-device-info')
	implementation project(':@yyyyu_react-native-wechat')
	...
}

android/app/proguard-rules.pro

-keep class com.tencent.mm.sdk.** {
  *;
}

android/app/src/main/java/com/xxxxx/MainApplication.java

import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.rnlibrary.wechat.RNLWeChatPackage;


protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
		  // 添加配置
		  new RNDeviceInfo(),
		  new RNLWeChatPackage(),
		  ...

android/app/src/main/java/com/xxxxx/ 下创建wxapi目录

img

wxapi目录下创建 WXEntryActivity.javaWXPayEntryActivity.java 文件

android/app/src/main/java/com/xxxxx/wxapi/WXEntryActivity.java

package com.xxxxx.wxapi;

import android.content.Intent;
import android.os.Bundle;

import com.xxxxx.MainActivity;
import com.rnlibrary.wechat.RNLWeChatDelegateActivity;

public class WXEntryActivity extends RNLWeChatDelegateActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent = new Intent(getApplicationContext(), MainActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
    }
}

android/app/src/main/java/com/xxxxx/wxapi/WXPayEntryActivity.java

package com.xxxxx.wxapi;

import android.content.Intent;
import android.os.Bundle;

import com.xxxxx.MainActivity;
import com.rnlibrary.wechat.RNLWeChatDelegateActivity;

public class WXPayEntryActivity extends RNLWeChatDelegateActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent = new Intent(getApplicationContext(), MainActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
    }
}

android/app/src/main/AndroidManifest.xml

		...
		<activity
			android:name="com.xxxxx.wxapi.WXEntryActivity"
			android:exported="true"
			android:label="@string/app_name" />
		<activity
			android:name="com.xxxxx.wxapi.WXPayEntryActivity"
			android:exported="true"
			android:label="@string/app_name" />
	</application>
</manifest>

param

属性 | 说明 | 类型 ---- | ---- | ---- spaceid | | string systemid | | string app_id | 微信平台注册应用后得到的 appId | string option.usercode | 用户code | string option.trade_no | 商户系统内部订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一 | string option.fee | 商品金额 | string option.des | 商品描述 | string option.time_start | 订单生成时间,格式为yyyyMMddHHmmss,例如 20190723114000 | string option.time_expire | 订单失效时间. 注意:最短失效时间间隔必须大于5分钟且存活时间不得超过2小时 | string option.attach | 附加数据,原样返回 | string

result

{
	result?: 'unknow';
	prepayId?: string;
	ext?: string;
	returnKey?: string;
	openID?: string;
	type?: number;
}
// IOS
{
	"type": 0,
	"returnKey": ""
}
// android
{
	"ext": null,
	"returnKey": "",
	"prepayId": "wx",
	"openID": null,
	"type": 5
}

result-error

string | {result : "unknow" }

Example

import am49 from '@dfeidao/fd-am000049';

const param = {
	usercode: 'admin',
	trade_no: 'trade_no',
	fee: '0.01',
	des: 'des',
	time_start: 'time_start',
	time_expire: 'time_expire',
	attach: 'attach'
};
try{
	const res = await am49('spaceid', 'systemid', 'appid', param);
}catch(error){
	console.log(error);
}