New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@olo/pay-react-native

Package Overview
Dependencies
Maintainers
6
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@olo/pay-react-native

Olo Pay React Native SDK

latest
Source
npmnpm
Version
7.0.2
Version published
Weekly downloads
700
22.81%
Maintainers
6
Weekly downloads
 
Created
Source

@olo/pay-react-native

Table Of Contents

About Olo Pay

Olo Pay is an E-commerce payment solution designed to help restaurants grow, protect, and support their digital ordering and delivery business. Olo Pay is specifically designed for digital restaurant ordering to address the challenges and concerns that weʼve heard from thousands of merchants.

About the React Native SDK

The Olo Pay React Native SDK allows partners to easily add PCI-compliant Apple Pay and Google Pay functionality to their checkout flow and seamlessly integrate with the Olo Ordering API. The SDK supports React Native's new architecture (Fabric)

Use of the plugin is subject to the terms of the Olo Pay SDK License.

For more information about integrating Olo Pay into your payment solutions, refer to our Olo Pay Dev Portal Documentation (Note: requires an Olo Developer account).

Installation

Important: If using Expo, be sure to eject or run npx expo prebuild prior to installation

Run the following command from a terminal in your app's root project directory

npm install @olo/pay-react-native

Android

Supported Versions

  • Minimum SDK Version:
    • The minimum supported Android SDK is API 24
    • The Android project's minSdkVersion must be set to 24 or higher
  • Refer to the changelog for other required versions (e.g. compile SDK version, gradle, etc)

iOS

Supported Versions

  • Minimum iOS Version:
    • The minimum supported version is iOS 14

In your app's Podfile:

  • Add the following lines at the top:
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/ololabs/podspecs.git'
  • Ensure that ios.deploymentTarget is set to at least 14.0

Open a terminal, navigate to your app's iOS folder (usually <projectName>/ios), and run the following command:

pod install

Updating From a Previous Version

Run the following command from a terminal in your app's root project directory

npm install @olo/pay-react-native@latest

iOS-Specific Update Steps

Open a terminal, navigate to your app's iOS folder (usually <projectName>/ios), and run the following commands:

rm -rf Pods
rm Podfile.lock
pod update

Note: If you run into errors after updating, delete both your Pods folder and Podfile.lock file and then run pod install.

[Back to Top]

Setup

Android

In order to use the PaymentCardDetailsView or PaymentCardDetailsForm components you need to install and configure Material Components theme in your app.

  • In your app/build.gradle add the dependency with a specific version
implementation 'com.google.android.material:material:<version>'
  • Set the appropriate style in your styles.xml file. You can use a full Material Components theme or a Bridge theme (which extends AppCompat):
<!-- Option 1: Full Material Components theme (recommended) -->
<style name="Theme.MyApp" parent="Theme.MaterialComponents.DayNight">
    <!-- ... -->
</style>

<!-- Option 2: Bridge theme (for apps migrating from AppCompat) -->
<style name="Theme.MyApp" parent="Theme.MaterialComponents.DayNight.Bridge">
    <!-- ... -->
</style>

iOS

Component Registration (Required)

In your app's AppDelegate.mm (or AppDelegate.swift), register the Olo Pay components before the app finishes launching.

Objective-C (AppDelegate.mm):

Add the following import and function call:

// At the top of AppDelegate.mm
extern "C" void registerOloPayComponents(void);

// In application:didFinishLaunchingWithOptions: before [super application:...]
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  registerOloPayComponents();
  // ... rest of your existing code
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

Swift (AppDelegate.swift):

Add a bridging header with the declaration, then call it:

// In your bridging header (e.g., YourApp-Bridging-Header.h)
void registerOloPayComponents(void);

// In AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  registerOloPayComponents()
  // ... rest of your existing code
  return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

[Back to Top]

Getting Started

A basic high-level overview of the steps needed to integrate the React Native SDK into your hybrid app is as follows:

Payment Methods (new cards & digital wallets)

This approach is used for cards that have not previously been saved on file with Olo. This includes new credit cards and digital wallets. With this approach both card input components and digital wallets return a PaymentMethod instance that is then used to submit a basket with Olo's Ordering API. Specific details can be found below.

CVV Tokens (previously saved cards)

This approach is used for cards that have previously been saved on file with Olo, and you want to reverify the CVV of the saved card prior to submitting a basket and processing a payment. The PaymentCardCvvView component will provide a CvvUpdateToken instance that is then used to submit a basket with Olo's Ordering API. Specific details can be found below.

[Back to Top]

Handling Promise Rejections

When calling functions on the Olo Pay React Native SDK, there is a chance that the call will fail with the promise being rejected. When this happens the returned error object will always contain code and message properties indicating why the method call was rejected.

For convenience, the SDK exports a OloErrorCode enum and a OloError type for handling promise rejection errors.

Example

try {
  const paymentMethodData = await createDigitalWalletPaymentMethod({ amount: 2.34 }});
  //Handle payment method data
} catch (error) {
  let rejection = error as OloError;
  if (rejection) {
    switch(rejection.code) {
      case OloErrorCode.missingParameter: {
          // Handle missing parameter scenario
          break;
      }
      case OloErrorCode.sdkUninitialized: {
          // Handle sdk not initialized scenario
          break;
      }
    }
  } else {
    // Some other error not related to a promise rejection
  }
}

[Back to Top]

Events

Events are used to send notifications regarding state changes that can't be completely handled by asynchronous method calls that return a promise. Details about each type of event can be found below.

DigitalWalletReadyEvent

You can subscribe to this event to know when digital wallets are ready to process payments. It can be referenced using the exported DigitalWalletReadyEvent constant or as a string with "digitalWalletReadyEvent". The event returns a DigitalWalletStatus object. Attempting to create a PaymentMethod via createDigitalWalletPaymentMethod when digital wallets are not in a ready state will result in errors.

This event is emitted whenever the readiness of digital wallets change. It can change as a result of calling certain methods on the SDK (e.g. initialize or updateDigitalWalletConfig) or due to changes in app state (e.g. app going in the background).

Important: This event can, and likely will, be emitted multiple times. It is recommended to keep this event listener active and update your UI accordingly whenever the app is displaying digital wallet UIs.

Example Code:

import { OloPayEvents, DigitalWalletReadyEvent } from '@olo/pay-react-native';

let subscription = OloPayEvents.addListener(
  DigitalWalletReadyEvent,
  (event: DigitalWalletStatus) => {
    // Handle event...
  }
);

// Don't forget to unsubscribe when you no longer need to 
// know if digital wallets are in a ready state
subscription.remove();

[Back to Top]

Components

Components are used to display credit card input fields in an app. Credit card details are not accessible by the developer, helping reduce the effort needed to maintain PCI compliance. Details about each component can be found below.

PaymentCardDetailsView

The PaymentCardDetailsView component displays all credit card input details in a single input field and is the most compressed way to display a credit card input view. It is composed of a root <View> component with two direct children, the credit card input view and a <Text> view for displaying error messages. Each piece of the component can be individually styled via componentStyles, cardStyles, and errorStyles (See PaymentCardDetailsViewProps)

PaymentCardDetailsViewProps

PaymentCardDetailsViewProps provides customization for the card component.

