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-inapp-purchase

v1.0.13

Published

1. `Build Phases`-> `Link Binary With Libraries`中添加libRCTInAppPurchase.a

Downloads

6

Readme

ios配置

  1. Build Phases-> Link Binary With Libraries中添加libRCTInAppPurchase.a

参见index.js

使用说明

    //  引用方式
    const InAppUtils = NativeModules.InAppPurchase;
    
    //  使用方式
    import { NativeEventEmitter} from 'react-native';
    const emitter = new NativeEventEmitter(InAppUtils); //用获取的模块创建监听器
    this.subScription = emitter.addListener(EVENT_CANMAKEPAYEVENTS,(body) => Alert.alert(body));
    
    [注]:在componentWillUnmount里移除监听
    componentWillUnmount() {
    this.listener && this.listener.remove();  //记得remove哦
    this.listener = null;
    }

    //  进程被杀死掉单接收通知
    对应事件:   EVENT_SINGLE_OUT        返回类型:数组(key为info{ 子对象key为:transactionDate,transactionIdentifier,productIdentifier,transactionReceipt,transationInfo })
    
    //  查看商品能否支付
    InAppUtils.canMakePayments(() => {});
    对应事件:   EVENT_CANMAKEPAYEVENTS  返回类型:BOOL
    
    //  加载商品
    InAppUtils.loadProducts([order.apple_goods_id], () => {});
    对应事件:   EVENT_LOAD_PRODUCTS     返回类型:对象(key为:identifier,price,currencySymbol,currencyCode,downloadable,description,title)
    
    //  支付
    const const goodInfo = {'userInfo':{'orderID':'13djhha'}};  //该参数为对象,是与订单绑定的信息
    InAppUtils.purchaseProduct(order.apple_goods_id, goodInfo, () => {});
    对应事件:   EVENT_PURCHASE_PRODUCT  返回类型:对象(key为info{ 子对象key为:transactionDate,transactionIdentifier,productIdentifier,transactionReceipt,transationInfo })
    
    //  支付失败,用户取消支付等情况(正常支付情况下)
    对应事件:   EVENT_TRANSACTION_ERROR 返回类型 :对象【key为message(苹果服务器返回的错误提示信息,字符串),isUserCancel:BOOL(用户取消为true,其他情况为false),errorMessage:(字符串,具体错误的信息) ,info(我们绑定的信息,对象)】
    
    [注]:使用isUserCancel来判断是否是用户点击取消   message是苹果后台返回来的错误信息,什么情况下都返回的是无法连接 ituns store这条信息
    
        errorMessage所有信息情况如下: SKErrorUnknown                           未知的错误,您可能正在使用越狱手机
                                    SKErrorClientInvalid                    当前苹果账户无法购买商品(如有疑问,可以询问苹果客服)
                                    SKErrorPaymentCancelled                 订单已取消
                                    SKErrorPaymentInvalid                   订单无效(如有疑问,可以询问苹果客服)
                                    SKErrorPaymentNotAllowed                当前苹果设备无法购买商品(如有疑问,可以询问苹果客服
                                    SKErrorStoreProductNotAvailable         当前商品不可用
                                    others                                  未知错误

    //  支付进程杀死后点击取消等支付失败触发事件
    对应事件:   EVENT_SINGLE_USER_CANCEL  返回类型:数组(key为 isUserCancel:BOOL(用户取消为true,其他情况为false),errorMessage:(字符串,具体错误的信息) ,info(我们绑定的信息,对象))
     [注]:使用isUserCancel来判断是否是用户点击取消
        errorMessage所有信息情况如下: SKErrorUnknown                           未知的错误,您可能正在使用越狱手机
        SKErrorClientInvalid                    当前苹果账户无法购买商品(如有疑问,可以询问苹果客服)
        SKErrorPaymentCancelled                 订单已取消
        SKErrorPaymentInvalid                   订单无效(如有疑问,可以询问苹果客服)
        SKErrorPaymentNotAllowed                当前苹果设备无法购买商品(如有疑问,可以询问苹果客服
        SKErrorStoreProductNotAvailable         当前商品不可用
        others
    
    //  该商品不正确
    对应事件:   EVENT_INVALID_PRODUCT  返回类型:BOOL
    
    //  用户手动取消
    对应事件:   EVENT_USER_CANCELLED  返回类型:BOOL
    
    //  购买商品失败
    对应事件:   EVENT_RESTORE_FAILED  返回类型:BOOL
    
    //  商品信息错误 (苹果后台绑定的信息与服务端的商品号对应不上)
    对应事件:   EVENT_NOT_AVAILABLE  返回类型:BOOL