for React Native / Expo SDK v49
Oct 24, 2023·3 min read
by Anthony Coffey for React Native / Expo SDK v49


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/iOS, and is compatible with Expo SDK v49.

How did I do it?

It's based on a fork of react-native-reliantid-authorize-net, but I updated the native module code to implement the following changes:

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 exicting to successfully update the native modules to accomodate the desired changes, and I'm incredibly proud of my work on this package! I hope someone finds it useful!

This was a painful, but insightful and rewarding experience 🤣 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: any) => {
    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

(Please note, error handling is slightly different on each platform and must be handled accordingly as demonstrated above.)

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!

If you need help with this package, please contact me.