PropertyDescription
componentStylesOptions for styling the root <View> component
errorStylesOptions for styling the error <Text> component. Default style is { minHeight: 20 }
cardStylesOptions for styling credit card input portion of the component. (See PaymentCardDetailsViewStyles)
viewPropsReact Native view properties for the root <View> component
customErrorMessagesOptions for defining custom error messages in place of defaults (See CustomErrorMessages)
postalCodeEnabledWhether or not the postal code should be displayed
disabledWhether or not the component is disabled and cannot receive touch and input events
displayErrorMessagesWhether or not the component should display error messages. Set to false if you have a custom mechanism for displaying error messages
placeholdersOptions for specifying placeholder text. (See PaymentCardDetailsPlaceholders)
onCardChange(card: CardDetails)Callback called when card input changes. (See CardDetails)
onFocus()Callback called when the component receives input focus
onBlur()Callback called when the component loses input focus
onFocusField(field: CardField)Callback called each time focus moves to a new card input field within the component. (See CardField)
onPaymentMethodResult(result: PaymentMethodResult)Callback called when payment method creation completes (See PaymentMethodResult)

{ componentStyles?: StyleProp<ViewStyle>; errorStyles?: StyleProp<TextStyle>; cardStyles?: PaymentCardDetailsViewStyles; viewProps?: ViewProps; postalCodeEnabled?: boolean; disabled?: boolean; displayErrorMessages?: boolean; placeholders?: PaymentCardDetailsPlaceholders; onCardChange?(card: CardDetails): void; onFocus?(): void; onBlur?(): void; onFocusField?(field: CardField): void; customErrorMessages?: CustomErrorMessages; onPaymentMethodResult?(result: PaymentMethodResult): void; }

Important: Card field text and error message text have separate styling mechanisms. If the default error colors are changed, it is important to change both of them. An example is provided below:

<PaymentCardDetailsView
  cardStyles={{ errorTextColor: "#00ff00" }}
  errorStyles={{ color: "#00ff00" }}
/>

PaymentCardDetailsViewMethods

PaymentCardDetailsViewMethods defines the native methods that can be called on the PaymentCardDetailsView component. These methods can be accessed by passing a ref prop of this type into the component, and then calling them on the ref. See the PaymentCardDetailsView example code below for details.

focus()

focus(field?: CardField) => void

Puts focus on the PaymentCardDetailsView component and displays the keyboard. If a CardField is passed in, focus will attempt to be given to that field. If no field is passed in, it defaults to CardField.number.

blur()

blur() => void

Clears focus on the PaymentCardDetailsView component and hides the keyboard.

clear()

clear() => void

Clears all card details entered in the PaymentCardDetailsView component and moves focus to the CardField.number field.

createPaymentMethod()

createPaymentMethod() => void

Attempts to create a payment method based on the entered card details. Results are delivered via the onPaymentMethodResult callback:

PaymentCardDetailsView Example

import {
  PaymentCardDetailsView,
  PaymentCardDetailsViewMethods,
  PaymentMethodResult,
} from '@olo/pay-react-native';
import { View, Button } from 'react-native';
import { useRef } from 'react';

export default function MyComponent() {
  const cardRef = useRef<PaymentCardDetailsViewMethods>(null);

  const handlePaymentMethodResult = (result: PaymentMethodResult) => {
    if (result.error) {
      // Handle the error
      console.error(result.error.message);
      return;
    }

    // Use the payment method to submit a basket using Olo's ordering API
    const paymentMethod = result.paymentMethod!;
    // Submit payment with paymentMethod.id
  };

  const createPaymentMethod = () => {
    cardRef.current?.createPaymentMethod();
  };

  // Styling omitted for sake of example simplicity
  return (
    <View>
      <PaymentCardDetailsView
        displayErrorMessages={true}
        ref={cardRef}
        onPaymentMethodResult={handlePaymentMethodResult}
      />
      <Button title="Submit Payment" onPress={createPaymentMethod} />
    </View>
  );
}

PaymentCardDetailsForm

The PaymentCardDetailsForm component displays all credit card input details in a multi-line form and is the most visible way to display a credit card input view. It is composed of a root <View> component with a single nested child, the credit card input form. Each piece of the component can be individually styled via componentStyles and cardStyles (See PaymentCardDetailsFormProps)

PaymentCardDetailsFormProps

PaymentCardDetailsFormProps provides additional properties defined in the following table

PropertyDescription
componentStylesOptions for styling the root <View>
cardStylesOptions for styling credit card input portion of the component. (See PaymentCardDetailsFormStyles)
disabledWhether or not the component is disabled and cannot receive touch and input events
onFormComplete()Callback called when all card fields have been filled out. (See CardValidationStatus)
viewPropsReact Native view properties for the root <View> component
placeholdersOptions for specifying placeholder text. (See PaymentCardDetailsPlaceholders)
onPaymentMethodResult(result: PaymentMethodResult)Callback called when payment method creation completes (See PaymentMethodResult)

{ cardStyles?: PaymentCardDetailsFormStyles; componentStyles?: StyleProp<ViewStyle>; disabled?: boolean; onFormComplete?(cardValidationStatus: CardValidationStatus): void; viewProps?: ViewProps; placeholders?: PaymentCardDetailsPlaceholders; onPaymentMethodResult?(result: PaymentMethodResult): void; }

PaymentCardDetailsFormMethods

PaymentCardDetailsFormMethods defines the native methods that can be called on the PaymentCardDetailsForm component. These methods can be accessed by passing a ref prop of this type into the component, and then calling them on the ref. See the PaymentCardDetailsForm example code below for details.

focus()

focus(field?: CardField) => void

Puts focus on the PaymentCardDetailsForm component and displays the keyboard. If a CardField is passed in, focus will attempt to be given to that field. If no field is passed in, it defaults to CardField.number.

blur()

blur() => void

Clears focus on the PaymentCardDetailsForm component and hides the keyboard.

clear()

clear() => void

Clears all card details entered in the PaymentCardDetailsForm component and moves focus to the CardField.number field.

createPaymentMethod()

createPaymentMethod() => void

Attempts to create a payment method based on the entered card details. Results are delivered via the onPaymentMethodResult callback:

PaymentCardDetailsForm Example

import {
  PaymentCardDetailsForm,
  PaymentCardDetailsFormMethods,
  PaymentMethodResult,
} from "@olo/pay-react-native";
import { View, Button } from "react-native";
import { useRef } from "react";

export default function MyComponent() {
  const cardRef = useRef<PaymentCardDetailsFormMethods>(null);

  const handlePaymentMethodResult = (result: PaymentMethodResult) => {
    if (result.error) {
      // Handle the error
      console.error(result.error.message);
      return;
    }

    // Use the payment method to submit a basket using Olo's ordering API
    const paymentMethod = result.paymentMethod!;
    // Submit payment with paymentMethod.id
  };

  const createPaymentMethod = () => {
    cardRef.current?.createPaymentMethod();
  };

  // Styling omitted for sake of example simplicity
  return (
    <View>
      <PaymentCardDetailsForm
        ref={cardRef}
        onPaymentMethodResult={handlePaymentMethodResult}
      />
      <Button
        title="Submit Payment"
        onPress={createPaymentMethod}
      />
    </View>
  );
};

PaymentCardCvvView

The PaymentCardCvvView component displays a single input for a credit card's Card Verification Value (CVV). This is useful to reverify a credit card that has previously been saved with Olo. It is composed of a root <View> component with two nested children, the CVV code input and a <Text> component for displaying error messages. Each piece of the component can be individually styled via componentStyles and cvvStyles (See PaymentCardCvvViewProps)

PaymentCardCvvViewProps

