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

@primer-io/react-native

v2.41.0

Published

Primer SDK for RN

Downloads

3,160

Readme

Official React Native SDK plugin for Primer

Note: This quick start guide addresses the platform-specific integration points only. As everything prior to that (e.g. creating a client token) is the same for all the guidelines.

Set up the Universal Checkout

Step 1. Install the SDK

Add the SDK package.

\# With yarn
yarn add @primer-io/react-native

\# With npm
npm i @primer-io/react-native --save

Once you are done, navigate to the /ios folder and run pod install.

Step 2. Initialize the SDK

Import the Primer SDK, construct your settings and call the SDK’s configure function.

import * as React from 'react';
import {
  Primer,  
  PrimerSettings,
  PrimerCheckoutData
} from '@primer-io/react-native';

const CheckoutScreen = (props: any) => {

  const onCheckoutComplete = (checkoutData: PrimerCheckoutData) => {
    // Perform an action based on the payment creation response
    // ex. show success screen, redirect to order confirmation view, etc.
  };

  React.useEffect(() => {
    const settings: PrimerSettings = {
      onCheckoutComplete: onCheckoutComplete
    };

    Primer.configure(settings)
      .then(() => {
        // SDK is initialized sucessfully
      })
      .catch (err => {
        // SDK failed to initialize
      })
  }, []);
}

Step 3. Generate a client token

Note: Check our guide on how to set up the client session here.

Make an API call to your backend to fetch a Client Token. Here is a simple example of how it can be done from your component. Once successful store your Client Token for future use.

const CheckoutScreen = (props: any) => {

  // ...

  const onUniversalCheckoutButtonTapped = async () => {
    try {
      // Make an API request to your backend to create a client session
      // and fetch a client token.
      const clientToken = await createClientSession(clientSessionRequestParams);
    } catch (err) {
      // ...
    }
  };
}

Step 4. Show Universal Checkout

At this step, you should have a Client Token available. Call the showUniversalCheckout(clientToken) function, with the Client Token (as shown below) to present Universal Checkout.

const CheckoutScreen = (props: any) => {

  // ...

  const onUniversalCheckoutButtonTapped = async () => {
    try {
      // ...

      // Present Universal Checkout
      await Primer.showUniversalCheckout(clientToken);
    } catch (err) {
      // ...
    }
  };
}

Full Code Snippet

import * as React from 'react';
import {
  Primer,  
  PrimerSettings,
  PrimerCheckoutData
} from '@primer-io/react-native';

const CheckoutScreen = async (props: any) => {
  const onCheckoutComplete = (checkoutData: PrimerCheckoutData) => {
    // Show a success screen
  };
  
  const onUniversalCheckoutButtonTapped = async () => {
    const settings: PrimerSettings = {
      onCheckoutComplete: onCheckoutComplete
    };
    
    // Configure the SDK
    await Primer.configure(settings);
    
    // Ask your backend to create a client session
    const clientToken = await createClientSession(clientSessionRequestParams);
    
    // Present Universal Checkout
    await Primer.showUniversalCheckout(clientToken);
  };
}

You should now be able to see Universal Checkout! The user can now interact with Universal Checkout, and the SDK will create the payment. The payment’s data will be returned in the onCheckoutComplete callback configured in Step 2.

Note: For more info & help troubleshooting, check out our docs.

📚 License

Distributed under the MIT License. See LICENSE for more information.