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

react-native-sf-wx-pay

v1.3.0

Published

微信支付

Downloads

61

Readme

react-native-sf-wx-pay

react-native 列表

安装

  • npm i react-native-sf-wx-pay
  • react-native link react-native-sf-wx-pay

说明

IOS 端

  • 1.0
  • 导入库集成SDK
  • 2.0
  • 需要添加的系统库
  • SystemConfiguration.framework
  • libz.tbd
  • libsqlite3.0.tbd
  • CoreTelephony.framework
  • QuartzCore.framework
  • 3.0
  • 设置URL Scheme
  • 4.0 在AppDelegate 添加
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
// 处理微信的支付结果
[WXApi handleOpenURL:url delegate:(id<WXApiDelegate>)self];

return YES;
}

// NOTE: 9.0以后使用新API接口
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options
{
[WXApi handleOpenURL:url delegate:(id<WXApiDelegate>)self];
return YES;
}

//微信回调,有支付结果的时候会回调这个方法

- (void)onResp:(BaseResp *)resp

{
//    支付结果回调
if([resp isKindOfClass:[PayResp class]]){
if([resp.errStr isEqual:[NSNull null]]){
resp.errStr=@" ";
}
NSDictionary * dic = [[NSDictionary alloc]initWithObjectsAndKeys:[NSString stringWithFormat:@"%d",resp.errCode],@"respCode",resp.errStr,@"respStr",nil];
NSNotification *notification = [NSNotification notificationWithName:@"PAY_WECHAT" object:nil userInfo:dic];
[[NSNotificationCenter defaultCenter] postNotification:notification];
}

}
  • 5.0 在react 添加监听支付监听
import { NativeAppEventEmitter } from 'react-native';
NativeAppEventEmitter.addListener(
'WeChatResp',
(content) => {
//数据内容
}
}
);
this.listener && this.listener.remove();


回调中errCode值列表:

名称      描述    解决方案
0       成功    展示成功页面
-1      错误    可能的原因:签名错误、未注册APPID、项目设置APPID不正确、注册的APPID与设置的不匹配、其他异常等。
-2    用户取消    无需处理。发生场景:用户不支付了,点击取消,返回APP。

Android 端

  • 1.0
  • 在SDK中找到jar包,导入,或直接添加依赖
  • compile 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:1.0.2' // 微信支付
  • 2.0
  • 配置清单文件
<!--权限-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- 微信支付 -->
<activity
android:name=".wxapi.WXPayEntryActivity"
android:exported="true"
android:launchMode="singleTop"/>

Props

| parameter | type | required | description | default | |:-----|:-----|:-----|:-----|:-----| |appid|string|yes|微信支付id|null| |partnerId|string|yes|合作id|null| |prepayId|string|yes|订单id|null| |nonceStr|string|yes|随机串|null| |timeStamp|string|yes|时间戳|null| |sign|string|yes|订单标签|null|

Methods

| Methods | Params | Param Types | description | Example | |:-----|:-----|:-----|:-----|:-----| |registerApp|string|string|微信注册appid|SFWxpay.registerApp('')| |Pay|dictionary|dictionary|需要传递的参数|SFWxpay.Pay(‘填写多个字符')|