PropertyDescription
componentStylesOptions for styling the root <View> component
customErrorMessagesOption for defining custom error messages in place of defaults (See CustomFieldError)
cvvStylesOptions for styling security code input portion of the component. (See PaymentCardCvvViewStyles)
displayErrorMessagesWhether or not the component should display error messages. Set to false if you have a custom mechanism for displaying error messages
errorStylesOptions for styling the error <Text> component. Default style is { minHeight: 20 }
disabledWhether or not the component is disabled and cannot receive touch and input events
onBlur(cvvDetails: CvvDetails)Callback called when the component loses input focus (See CvvDetails)
onCvvChange(cvvDetails: CvvDetails)Callback called when card input changes. (See CvvDetails)
onFocus(cvvDetails: CvvDetails)Callback called when the component receives input focus (See CvvDetails)
placeholderPlaceholder text for the CVV input field
viewPropsReact Native view properties for the root <View> component
onCvvTokenResult(result: CvvTokenResult)Callback called when CVV update token creation completes (See CvvTokenResult)

{ componentStyles?: StyleProp<ViewStyle>; customErrorMessages?: CustomFieldError; cvvStyles?: StyleProp<ViewStyle>; displayErrorMessages?: boolean; errorStyles?: StyleProp<ViewStyle>; disabled?: boolean: onBlur(details: CvvDetails)?: void; onCvvChange(details: CvvDetails)?: void; onFocus(details: CvvDetails)?: void; placeholder?: string; viewProps?: ViewProps; onCvvTokenResult?(result: CvvTokenResult): void; }

Important: CVV field text and error message text have separate styling mechanisms. If the default error colors are changed, it is important to change both of them. An example is provided below:

<PaymentCardCvvView
  cvvStyles={{ errorTextColor: "#00ff00" }}
  errorStyles={{ color: "#00ff00" }}
/>

PaymentCardCvvViewMethods

PaymentCardCvvViewMethods defines the native methods that can be called on the PaymentCardCvvView component. These methods can be accessed by adding a ref prop of this type into the component, and then calling them on the ref. See the PaymentCardCvvView example code below for details.

focus()

focus() => void

Puts focus on the PaymentCardCvvView component and displays the keyboard.

blur()

blur() => void

Clears focus on the PaymentCardCvvView component and hides the keyboard.

clear()

clear() => void

Clears all security code details entered in the PaymentCardCvvView component.

createCvvUpdateToken()

createCvvUpdateToken() => void

Attempts to create a CVV update token based on the entered security code details. Results are delivered via the onCvvTokenResult callback:

PaymentCardCvvView Example

import {
  PaymentCardCvvView,
  PaymentCardCvvViewMethods,
  CvvTokenResult,
} from '@olo/pay-react-native';
import { View, Button } from 'react-native';
import { useRef } from 'react';

export default function MyComponent() {
  const cvvRef = useRef<PaymentCardCvvViewMethods>(null);

  const handleCvvTokenResult = (result: CvvTokenResult) => {
    if (result.error) {
      // Handle the error
      console.error(result.error.message);
      return;
    }

    // Use the CVV update token for revalidating a stored credit card
    const cvvToken = result.token!;
    // Submit with cvvToken.id
  };

  const createCvvUpdateToken = () => {
    cvvRef.current?.createCvvUpdateToken();
  };

  // Styling omitted for sake of example simplicity
  return (
    <View>
      <PaymentCardCvvView
        displayErrorMessages={true}
        ref={cvvRef}
        onCvvTokenResult={handleCvvTokenResult}
      />
      <Button title="Submit CVV" onPress={createCvvUpdateToken} />
    </View>
  );
}

DigitalWalletButton

A button that renders a native Apple Pay button on iOS and a native Google Pay button on Android.

DigitalWalletButtonProps

PropertyDescription
applePayConfigOptions for customizing the button for Apple Pay on iOS (See ApplePayButtonConfig)
googlePayConfigOptions for customizing the button for Google Pay on Android (See GooglePayButtonConfig)
stylesOptions for styling the button. Default styles provide a minimum height of 40 on Android and 30 on iOS
disabledWhether or not the component is disabled and cannot receive touch events
onPress()Callback called when the button is pressed

{ applePayConfig?: ApplePayButtonConfig; googlePayConfig?: GooglePayButtonConfig; disabled?: boolean; onPress(): void; styles?: StyleProp<ViewStyle>; }

DigitalWalletButton Example

import {
  ApplePayButtonStyle,
  ApplePayButtonType,
  DigitalWalletButton,
  GooglePayButtonTheme,
  GooglePayButtonType,
  OloPaySDK
} from '@olo/pay-react-native';

export default function MyComponent() {
  const createDigitalWalletPaymentMethod = async () => {
    try {
      let result = await OloPaySDK.createDigitalWalletPaymentMethod();
      // Use result.paymentMethod method to submit a basket using Olo's ordering API
      // or result.error to handle additional error scenarios
    } catch (error) {
      // Handle the promise rejection
    }
  };

  // Styling omitted for sake of example simplicity
  return (
    <DigitalWalletButton
      onPress={createDigitalWalletPaymentMethod}
      googlePayConfig={{
        theme: GooglePayButtonTheme.dark,
        type: GooglePayButtonType.checkout,
        cornerRadius: 8,
      }}
      applePayConfig={{
        style: ApplePayButtonStyle.black,
        type: ApplePayButtonType.checkout,
        cornerRadius: 8,
      }}
    />
  );
}

[Back to Top]

OloPaySDK Module

Native SDK methods can be called on the imported OloPaySDK object. This module is responsible for initializing the Olo Pay SDK and processing digital wallet payments.

import { OloPaySDK } from '@olo/pay-react-native';

Methods

initialize(...)

initialize(productionEnvironment: boolean, digitalWalletConfig?: DigitalWalletConfig | undefined) => Promise<void>

Initialize the Olo Pay SDK and, optionally, configure and initialize digital wallets. The SDK must be initialized prior to calling other methods. Calling this method will ensure that the Olo Pay SDK is initialized. If a DigitalWalletConfig is provided, when digital wallets become ready, a DigitalWalletReadyEvent will be emitted. If digital wallets are not configured and initialized here, this can be done later by calling updateDigitalWalletConfig.

Important: The Olo Pay SDK is guaranteed to be initialized even if the promise is rejected. Promise rejections will only occur due to an error while initializing digital wallets, which happens after successful SDK initialization.

If the promise is rejected, the code property of the returned error object will be one of:

ParamTypeDescription
productionEnvironmentbooleantrue to use the production environment, false for the test environment
digitalWalletConfigDigitalWalletConfigInitialization options for digital wallets

updateDigitalWalletConfig(...)

updateDigitalWalletConfig(digitalWalletConfig: DigitalWalletConfig) => Promise<void>

Update the configuration settings for digital wallets.

This can be used to change configuration parameters for digital wallets. Calling this method will immediately invalidate digital wallet readiness and will cause a DigitalWalletReadyEvent to be emitted with a value of false. Once the new configuration is ready to be used, the DigitalWalletReadyEvent will be triggered again with a value of true.

Note: This method can also be used to initialize digital wallets if they were not initialized as part of SDK initialization (see initialize).

If the promise is rejected, the code property of the returned error object will be one of:

ParamTypeDescription
digitalWalletConfigDigitalWalletConfigThe new configuration settings for digital wallets. See DigitalWalletConfig for more details.

createDigitalWalletPaymentMethod(...)

createDigitalWalletPaymentMethod(options: DigitalWalletPaymentRequestOptions) => Promise<DigitalWalletPaymentMethodResult>

Launch the digital wallet flow and generate a payment method to be used with Olo's Ordering API.

If the promise is rejected, the code property of the returned error object will be one of:

try {
  const { paymentMethod } = await createDigitalWalletPaymentMethod({ amount: 5.00 });
  if (paymentMethod === undefined) {
    // User canceled the digital wallet flow
  } else {
    // Send paymentMethod to Olo's Ordering API
  }
} catch (error) {
  // Handle error
}
ParamTypeDescription
optionsDigitalWalletPaymentRequestOptionsOptions for processing a digital wallet payment.

Returns: Promise<DigitalWalletPaymentMethodResult>

isInitialized()

isInitialized() => Promise<InitializationStatus>

Check if the Olo Pay SDK has been initialized

Returns: Promise<InitializationStatus>

isDigitalWalletInitialized()

isDigitalWalletInitialized() => Promise<InitializationStatus>

Check if digital wallets have been initialized. On iOS, digital wallets are initialized when the SDK is initialized, so this method will behave the same as isInitialized(). On Android, a separate call to initializeGooglePay() is required to initialize digital wallets.

Returns: Promise<InitializationStatus>

isDigitalWalletReady()

isDigitalWalletReady() => Promise<DigitalWalletStatus>

Check if digital wallets are ready to be used. Events are emitted whenever the digital wallet status changes, so listenting to that event can be used instead of calling this method, if desired.

Returns: Promise<DigitalWalletStatus>

Type Aliases

DigitalWalletConfig

Options for intializing digital wallets

PropertyDescriptionDefault
countryCodeA two character country code for the vendor that will be processing the payment'US'
currencyCodeCurrency code to be used for transactionsCurrencyCode</a>.usd
companyLabelThe company display name-
emailRequiredWhether an email will be collected and returned when processing transactionsfalse
fullNameRequiredWhether a full name will be collected and returned when processing transactionsfalse
fullBillingAddressRequiredWhether a full billing address will be collected and returned when processing transactionsfalse
phoneNumberRequiredWhether a phone number will be collected and returned when processing transactionsfalse
initializeApplePayWhether Apple Pay should be initialized.-
initializeGooglePayWhether Google Pay should be initialized.-
applePayConfigConfiguration options for initializing Apple Pay. Required if initializeApplePay is true-
googlePayConfigConfiguration options for initializing Google Pay. Required if initializeGooglePay is true-

Note: If Apple Pay or Google Pay were previously initialized and the respective initialize property (initializeApplePay or initializeGooglePay) is set to false, this will not uninitialize digital wallets and will result in a no-op.

{ companyLabel: string; countryCode?: string; currencyCode?: CurrencyCode; emailRequired?: boolean; phoneNumberRequired?: boolean; fullNameRequired?: boolean; fullBillingAddressRequired?: boolean; initializeApplePay: boolean; initializeGooglePay: boolean; applePayConfig?: ApplePayConfig; googlePayConfig?: GooglePayConfig; }

CurrencyCode

Type alias representing currency codes supported by Olo Pay.

'USD' | 'CAD'

ApplePayConfig

Options for initializing Apple Pay

PropertyDescriptionDefault
fullPhoneticNameRequiredWhether a full phonetic name will be collected and returned when processing transactionsfalse
merchantIdThe merchant id registered with Apple for Apple Pay-

{ fullPhoneticNameRequired?: boolean; merchantId: string; }

GooglePayConfig

Options for intializing Google Pay

PropertyDescriptionDefault
productionEnvironmentWhether Google Pay will use the production environmenttrue
existingPaymentMethodRequiredWhether an existing saved payment method is required for Google Pay to be considered readyfalse
currencyMultiplierMultiplier to convert the amount to the currency's smallest unit (e.g. $2.34 * 100 = 234 cents)100

{ productionEnvironment?: boolean; existingPaymentMethodRequired?: boolean; currencyMultiplier?: number; }

DigitalWalletPaymentMethodResult

Type alias representing a digital wallet payment method result.

PropertyDescription
paymentMethodThe payment method generated by the digital wallet flow, or undefined if the user canceled the flow

{ paymentMethod?: PaymentMethod; }

PaymentMethod

Payment method used for submitting payments to Olo's Ordering API

PropertyDescription
idThe payment method id. This should be set to the token field when submitting a basket
last4The last four digits of the card
cardTypeThe issuer of the card
expMonthTwo-digit number representing the card's expiration month
expYearFour-digit number representing the card's expiration year
postalCodeZip or postal code. Will always have the same value as billingAddress.postalCode
countryCodeTwo character country code. Will always have the same value as billingAddress.countryCode
isDigitalWallettrue if this payment method was created by digital wallets (e.g. Apple Pay or Google Pay), false otherwise
productionEnvironmenttrue if this payment method was created in the production environment, false otherwise
emailThe email address associated with the transaction, or an empty string if unavailable. Only provided for digital wallet payment methods (see isDigitalWallet)
digitalWalletCardDescriptionThe description of the card, as provided by Apple or Google. Only provided for digital wallet payment methods (see isDigitalWallet)
billingAddressThe billing address associated with the transaction. The country code and postal code fields will always have a non-empty value. Other fields will only have non-empty values for digital wallet payment methods (see isDigitalWallet)
fullNameThe full name associated with the transaction. Will only have a non-empty value for digital wallet payment methods (see isDigitalWallet)
fullPhoneticNameThe full phonetic name associated with the transaction. Will only have a non-empty value for digital wallet payment methods (see isDigitalWallet) (iOS only)

{ id: string; last4: string; cardType: CardType; expMonth: number; expYear: number; postalCode: string; countryCode: string; isDigitalWallet: boolean; productionEnvironment: boolean; email: string; digitalWalletCardDescription: string; billingAddress: Address; fullName: string; fullPhoneticName: string; phoneNumber: string; }

Address

Represents an address. Currently only used for digital wallets, if billing address details are requested to be returned in the generated digital wallet payment method.

PropertyDescription
address1The first line of the address
address2The second line of the address, or an empty string
address3The third line of the address, or an empty string
postalCodeThe postal or zip code
countryCodeThe two digit ISO country code
administrativeAreaA country subdivision, such as a state or province

{ address1: string; address2: string; address3: string; locality: string; postalCode: string; countryCode: string; administrativeArea: string; }

DigitalWalletPaymentRequestOptions

Type alias representing options for a digital wallet payment method request

GooglePayPaymentRequestOptions | ApplePayPaymentRequestOptions

GooglePayPaymentRequestOptions

Options for requesting a payment method via Google Pay

PropertyDescriptionDefault
amountThe amount to be charged-
checkoutStatusThe checkout status to be used for the transactionFinalImmediatePurchase
totalPriceLabelA custom value to override the default total price label in the Google Pay sheet-
lineItemsA list of line items to be displayed in the digital wallet payment sheet-
validateLineItemsWhether or not to validate the line items. If true, createDigitalWalletPaymentMethod will throw an exception if the sum of the line items does not equal the total amount passed in. If no line items are provided, this parameter is ignored.true

{ amount: number; checkoutStatus?: GooglePayCheckoutStatus; totalPriceLabel?: string; lineItems?: LineItem[]; validateLineItems?: boolean; }

LineItem

Represents a line item in a digital wallet transaction

PropertyDescription
labelThe label of the line item
amountThe amount of the line item
typeEnum representing the type of a line item in a digital wallet transaction
statusEnum representing the status of a line item. If not provided, default value is LineItemStatus.final

