React Native Expo Package for SDK v49

Apr 8, 2024·3 min read
by Anthony Coffey


Introducing my first published node package: react-native-expo-authorize-net! This package allows you to easily integrate into your React Native / Expo app. It works for both Android and iOS and is compatible with Expo SDK v49.

How did I do it?

It's a fork of react-native-reliantid-authorize-net. I updated the code to work with the latest Expo SDK and added the following features:

  • Work with Expo SDK v49 local development builds.
  • Promisify response in both native modules, thus allowing for a more modern approach that works for both platforms using a single syntax.
  • Improved error handling for both Android and iOS.

What have I learned?

This project challenged me to learn about building native modules for React Native. Also, I was able to get acquainted with some Java and Objective-C code in a React Native context! It was very exciting to successfully update the native modules to accommodate the desired changes, and I'm quite proud of my work on this package.

Now, I feel much more comfortable working with Native Modules and troubleshooting build errors on both platforms! 😎


import { NativeModules } from 'react-native';
const { RNAuthorizeNet } = NativeModules;

const isProduction = process.env.NODE_ENV === 'production'; // true | false
const cardValues = {
  CARD_NO: '4111111111111111',
  CVV_NO: '000',

RNAuthorizeNet.getTokenWithRequestForCard(cardValues, isProduction)
  .then(response => {
    example response:
  .catch((error) => {
    if (Platform.OS === 'ios') {
      const { code, message } = error;
      const alertMsg: string = `${message}\n\nError Code: ${code}`;
      Alert.alert('Error', alertMsg, [{ text: 'OK' }], {
        cancelable: false
    } else if (Platform.OS === 'android') {
      const { userInfo } = error;
      const { ERROR_TEXT, ERROR_CODE } = userInfo;
      const alertMsg: string = `${ERROR_TEXT}\n\nError Code: ${ERROR_CODE}`;
      Alert.alert('Error', alertMsg, [{ text: 'OK' }], {
        cancelable: false

As you can see, error handling is slightly different on each platform and must be handled accordingly as demonstrated above.


Please note, the Android module includes some code that requires minSdkVersion 21, but Expo allows us to configure this in app.json via expo-build-properties.

  "expo": {
    "plugins": [
          "android": {
            "minSdkVersion": 26
          "ios": {}

Now I have a working cross-platform integration for my React Native project, and that is truly a milestone worth celebrating! I hope someone else finds this package useful, too!