Stripe React Native Configuration - Tipsi Migration Guide, Part 2

Authors
Jakub Kłobus
Software Engineer
@
Callstack

If you have ever integrated payments with React Native, you may have encountered the popular community library “tipsi-stripe“. This project has been unmaintained for several years and the README now suggests migrating to the official Stripe React Native project.

To better support developers looking to migrate from “tipsi-stripe” to stripe-react-native, we’ve prepared The Stripe React Native Migration Guide to walk you through the core concepts and integration steps.

This article is the first part of the guide in which we go through the process of migrating from <rte-code>tipsi-stripe<rte-code> to <rte-code>stripe-react-native<rte-code>.

The guide is divided by 5 parts in which you'll learn about the following aspects of the migration process:

Part 1 - How to migrate from Tipsi Stripe to the Stripe React Native SDK
Part 2 - How to configure Stripe React Native (you are here)
Part 3 - A detailed description of Stripe React Native migration function by function
Part 4 - How not to break your app after migrating from Tipsi Stripe to Stripe React Native
Part 5 - A collection of the most common questions related to Stripe React Native

Introduction

<rte-code>Stripe-react-native<rte-code> is a new and official React Native library for Stripe payments. In this article, we will discuss how to start the migration process from the previous library - <rte-code>tipsi-stripe<rte-code>. In the previous article, we covered the main differences between these two libraries and showed why it is good to migrate from Tipsi to the stripe-react-native.

Adding a new library

The very first step is to remove the currently existing <rte-code>tipsi-stripe<rte-code> library. Unfortunately, there is no way to use both libraries at the same time because they use different versions of native libraries under the hood.

Start with opening your terminal and running the following:

npm install @stripe/stripe-react-native
view raw gistfile1.txt hosted with ❤ by GitHub

For yarn users:

yarn add @stripe/stripe-react-native
view raw gistfile1.txt hosted with ❤ by GitHub

A second step is to add a new dependency to your project:

npm uninstall tipsi-stripe
view raw gistfile1.txt hosted with ❤ by GitHub

For <rte-code>yarn<rte-code> users:

yarn remove tipsi-stripe
view raw gistfile1.txt hosted with ❤ by GitHub

IMPORTANT: Please be sure to first remove all tipsi-stripe dependencies from your project. tipsi-stripe uses older versions of stripe-android and stripe-ios which aren't compatible with stripe-react-native. After those two steps, in order to make a proper native setup, just run pod install in your ios/ directory for iOS or trigger a new build for Android.

Stripe configuration

<rte-code>Stripe-react-native<rte-code> provides two different ways of initializing the Stripe library. One of them is the <rte-code>initStripe<rte-code> function that you can simply import and use in the root component in <rte-code>useEffect<rte-code> hook. The second one is more elegant and allows you to just use the <rte-code>StripeProvider<rte-code> component and wrap your root component with it. We recommend using the second approach.

Below you can find an example of how to replace the <rte-code>stripe.setOptions()<rte-code> method from <rte-code>Tipsi<rte-code> with the <rte-code>StripeProvider<rte-code> component.

Before (tipsi-stripe):

import stripe from 'tipsi-stripe';
// ...
stripe.setOptions({
publishableKey: 'PUBLISHABLE_KEY',
merchantId: 'MERCHANT_ID', // Optional
androidPayMode: 'test', // Android only
});
view raw gistfile1.txt hosted with ❤ by GitHub

After (stripe-react-native):

import { StripeProvider } from '@stripe/stripe-react-native';
// ...
<StripeProvider
publishableKey="publishable_key"
merchantIdentifier="merchant.identifier"
>
// Your app code here
</StripeProvider>

What was once under the <rte-code>publishableKey<rte-code> field in Tipsi <rte-code>options<rte-code> object is now a <rte-code>publishableKey<rte-code> prop of the <rte-code>StripeProvider<rte-code> component. For a <rte-code>merchantId<rte-code> field, there is a merchantIdentifier prop. If you need to first get the <rte-code>publishableKey<rte-code> asynchronously, it is totally possible. You can easily replace <rte-code>StripeProvider's<rte-code> props after its first render. So, fetching the <rte-code>publishableKey<rte-code> in <rte-code>useEffect<rte-code> and storing it in state to change the prop of the provider component is totally fine.

The only bigger difference is the <rte-code>androidPayMode<rte-code> field. Migrating it is not that trivial like just changing the configuration object field into a component prop. Since this is only connected with Google Pay, we decided to move it to a different place. You can find it in Google Pay initialization instead of in the main Stripe init. The field you will have to use is <rte-code>testEnv<rte-code>.

After (stripe-react-native):

await initGooglePay({
testEnv: true,
// rest of initGooglePay attributes
});
view raw gistfile1.txt hosted with ❤ by GitHub

You probably noticed that it is a boolean value here and in Tipsi it was a string with <rte-code>test<rte-code> or <rte-code>production<rte-code> values. In <rte-code>stripe-react-native<rte-code> it should be true when in Tipsi it was <rte-code>test<rte-code>. For <rte-code>production<rte-code> in Tipsi you should set <rte-code>false<rte-code> in the current library.

Summary

Now you should be able to start using <rte-code>stripe-react-native<rte-code> library in your project. Unfortunately, the work is not done yet. The next step will be to replace your current payment methods like <rte-code>createPaymentMethod<rte-code> or <rte-code>authenticatePaymentIntent<rte-code> with its equivalents. We will cover all of those functions in the upcoming blog post in this series. Stay tuned!

Read more: If you would like to read more about the stripe-react-native library, check out the official docs, repository, and SDK reference.

Insights

Learn more about Open Source

cover

Aug 7Article

Visualizing Open Source Licenses to Analyze Compliance and Reduce Legal Risk

Discover how license-kit visualize maps and analyzes your dependency graph, helping you spot license issues, duplicates, and restrictive packages with interactive views, stats, and AI-powered summaries.

cover

Mar 26Podcast

How Definitely Typed Changed TypeScript Forever

Discover the story behind Definitely Typed with its creator, Boris Yankov, and learn how it became essential for type-safe JavaScript in the TypeScript ecosystem.

cover

Oct 14Article

Introducing the OMH Cloud Storage Module

Discover the OMH Cloud Storage Module. This open-source solution simplifies cloud storage integration for React Native apps.

cover

Jul 12Article

Introduction to the React Native OMH Maps Library

Discover how the React Native OMH Maps library simplifies map integration with cross-platform compatibility, ease of use, and customization options.

cover

Apr 22Podcast

Behind the Scenes of React Native 0.74 Release

Join the release crew members to find out what new features and improvements React Native 0.74 brings to the cross-platform development world.

cover

Apr 27Podcast

Callstack OSS Update

April 2023 Callstack OSS Update: RFC for Expo Config Plugins, Re.Pack & Paper news.

cover

Dec 6Article

React Native Paper 5.0 - What’s New?

React Native Paper 5.0 is here! Dive into the latest updates and improvements.

cover

Feb 8Article

Stripe React Native: the Most Common Questions - Tipsi Migration Guide, Part 5

Check out the list of the most common questions about Stripe react Native Library prepared by Jakub Kłobus, software engineer at Callstack.

cover

Feb 6Article

Stripe React Native Migration Function by Function - Tipsi Migration Guide, Part 3

In the third part of the Tipsi Migration Guide we describe the Stripe React Native migration function by function.

cover

Mar 19Tutorial

The Hard Way vs. The React Native AI SDK Way: Stop Writing Custom Modules for Every Model

Learn how React Native AI uses a unified provider model to switch between cloud and on-device LLMs without rewriting application logic, enabling reliable AI experiences online and offline.

cover

Mar 12Tutorial

Build Smarter Apps: Tool Calling & AI Orchestration Explained

Learn how on-device models in React Native can call tools, interact with external APIs, and return structured outputs you can use directly in application logic.

cover

Mar 5Tutorial

MLC LLM + React Native: On-Device AI Without the Pain

Learn how to run third-party on-device LLMs in React Native using MLC LLM. Choose your models, run them efficiently across platforms, and keep a unified JavaScript API with React Native AI.

cover

Feb 24Tutorial

Intelligent Fallbacks with Apple Intelligence in React Native

Learn how to use Apple’s built-in Foundation Models in React Native apps, reduce memory usage, and enable fast, fully on-device AI with React Native AI Apple.

cover

Feb 10Tutorial

What Is the React Native AI SDK? A Complete Intro & Quickstart

Learn why on-device AI matters for React Native apps, how local LLMs behave offline, and what problems React Native AI is designed to solve from day one.

cover

Jan 29Tutorial

Implementing an Android TurboModule with Kotlin

Learn how to implement a React Native TurboModule on Android, from the TypeScript spec and Codegen to the Kotlin implementation and package registration.

cover

Jan 19Tutorial

Working with Different Threads in Swift TurboModules

Learn how JavaScript, native module, background, and main threads interact in React Native TurboModules, and how to use GCD queues to run async work safely in Swift.

cover

Jan 9Tutorial

How to Add Type-Safe Constants to Swift TurboModules

Learn how to expose typed, immutable constants from a Swift TurboModule using Codegen, and get full end-to-end type safety between native and JavaScript.

cover

Dec 30Tutorial

Adding Event Emitters to Your TurboModule in Swift

Learn how to emit native events from a Swift TurboModule and subscribe to them in JavaScript, including proper memory management and Codegen integration.

Writing a Swift TurboModule in React Native

Dec 22Tutorial

Writing Your First TurboModule in Swift

Learn how to build a fully working TurboModule in Swift, integrate it with Codegen, and bridge it through Objective‑C inside an Expo app.