{ label: string; amount: number; type: LineItemType; status?: LineItemStatus; }

ApplePayPaymentRequestOptions

Options for requesting a payment method via Apple Pay

PropertyDescriptionDefault
amountThe amount to be charged-
lineItemsA list of line items to be displayed in the digital wallet payment sheet-
validateLineItemsWhether or not to validate the line items. If true, createDigitalWalletPaymentMethod will throw an exception if the sum of the line items does not equal the total amount passed in. If no line items are provided, this parameter is ignored.true

{ amount: number; lineItems?: LineItem[]; validateLineItems?: boolean; }

InitializationStatus

Represents the status for SDK initialization

PropertyDescription
isInitializedtrue if the SDK is initialized, false otherwise

{ isInitialized: boolean; }

DigitalWalletStatus

Represents the status of digital wallets.

PropertyDescription
isReadytrue if digital wallets are ready to be used, false otherwise

{ isReady: boolean; }

Enums

CardType

MembersValueDescription
visa'Visa'Visa credit card type. Pass the string value of this into the Olo Ordering API when submitting orders
amex'Amex'American Express credit card type. Pass the string value of this into the Olo Ordering API when submitting orders
mastercard'Mastercard'Mastercard credit card type. Pass the string value of this into the Olo Ordering API when submitting orders
discover'Discover'Discover credit card type. Pass the string value of this into the Olo Ordering API when submitting orders
unsupported'Unsupported'Unsupported credit card type. Passing this to the Olo Ordering API will result in an error
unknown'Unknown'Unknown credit card type. Passing this to the Olo Ordering API will result in an error

GooglePayCheckoutStatus

MembersValueDescription
estimatedDefault'EstimatedDefault'Represents an estimated price (meaning it's not final and could change) and the default checkout option. The confirmation button will display "Continue".
finalDefault'FinalDefault'Represents the final price of the transaction and the default checkout option. The confirmation button will display "Continue".
finalImmediatePurchase'FinalImmediatePurchase'Represents the final price of the transaction and the immediate checkout option. The confirmation button will display "Pay Now".

LineItemType

MembersValueDescription
subtotal'Subtotal'Represents a subtotal line item in a digital wallet transaction
lineItem'LineItem'Represents a line item in a digital wallet transaction
tax'Tax'Represents a tax line item in a digital wallet transaction

LineItemStatus

MembersValueDescription
final'Final'Indicates that the price is final and has no variance
pending'Pending'Indicates that the price is pending and may change. On iOS this will cause the amount to appear as an elipsis ("...")

OloErrorCode

MembersValueDescription
apiError'ApiError'A general-purpose API error occurred
applePayEmptyMerchantId'ApplePayEmptyMerchantId'The merchantId was empty when initializing Apple Pay (iOS Only)
applePayError'ApplePayError'There was an error with Apple Pay (iOS Only)
applePayTimeout'ApplePayTimeout'A timeout occurred while attempting to process an Apple Pay transaction (iOS Only)
applePayUnsupported'ApplePayUnsupported'The device doesn't support Apple Pay (iOS Only)
authenticationError'AuthenticationError'An authentication issue occurred with the server
cancellationError'CancellationError'The operation was cancelled by the server
cardDeclined'CardDeclined'The card was declined
connectionError'ConnectionError'An issue occurred connecting to the server
digitalWalletNotReady'DigitalWalletNotReady'Digital wallets were not ready when attempting an action
digitalWalletUninitialized'DigitalWalletUninitialized'Digital wallets were uninitialized when attempting an action
emptyCompanyLabel'EmptyCompanyLabel'The value for the company label was empty
expiredCard'ExpiredCard'The card is expired
generalError'GeneralError'A general-purpose error occurred
googlePayDeveloperError'GooglePayDeveloperError'A developer error occurred, usually due to malformed configuration (Android Only)
googlePayInternalError'GooglePayInternalError'An internal Google error occurred (Android Only)
googlePayInvalidSetup'GooglePayInvalidSetup'Missing com.google.android.gms.wallet.api.enabled in AndroidManifest (Android Only)
googlePayNetworkError'GooglePayNetworkError'A network error occurred with Google's servers (Android Only)
invalidCardDetails'InvalidCardDetails'The card details are invalid
invalidCountryCode'InvalidCountryCode'The country code is not supported by Olo Pay (US or Canada)
invalidCVV'InvalidCVV'The card security code is invalid or incomplete
invalidExpiration'InvalidExpiration'The card's expiration date is invalid
invalidNumber'InvalidNumber'The card's number is invalid
invalidParameter'InvalidParameter'Promise rejected due to an invalid parameter
invalidPostalCode'InvalidPostalCode'The card's zip code is invalid or incorrect
invalidRequest'InvalidRequest'A request to servers has invalid parameters
lineItemsTotalMismatch'LineItemsTotalMismatch'The amount total did not match the sum of the line items
missingParameter'MissingParameter'A required parameter is missing
processingError'ProcessingError'An error occurred while processing the card info
sdkUninitialized'SdkUninitialized'The SDK isn't initialized yet
unexpectedError'UnexpectedError'An unexpected error occurred
unknownCard'UnknownCard'An unknown or unaccounted-for card error occurred
viewNotFound'ViewNotFound'The native view associated with the component could not be found

CardField

Represents the different input fields of the PaymentCardDetailsView and PaymentCardDetailsForm components

PropertyValueDescription
number'number'Credit card number field
expiration'expiration'Credit card expiration field
cvv'cvv'Credit card security code field
postalCode'postalCode'Credit card postal code field

FontWeight

Options for determining the weight of the font.

PropertyDescription
ultraLightUltra light font weight. Corresponds to a value of 100
thinThin font weight. Corresponds to a value of 200
lightLight font weight. Corresponds to a value of 300
regularRegular font weight. This is the default in most cases. Corresponds to a value of 400
mediumMedium font weight. Corresponds to a value of 500
semiBoldSemi Bold font weight. Corresponds to a value of 600
boldBold font weight. Corresponds to a value of 700
extraBoldExtra bold font weight. Corresponds to a value of 800
blackHeaviest font weight. Corresponds to a value of 900

ApplePayButtonStyle

Options representing different visual styles available for Apple Pay when used with a DigitalWalletButton. Values map directly to Apple's PKPaymentButtonStyle.

Some values are only available on specific versions of iOS. If an unsupported value is used, it will default to black

PropertyLimitationsDescription
automaticiOS 14+A button that automatically switches between light mode and dark mode
blackA black button with white lettering
whiteA white button with black lettering
whiteOutlineA white button with black lettering and a black outline

ApplePayButtonType

Options representing different types of Apple Pay buttons that can be displayed with a DigitalWalletButton. Values map directly to Apple's PKPaymentButtonType.

Some values are only available on specific versions of iOS. If an unsupported value is used, it will default to checkout

PropertyLimitationsDescription
addMoneyiOS 14+A button that uses the phrase "Add Money with" in conjunction with the Apple Pay logo
bookA button that uses the phrase "Book with" in conjunction with the Apple Pay logo
buyA button that uses the phrase "Buy with" in conjunction with the Apple Pay logo
checkoutA button that uses the phrase "Checkout with" in conjunction with the Apple Pay logo
continueiOS 15+A button that uses the phrase "Continue with" in conjunction with the Apple Pay logo
contributeiOS 14+A button that uses the phrase "Contribute with" in conjunction with the Apple Pay logo
donateA button that uses the phrase "Donate with" in conjunction with the Apple Pay logo
inStoreA button that uses the phrase "Pay with" in conjunction with the Apple Pay logo
orderiOS 14+A button that uses the phrase "Order with" in conjunction with the Apple Pay logo
plainA button with the Apple Pay logo only
payA button that uses the phrase "Pay with" in conjunction with the Apple Pay logo. Equivalent to inStore
reloadiOS 14+A button that uses the phrase "Reload with" in conjunction with the Apple Pay logo
rentiOS 14+A button that uses the phrase "Rent with" in conjunction with the Apple Pay logo
setUpA button that uses the phrase "Set up with" in conjunction with the Apple Pay logo
subscribeA button that uses the phrase "Subscribe with" in conjunction with the Apple Pay logo
supportiOS 14+A button that uses the phrase "Support with" in conjunction with the Apple Pay logo
tipiOS 14+A button that uses the phrase "Tip with" in conjunction with the Apple Pay logo
topUpiOS 14+A button that uses the phrase "Top up with" in conjunction with the Apple Pay logo

GooglePayButtonTheme

Options representing different visual styles available for Apple Pay when used with a DigitalWalletButton. Values map directly to Google's ButtonTheme

PropertyDescription
darkA dark-themed button
lightA light-themed button

GooglePayButtonType

Options representing different types of Google Pay buttons that can be displayed with a DigitalWalletButton. Values map directly to Google's ButtonType

PropertyDescription
bookA button that uses the phrase "Book with" in conjunction with the Google Pay logo
buyA button that uses the phrase "Buy with" in conjunction with the Google Pay logo
checkoutA button that uses the phrase "Checkout with" in conjunction with the Google Pay logo
donateA button that uses the phrase "Donate with" in conjunction with the Google Pay logo
orderA button that uses the phrase "Order with" in conjunction with the Google Pay logo
payA button that uses the phrase "Pay with" in conjunction with the Google Pay logo.
plainA button with the Google Pay logo only
subscribeA button that uses the phrase "Subscribe with" in conjunction with the Google Pay logo

Additional Type Aliases

OloError

When a promise is rejected, the error object returned is guaranteed to have these properties to understand what went wrong. There may be additional properties on the object, but code and message will always be available.

PropertyDescription
codeThe code to indicate why the promise was rejected
messageA message providing more context about why the promise was rejected. e.g. If the code is missingParameter the message will indicate which parameter is missing

PaymentCardDetailsPlaceholders

Options for specifying placeholder values for each credit card input field

PropertyDescription
numberThe placeholder value for the credit card number field
expirationThe placeholder value for the credit card expiration field
cvvThe placeholder value for the credit card cvv field
postalCodeThe placeholder value for the credit card postal code field

{ number?: string; expiration?: string; cvv?: string; postalCode?: string }

PaymentCardDetailsViewStyles

Options for styling the PaymentCardDetailsView component. All colors should be specified in hex format.

PropertyDescription
stylesReact Native styles for this view. Default is { minHeight: 50 }
borderWidthThe width of the card view's border
borderColorThe color of the card view's border
cornerRadiusThe corner radius of the card view's border
backgroundColorThe background color for the card view (Android Only: Requires API 27+)
textColorThe text color for user-entered text (Android Only: Requires API 27+)
fontSizeThe font size for all text input
fontFamilyThe font family used for text
placeholderColorThe color for placeholder text (Android Only: Requires API 27+)
cursorColorThe color for the cursor (Android Only: Requires API 29+)
errorTextColorThe color of the text inside the input fields if they are in an error state. Consider changing errorStyles.color when changing this property (Android Only: Requires API 27+)
fontWeightThe stroke weight of the font in each of the fields. API 28+ can support all font weights. Lower API versions interpret a FontWeight of 700 or above as bold and below 700 as regular (Android Only)
italicDetermins if the font inside the fields should be italic style (Android Only)
textPaddingLeftPadding (in pixels) for the left of the card input area. (Android Only)
textPaddingRightPadding (in pixels) for the right of the card input area. (Android Only)

{ styles?: StyleProp<ViewStyle>; borderWidth?: number; borderColor?: string; cornerRadius?: number; backgroundColor?: string; textColor?: string; fontSize?: number; fontFamily?: string; placeholderColor?: string; cursorColor?: string; errorTextColor?: string; fontWeight?: FontWeight; italic?: boolean; textPaddingLeft?: number; textPaddingRight?: number; }

PaymentCardDetailsFormStyles

Options for styling the PaymentCardDetailsForm component. All colors should be specified in hex format.

PropertyDescription
stylesReact Native styles for this view. Default style in iOS is { minHeight: 190 } and in Android it is { minHeight: 310 }
backgroundColorThe background color of the form
cursorColorThe color of the cursor within the form
borderWidthThe width of the card view's border (Android Only)
borderColorThe color of the card view's border (Android Only)
cornerRadiusThe corner radius of the card view's border (Android Only)
textColorThe text color for user-entered text (Android Only: Requires API 27+)
fontSizeThe font size for all text input (Android Only)
fontFamilyThe font family used for text (Android Only)
placeholderColorThe color for placeholder text (Android Only: Requires API 27+)
focusedPlaceholderColorThe color for placeholder text (Android Only: Requires API 27+)
fontWeightThe stroke weight of the font in each of the fields. API 28+ can support all font weights. Lower API versions interpret a FontWeight of 700 or above as bold and below 700 as regular (Android Only)
cardElevationThe depth of the form view's shadow (Android Only)
dividerWidthThe width of the form view's border (Android Only)
dividerColorThe color of the form view's dividers (Android Only)
italicDetermins if the font inside the fields should be italic style (Android Only)
textPaddingLeftPadding (in pixels) for the left of the form input area. (Android Only)
textPaddingRightPadding (in pixels) for the right of the form input area. (Android Only)

{ styles?: StyleProp; backgroundColor?: string; cursorColor?: string; borderColor?: string; borderWidth?: number; cornerRadius?: number; textPaddingLeft?: number; textPaddingRight?: number; fieldDividerWidth?: number; fieldDividerColor?: string; cardElevation?: number; textColor?: string; placeholderColor?: string; focusedPlaceholderColor?: string; fontSize?: number; fontFamily?: string; fontWeight?: FontWeight; italic?: boolean; };

CardValidationStatus

Represents the validation state of a credit card component. This is used in the PaymentCardDetailsForm onFormComplete property and is extended in CardDetails to be used in the PaymentCardDetailsView onCardChange property.

PropertyDescription
isValidWhether or not the card is in a valid state
{ isValid: boolean; }

PaymentCardCvvViewStyles

Options for styling the PaymentCardCvvView component. All colors should be specified in hex format.

PropertyDescription
stylesReact Native styles for this view. Default style is { minHeight: 45 }
borderWidthThe width of the input view's border
borderColorThe color of the input view's border
cornerRadiusThe corner radius of the input view's border
backgroundColorThe background color for the input view (Android Only: Requires API 27+)
textColorThe text color for user-entered text (Android Only: Requires API 27+)
fontSizeThe font size for all text
fontFamilyThe font family used for text
placeholderColorThe color for placeholder text (Android Only: Requires API 27+)
cursorColorThe color for the cursor (Android Only: Requires API 29+)
errorTextColorThe color of the text inside the input field if they are in an error state. Consider changing errorStyles.color when changing this property (Android Only: Requires API 27+)
fontWeightThe stroke weight of the font in each of the fields. API 28+ can support all font weights. Lower API versions interpret a FontWeight of 700 or above as bold and below 700 as regular (Android Only)
italicDetermins if the font inside the field should be italic style (Android Only)
textPaddingLeftPadding (in pixels) for the left of the card input area
textPaddingRightPadding (in pixels) for the right of the card input area
textAlignThe alignment of the text within the view. The value can be one of left, center, or right

{ styles?: StyleProp<ViewStyle>; borderWidth?: number; borderColor?: string; cornerRadius?: number; backgroundColor?: string; textColor?: string; fontSize?: number; fontFamily?: string; placeholderColor?: string; cursorColor?: string; errorTextColor?: string; fontWeight?: FontWeight; italic?: boolean; textPaddingLeft?: number; textPaddingRight?: number; textAlign?: "left" | "center" | "right"; }

CardDetails

Extends CardValidationStatus and represents the state of the credit card component. This is used in the PaymentCardDetailsView onCardChange property.

PropertyDescription
isValidWhether or not the card is in a valid state (See CardValidationStatus)
cardTypeThe detected card type, based on user input (See CardType)
invalidFieldsAn array of fields that are in an invalid state (See CardField)
emptyFieldsAn array of fields that are empty (See CardField)
errors.editedFieldsErrorAn error message that is calculated by only looking at the state of fields that have been edited (received and lost focus).
errors.allFieldsErrorAn error message that is calculated by looking at the state of all fields, regardless of whether they have been edited.
{ isValid: boolean; cardType: CardType; invalidFields?: CardField[]; emptyFields?: CardField[]; errors?: { editedFieldsError?: string; allFieldsError?: string; } }

CvvDetails

Represents the state of the CVV component. This is used in the PaymentCardCvvView onBlur, onCvvChange, and onFocus properties.

PropertyDescription
stateProvides full insight into the current state of the CVV security code input (See FieldState)
errors.editedFieldErrorAn error message that is calculated by only looking at the state of the field if it has been edited (received and lost focus).
errors.uneditedFieldErrorAn error message that is calculated by looking at the state of the field, regardless of whether it has been edited.

{ state: FieldState; errors?: { editedFieldError?: string; uneditedFieldError?: string: } }

CvvUpdateToken

CVV Update Token used for revalidating a stored credit card

PropertyDescription
idThe CVV update token id
productionEnvironmentBoolean value indicating if the token was generated in a production environment

{ id?: string; productionEnvironment?: boolean; }

PaymentMethodResult

Result type for payment method creation. Contains either a successful payment method or an error.

PropertyDescription
paymentMethodThe payment method, if creation was successful. Undefined if an error occurred. (See PaymentMethod)
errorError details, if creation failed. Undefined if creation was successful. (See OloError)

{ paymentMethod?: PaymentMethod; error?: OloError; }

CvvTokenResult

Result type for CVV update token creation. Contains either a successful token or an error.

PropertyDescription
tokenThe CVV update token, if creation was successful. Undefined if an error occurred. (See CvvUpdateToken)
errorError details, if creation failed. Undefined if creation was successful. (See OloError)

{ token?: CvvUpdateToken; error?: OloError; }

FieldState

Represents the entire state of a field

PropertyDescription
isValidWhether or not the field is in a valid format
isFocusedWhether or not the field is currently being focused
isEmptyWhether or not the field is empty
wasEditedWhether or not the field was edited at any point in time, even if it is currently empty
wasFocusedWhether or not the field was focused at any point

{ isValid: boolean; isFocused: boolean; isEmpty: boolean; wasEdited: boolean; wasFocused: boolean; }

CustomErrorMessages

Optional custom defined error messages to that can be displayed in place of default error messages. Any properties not defined will fall back to the default error messages.

PropertyDescription
numberAn optional collection of custom error messages for when there is an error with the card number field (See CardField)
expirationAn optional collection of custom error messages for when there is an error with the card expiration field (See CardField)
cvvAn optional collection of custom error messages for when there is an error with the card CVV field (See CardField)
postalCodeAn optional collection of custom error messages for when there is an error with the postal code field (See CardField)
unsupportedCardErrorAn optional custom error message for when the card type is unsupported by Olo.
{ number?: CustomFieldError; expiration?: CustomFieldError; cvv?: CustomFieldError; postalCode?: CustomFieldError; unsupportedCardError?: string; }

CustomFieldError

Options for defining custom error messages for different error conditions.

PropertyDescription
emptyErrorAn error message for when the field is empty.
invalidErrorAn error message for when the field is invalid.
{ emptyError?: string; invalidError?: string; }

ApplePayButtonConfig

Options for customing a DigitalWalletButton for Apple Pay.

PropertyDefault ValueDescription
cornerRadius?8The radius, in points, for the rounded corners of the button
style?blackThe style of Apple Pay button to display
type?checkoutThe type of Apple Pay button to display

{ cornerRadius?: number; style?: ApplePayButtonStyle; type?: ApplePayButtonType; }

GooglePayButtonConfig

Options for customing a DigitalWalletButton for Google Pay.

PropertyDefault ValueDescription
cornerRadius?8The radius, in dp units, for the rounded corners of the button
theme?darkThe theme to use for the Google Pay button
type?checkoutThe type of Google Pay button to display

{ cornerRadius?: number; theme?: GooglePayButtonTheme; type?: GooglePayButtonType; }

[Back to Top]

Migration Guide

v7.0.0

  • Enable the New Architecture: Follow React Native's migration guide to enable the new architecture in your app

  • iOS Component Registration: Add the registerOloPayComponents() call in your AppDelegate (see Setup)

  • Update Payment Method Creation: Replace promise-based calls with callbacks:

    Before (v6.x or older)

    const createPaymentMethod = async () => {
      try {
        const paymentMethod = await cardRef.current.createPaymentMethod();
        // Use paymentMethod to submit a basket using Olo's ordering API
      } catch (error) {
        // Handle error
      }
    };
    <PaymentCardDetailsView ref={cardRef} />
    <Button title="Submit Payment" onPress={createPaymentMethod} />
    

    After (v7.x)

    const createPaymentMethod = () => {
      cardRef.current.createPaymentMethod();
    };
    const handlePaymentMethodResult = (result: PaymentMethodResult) => {
      if (result.error) {
        // Handle error
        return;
      }
      // Use paymentMethod to submit a basket using Olo's ordering API
      const paymentMethod = result.paymentMethod;
    };
    <PaymentCardDetailsView
      ref={cardRef}
      onPaymentMethodResult={handlePaymentMethodResult}
    />
    <Button title="Submit Payment" onPress={createPaymentMethod} />
    
  • Update CVV Token Creation: Replace promise-based calls with callbacks:

    Before (v6.x or older)

    const createCvvUpdateToken = async () => {
      try {
        const cvvToken = await cvvRef.current.createCvvUpdateToken();
        // Use cvvToken for revalidating a stored credit card
      } catch (error) {
        // Handle error
      }
    };
    <PaymentCardCvvView ref={cvvRef} />
    <Button title="Submit CVV" onPress={createCvvUpdateToken} />
    

    After (v7.x)

    const createCvvUpdateToken = () => {
      cvvRef.current.createCvvUpdateToken();
    };
    const handleCvvTokenResult = (result: CvvTokenResult) => {
      if (result.error) {
        // Handle error
        return;
      }
      // Use cvvToken for revalidating a stored credit card
      const cvvToken = result.token;
    };
    <PaymentCardCvvView
      ref={cvvRef}
      onCvvTokenResult={handleCvvTokenResult}
    />
    <Button title="Submit CVV" onPress={createCvvUpdateToken} />
    

[Back to Top]

Known Issues

Versions 7.0.0 & 7.0.1

Issues were discovered during the cutover to supporting the new architecture and were fixed in version 7.0.2 see Changelog for details.

Versions up to 5.0.0

When passing incorrect or invalid parameters, error messages may refer to native platform-specific types that do not exist in JavaScript or Typescript (e.g. Double instead of Number).

Versions 2.0.0 Through 3.0.2

  • PaymentCardDetailsView: The following properties must be provided to prevent a crash: cardStyles.errorTextColor, cardStyles.textColor, and cardStyles.placeholderColor
  • PaymentCardCvvView: The following properties must be provided to prevent a crash: cvvStyles.errorTextColor, cvvStyles.textColor, and cvvStyles.placeholderColor

[Back to Top]

Changelog

v7.0.2 (Mar 11, 2026)

Updates

Bug Fixes

  • PaymentCardCvvView:
    • On iOS:
      • Fixed return value for onCvvChange, onFocus, and onBlur callbacks
      • Fixed error messages showing prematurely
      • Fixed bug causing CVV details to persist across view sessions
  • PaymentCardDetailsForm:
    • On iOS:
      • Fixed bug causing the onFormComplete callback to be called when the entire form's valid state had not changed.
      • Fixed bug causing card details to persist across view sessions
  • PaymentCardDetailsView:
    • On iOS:
      • Fixed bug causing card details to persist across view sessions

v7.0.1 (Feb 18, 2026)

Bug Fixes

  • Fixed incorrect build headers path for iOS

v7.0.0 (Jan 22, 2026)

Breaking Changes

Updates

  • Added PaymentMethodResult type for handling payment method creation results
  • Added CvvTokenResult type for handling CVV token creation results
  • Optimized SDK initialization performance

v6.0.0 (Oct 3, 2025)

Breaking Changes

  • Android is now compiled with Kotlin 2.2.20
  • Android compileSdkVersion is now v36

Updates

  • Tested against React Native 0.81.4
  • Tested against Expo SDK v54

Dependency Updates

Android

  • Updated to Olo Pay Android SDK v5.0.0
  • Updated to Kotlin v2.2.20
  • Updated to Android Gradle Plugin v8.13.0
  • Updated to Gradle v8.14.3
  • Updated targetSdkVersion and compileSdkVersion to v36
  • Updated to androidx.core:core-ktx:1.17.0
  • Updated to org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2
  • Updated to com.google.android.material:material:1.13.0

iOS

v5.0.2 (July 24, 2025)

Updates

  • Added support for Xcode 16.4

Dependency Updates

iOS

v5.0.1 (July 22, 2025)

Updates

  • JCB, DinersClub, and UnionPay cards are now accepted and treated as Discover cards
  • PaymentMethod
    • Added property fullPhoneticName
  • ApplePayConfig
    • Added property fullPhoneticNameRequired

Dependency Updates

Android

iOS

v5.0.0 (May 15, 2025)

Overview

  • Digital wallets overhaul
    • New DigitalWalletButton component
    • Apple Pay and Google Pay now both get configured/initialized when initializing the SDK
    • Digital wallet configurations for both Apple Pay and Google Pay can be updated after initialization
    • Support for displaying line items
    • Unified process for interacting with Apple Pay and Google Pay
  • Simplified SDK setup process

Updates

Breaking Changes

Dependency Updates

Android

  • Updated to Olo Pay Android SDK v4.1.0
  • Updated Android Gradle Plugin to v8.10.0
  • Updated Gradle to v8.11.1
  • Updated to Kotlin v1.9.25
  • Updated minSdkVersion to 24
  • Updated targetSdkVersion and compileSdkVersion to 35
  • Updated sourceCompatibility to JavaVersion.VERSION_17
  • Updated targetCompatibility to JavaVersion.VERSION_17
  • Updated to androidx.constraintlayout:constraintlayout:2.2.1
  • Udpated to androidx.core:core-ktx:1.16.0
  • Updated to org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0
  • Updated to com.google.android.material:material:1.12.0

iOS

v4.0.1 (Mar 21, 2025)

Updates

  • Fixed bug causing Olo Pay React Native to always pull down the latest Olo Pay iOS SDK dependency instead of the version that Olo Pay React Native was designed to work with, sometimes resulting in compiler and/or runtime errors.

v4.0.0 (Dec 11, 2024)

Breaking Changes

  • Removed generalCardError as an option when setting CustomErrorMessages

Updates

Bug Fixes

  • PaymentCardDetailsView - Fix bug that caused app chashes when cardStyles.errorTextColor, cardStyles.textColor, and cardStyles.placeholderColor were not set
  • PaymentCardCvvView - Fix bug that caused app chashes when cvvStyles.errorTextColor, cvvStyles.textColor, and cvvStyles.placeholderColor were not set
  • Fixed a bug preventing Olo Pay SDK initialization without Apple Pay parameters
  • Fixed a bug so that DP units are converted to PX units for more consistent UI across both platforms
  • Fixed bug to make custom error messages behave more consistently across both platforms

Dependency Updates

v3.0.2 (June 28, 2024)

Bug Fixes

  • Fix Google Pay crash bug when Google Pay initialization is interrupted by configuration changes

v3.0.1 (June 4, 2024)

Bug Fixes

v3.0.0 (Oct 31, 2023)

Dependency Updates

Breaking Changes

  • All references to "CVC" have been replaced with "CVV"
  • Removed paddingTop and paddingBottom from PaymentCardDetailsViewStyles
  • Renamed paddingLeft to textPaddingLeft in PaymentCardDetailsViewStyles
  • Renamed paddingRight to textPaddingRight in PaymentCardDetailsViewStyles
  • Removed PromiseRejectionCode incorrectNumber and merged its use case with invalidNumber
  • Removed PromiseRejectionCode incorrectZip and merged its use case with invalidPostalCode
  • Removed PromiseRejectionCode incorrectCvv and merged its use case with invalidCvv

Updates

Bugfixes

v2.0.1 (July 18, 2023)

Dependency Updates

v2.0.0 (July 14, 2023)

Breaking Changes

Updates

v1.0.2 (May 22, 2023)

Bugfixes

  • Fix crash if negative amount is passed in to getDigitalWalletPaymentMethod()

v1.0.1 (Mar 9, 2023)

Bugfixes

  • Fix iOS installation issue Updates
  • Added iOS setup documentation

v1.0.0 (Feb 22, 2023)

[Back to Top]

License

Olo Pay Software Development Kit License Agreement

Copyright © 2022 Olo Inc. All rights reserved.

Subject to the terms and conditions of the license, you are hereby granted a non-exclusive, worldwide, royalty-free license to (a) copy and modify the software in source code or binary form for your use in connection with the software services and interfaces provided by Olo, and (b) redistribute unmodified copies of the software to third parties. The above copyright notice and this license shall be included in or with all copies or substantial portions of the software.

Your use of this software is subject to the Olo APIs Terms of Use, available at https://www.olo.com/api-usage-terms. This license does not grant you permission to use the trade names, trademarks, service marks, or product names of Olo, except as required for reasonable and customary use in describing the origin of the software and reproducing the content of this license.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

[Back to Top]

Keywords

react-native

FAQs

Package last updated on 12 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts