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

rn-braintree-one

v1.0.1

Published

This package provides latest iOS and Android Braintree SDK support for React Native.

Downloads

7

Readme

rn-braintree-one

This package provides latest iOS(v4) and Android(v3) Braintree SDK support for React Native.

Installation

npm install rn-braintree-one --save

Linking

RN >= 60 Will be linked automatically.

RN < 60 Please refer manual linking docs.

iOS

  • Open Podfile and add following line below platform :ios, '9.0'

    use_modular_headers!
  • Update

    pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
    pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

    to

    pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false
    pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec', :modular_headers => false

    And remove the following

    add_flipper_pods!
    post_install do |installer|
    flipper_post_install(installer)
    end

  • Remove the following lines from AppDelegate.m #if DEBUG
    #import <FlipperKit/FlipperClient.h>
    #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
    #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
    #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
    #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
    #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
    static void InitializeFlipper(UIApplication *application) {
    FlipperClient *client = [FlipperClient sharedClient];
    SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
    [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
    [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
    [client addPlugin:[FlipperKitReactPlugin new]];
    [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
    [client start];
    }
    #endif
    and
    #if DEBUG
    InitializeFlipper(application);
    #endif

  • This package uses Swift for which you need to add Swift file to your Xcode project.

    • Open your project in Xcode.
    • File → New → File… (or CMD+N)
    • Select Swift File
    • Name your file 'Swift' File.
    • In the Group dropdown, make sure to select the group 'Your App Name', not the project itself.
    • After you create the Swift file, you should be prompted to choose if you want to configure an Objective-C Bridging Header. Select “Create Bridging Header”.
    • This file is usually named YourProject-Bridging-Header.h. Don’t change this name manually, because Xcode configures the project with this exact filename.
    • Clean and Rebuild Project

Android

  • Update the minSdkVersion to atleast 21 in the app/build.gradle file

  • In project build.gradle
    Update

     dependencies {
         classpath("com.android.tools.build:gradle:3.5.4")  
         ...  
     }  

    And

     allprojects {  
     repositories {  
        mavenLocal()  
        maven {
           url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
            credentials {
              username 'braintree_team_sdk'
              password 'AKCp8jQcoDy2hxSWhDAUQKXLDPDx6NYRkqrgFLRc3qDrayg6rrCbJpsKKyMwaykVL8FWusJpp'
            }  
        }
       ...  
    }

Post Install

Run

    npm install  
    cd ios  
    pod install  

If not successful, refer Braintree docs

Usage

import RnBraintree from "rn-braintree-one";

// Initialize package
  RnBraintree.setup('your client Token')
  .then((res) => {
    console.log('Success in setup', res)
  })
  .catch((err) => {
    console.log('Error in setup', err)
  });

// Show Payment Screen (Android & iOS)

  RnBraintree.paymentRequest({
  bgColor: '#FF0000',
  tintColor: '#0000FF',
  amount: '20'
  })
  .then((res) => {
    console.log('Success in onPaymentPress', res)
  })
  .catch((err) => {
    console.log('Error in onPaymentPress', err)
  });
 
 // Card Tokenization
  RnBraintree.getCardNonce({
  cardholderName: 'Test User',
  number: '4111111111111111',
  expirationDate: '10/2020', // or "10/2020" or any valid date
  cvv: '400',
  shouldValidateCard : true // optional : Braintree checks for card validity if true
  })
  .then((res) => {
    console.log('Success in onCardPress', res)
  })
  .catch((err) => {
    console.log('Error in onCardPress', err)
  });

Why was this package created?

This package was created due to unavailability of a reliable Braintree package for latest Android and iOS SDK's. Google Play Store rejected our Android app for using old Braintree SDK version (2). If you also face this issue (Your app(s) are using an unsafe implementation of the HostnameVerifier interface), you can use this package.

Please let us know of your comments and feedback.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT