Gathering detailed insights and metrics for @olo/pay-react-native
Gathering detailed insights and metrics for @olo/pay-react-native
Gathering detailed insights and metrics for @olo/pay-react-native
Gathering detailed insights and metrics for @olo/pay-react-native
npm install @olo/pay-react-native
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
22
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.
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.
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).
npx expo prebuild
prior to installationRun the following command from a terminal in your app's root project directory
1npm install @olo/pay-react-native
minSdkVersion
must be set to 24
or highercompileSdkVersion
to 35
or higherv8.11.1
and Android Gradle Plugin v8.10.0
In order to use the PaymentCardFormView
you need to install and configure Material Components theme in your app.
app/build.gradle
add the dependency with a specific version1implementation 'com.google.android.material:material:<version>'
styles.xml
file1<style name="Theme.MyApp" parent="Theme.MaterialComponents.DayNight"> 2 <!-- ... --> 3</style>
In you app's Podfile:
1source 'https://github.com/CocoaPods/Specs.git' 2source 'https://github.com/ololabs/podspecs.git'
ios.developmentTarget
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:
1pod install
Run the following command from a terminal in your app's root project directory
1npm install @olo/pay-react-native@latest
Open a terminal, navigate to your app's iOS folder (usually <projectName>/ios
), and run the following commands:
1rm -rf Pods 2pod update
Note: If you run into errors after updating, delete both your
Pods
folder andPodfile.lock
file and then runpod install
.
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
).
cardStyles.errorTextColor
, cardStyles.textColor
, and cardStyles.placeholderColor
cvvStyles.errorTextColor
, cvvStyles.textColor
, and cvvStyles.placeholderColor
A basic high-level overview of the steps needed to integrate the React Native SDK into your hybrid app is as follows:
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.
initialize(...)
).createPaymentMethod()
function on the component to get a PaymentMethod instanceDigitalWalletReadyEvent
to indicate when digital wallet payments can be processed.createDigitalWalletPaymentMethod(...)
).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.
initialize(...)
).createCvvUpdateToken()
function on the component to get a CvvUpdateToken instanceWhen 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 PromiseRejectionCode
enum and a PromiseRejection
type for
handling promise rejection errors.
1try { 2 const paymentMethodData = await createDigitalWalletPaymentMethod({ amount: 2.34 }}); 3 //Handle payment method data 4} catch (error) { 5 let rejection = error as PromiseRejection; 6 if (rejection) { 7 switch(rejection.code) { 8 case PromiseRejectionCode.missingParameter: { 9 // Handle missing parameter scenario 10 break; 11 } 12 case PromiseRejectionCode.sdkUninitialized: { 13 // Handle sdk not initialized scenario 14 break; 15 } 16 } 17 } else { 18 // Some other error not related to a promise rejection 19 } 20}
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.
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:
1import { OloPayEvents, DigitalWalletReadyEvent } from '@olo/pay-react-native'; 2 3let subscription = OloPayEvents.addListener( 4 DigitalWalletReadyEvent, 5 (event: DigitalWalletStatus) => { 6 // Handle event... 7 } 8); 9 10// Don't forget to unsubscribe when you no longer need to 11// know if digital wallets are in a ready state 12subscription.remove();
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.
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
provides customization for the card component.
Property | Description |
---|---|
componentStyles | Options for styling the root <View> component |
errorStyles | Options for styling the error <Text> component. Default style is { minHeight: 20 } |
cardStyles | Options for styling credit card input portion of the component. (See PaymentCardDetailsViewStyles) |
viewProps | React Native view properties for the root <View> component |
customErrorMessages | Options for defining custom error messages in place of defaults (See CustomErrorMessages) |
postalCodeEnabled | Whether or not the postal code should be displayed |
disabled | Whether or not the component is disabled and cannot receive touch and input events |
displayErrorMessages | Whether or not the component should display error messages. Set to false if you have a custom mechanism for displaying error messages |
placeholders | Options for specifying placeholder text. (See PaymentCardDetailsPlaceholders) |
onCardChange(card: CardDetails) | Card change event handler. Called when input events occur. (See CardDetails) |
onFocus() | Focus event handler. Called when the component receives input focus |
onBlur() | Blur event handler. Called when the component loses input focus |
onFocusField(field: CardField) | Focus field event handler. Called each time focus moves to a new card input field within the component. (See CardField) |
{
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;
}
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:
1<PaymentCardDetailsView 2 cardStyles={{ errorTextColor: "#00ff00" }} 3 errorStyles={{ color: "#00ff00" }} 4/>
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()
1focus(field?: CardField) => Promise<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
.
If the promise is rejected, the code
property on the returned error will be PromiseRejectionCode.viewNotFound
blur()
1blur() => Promise<void>
Clears focus on the PaymentCardDetailsView
component and hides the keyboard. If the promise is rejected, the code
property on the returned error will be PromiseRejectionCode.viewNotFound
clear()
1clear() => Promise<void>
Clears all card details entered in the PaymentCardDetailsView
component. If the promise is rejected, the code
property on the returned error will be PromiseRejectionCode.viewNotFound
createPaymentMethod()
1createPaymentMethod() => Promise<PaymentMethod>
Attempts to create a payment method based on the entered card details. If successful, returns a PaymentMethod instance.
If the promise is rejected, possible values of the code
property on the returned error will be one of:
1import { 2 PaymentCardDetailsView, 3 PaymentCardDetailsViewMethods, 4} from '@olo/pay-react-native'; 5import { View, Button } from 'react-native'; 6import { useRef } from 'react'; 7 8export default function MyComponent() { 9 const cardRef = useRef<PaymentCardDetailsViewMethods>(null); 10 11 const createPaymentMethod = async () => { 12 try { 13 if (!cardRef.current) { 14 return; 15 } 16 17 let paymentMethod = await cardRef.current.createPaymentMethod(); 18 // Use the payment method to submit a basket using Olo's ordering API 19 } catch (error) { 20 // Handle the promise rejection 21 } 22 }; 23 24 // Styling omitted for sake of example simplicity 25 return ( 26 <View> 27 <PaymentCardDetailsView displayErrorMessages={true} ref={cardRef} /> 28 <Button title="Submit Payment" onPress={createPaymentMethod} /> 29 </View> 30 ); 31}
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
provides additional properties defined in the following table
Property | Description |
---|---|
componentStyles | Options for styling the root <View> |
cardStyles | Options for styling credit card input portion of the component. (See PaymentCardDetailsFormStyles) |
disabled | Whether or not the component is disabled and cannot receive touch and input events |
onFormComplete() | Card form complete event handler. Called when form complete events occur. (See CardValidationStatus) |
viewProps | React Native view properties for the root <View> component |
placeholders | Options for specifying placeholder text. (See PaymentCardDetailsPlaceholders) |
{
cardStyles?: PaymentCardDetailsFormStyles;
componentStyles?: StyleProp<ViewStyle>;
disabled?: boolean;
onFormComplete?(cardValidationStatus: CardValidationStatus): void;
viewProps?: ViewProps;
placeholders?: PaymentCardDetailsPlaceholders;
}
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()
1focus(field?: CardField) => Promise<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
.
If the promise is rejected, the code
property on the returned error will be PromiseRejectionCode.viewNotFound
blur()
1blur() => Promise<void>
Clears focus on the PaymentCardDetailsForm
component and hides the keyboard. If the promise is rejected, the code
property on the returned error will be PromiseRejectionCode.viewNotFound
clear() (Android Only)
1clear() => Promise<void>
Clears all card details entered in the PaymentCardDetailsForm
component. If the promise is rejected, the code
property on the returned error will be PromiseRejectionCode.viewNotFound
createPaymentMethod()
1createPaymentMethod() => Promise<PaymentMethod>
Attempts to create a payment method based on the entered card details. If successful, returns a PaymentMethod instance.
If the promise is rejected, possible values of the code
property on the returned error will be one of:
1import { PaymentCardDetailsForm, PaymentCardDetailsFormMethods } from "@olo/pay-react-native"; 2import { View, Button } from "react-native"; 3import { useRef } from "react"; 4 5export default function MyComponent() { 6 const cardRef = useRef<PaymentCardDetailsFormMethods>(null); 7 8 const createPaymentMethod = async() => { 9 try { 10 if (!cardRef.current) { 11 return; 12 } 13 14 let paymentMethod = await cardRef.current.createPaymentMethod(); 15 // Use the payment method to submit a basket using Olo's ordering API 16 } catch (error) { 17 // Handle the promise rejection 18 } 19 }; 20 21 // Styling omitted for sake of example simplicity 22 return ( 23 <View> 24 <PaymentCardDetailsForm 25 ref={cardRef} /> 26 <Button 27 title="Submit Payment" 28 onPress={createPaymentMethod} /> 29 </View> 30 ); 31};
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)
Property | Description |
---|---|
componentStyles | Options for styling the root <View> component |
customErrorMessages | Option for defining custom error messages in place of defaults (See CustomFieldError) |
cvvStyles | Options for styling security code input portion of the component. (See PaymentCardCvvViewStyles) |
displayErrorMessages | Whether or not the component should display error messages. Set to false if you have a custom mechanism for displaying error messages |
errorStyles | Options for styling the error <Text> component. Default style is { minHeight: 20 } |
disabled | Whether or not the component is disabled and cannot receive touch and input events |
onBlur(cvvDetails: CvvDetails) | Blur event handler. Called when the component loses input focus (See CvvDetails) |
onCvvChange(cvvDetails: CvvDetails) | Card change event handler. Called when input events occur. (See CvvDetails) |
onFocus(cvvDetails: CvvDetails) | Focus event handler. Called when the component receives input focus (See CvvDetails) |
placeholder | Option for specifying placeholder text. (See PaymentCardCvvPlaceholder) |
viewProps | React Native view properties for the root <View> component |
{
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;
}
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:
1<PaymentCardCvvView 2 cvvStyles={{ errorTextColor: "#00ff00" }} 3 errorStyles={{ color: "#00ff00" }} 4/>
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()
1focus() => Promise<void>
Puts focus on the PaymentCardCvvView
component and displays the keyboard. If the promise is rejected, the code
property on the returned error will be PromiseRejectionCode.viewNotFound
blur()
1blur() => Promise<void>
Clears focus on the PaymentCardCvvView
component and hides the keyboard. If the promise is rejected, the code
property on the returned error will be PromiseRejectionCode.viewNotFound
clear()
1clear() => Promise<void>
Clears all security code details entered in the PaymentCardCvvView
component. If the promise is rejected, the code
property on the returned error will be PromiseRejectionCode.viewNotFound
createCvvUpdateToken()
1createCvvUpdateToken() => Promise<CvvUpdateToken>
Attempts to create a CVV update token based on the entered security code details. If successful, returns a CvvUpdateToken instance.
If the promise is rejected, possible values of the code
property on the returned error will be one of:
1import { 2 PaymentCardCvvView, 3 PaymentCardCvvViewMethods, 4} from '@olo/pay-react-native'; 5import { View, Button } from 'react-native'; 6import { useRef } from 'react'; 7 8export default function MyComponent() { 9 const cvvRef = useRef<PaymentCardCvvViewMethods>(null); 10 11 const createCvvUpdateToken = async () => { 12 try { 13 if (!cvvRef.current) { 14 return; 15 } 16 17 let cvvUpdateToken = await cvvRef.current.createCvvUpdateToken(); 18 // Use the CVV update token for revalidating a stored credit card 19 } catch (error) { 20 // Handle the promise rejection 21 } 22 }; 23 24 // Styling omitted for sake of example simplicity 25 return ( 26 <View> 27 <PaymentCardCvvView displayErrorMessages={true} ref={cvvRef} /> 28 <Button title="Submit CVV" onPress={createCvvUpdateToken} /> 29 </View> 30 ); 31}
A button that renders a native Apple Pay button on iOS and a native Google Pay button on Android.
Property | Description |
---|---|
applePayConfig | Options for customizing the button for Apple Pay on iOS (See ApplePayButtonConfig) |
googlePayConfig | Options for customizing the button for Google Pay on Android (See GooglePayButtonConfig) |
styles | Options for styling the button. Default styles provide a minimum height of 40 on Android and 30 on iOS |
disabled | Whether or not the component is disabled and cannot receive touch events |
onPress() | Event handler for button presses |
{
applePayConfig?: ApplePayButtonConfig;
googlePayConfig?: GooglePayButtonConfig;
disabled?: boolean;
onPress(): void;
styles?: StyleProp<ViewStyle>;
}
1import { 2 ApplePayButtonStyle, 3 ApplePayButtonType, 4 DigitalWalletButton, 5 GooglePayButtonTheme, 6 GooglePayButtonType, 7 OloPaySDK 8} from '@olo/pay-react-native'; 9 10export default function MyComponent() { 11 const createDigitalWalletPaymentMethod = async () => { 12 try { 13 let result = await OloPaySDK.createDigitalWalletPaymentMethod(); 14 // Use result.paymentMethod method to submit a basket using Olo's ordering API 15 // or result.error to handle additional error scenarios 16 } catch (error) { 17 // Handle the promise rejection 18 } 19 }; 20 21 // Styling omitted for sake of example simplicity 22 return ( 23 <DigitalWalletButton 24 onPress={createDigitalWalletPaymentMethod} 25 googlePayConfig={{ 26 theme: GooglePayButtonTheme.dark, 27 type: GooglePayButtonType.checkout, 28 cornerRadius: 8, 29 }} 30 applePayConfig={{ 31 style: ApplePayButtonStyle.black, 32 type: ApplePayButtonType.checkout, 33 cornerRadius: 8, 34 }} 35 /> 36 ); 37}
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.
1import { OloPaySDK } from '@olo/pay-react-native';
1initialize(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:
Param | Type | Description |
---|---|---|
productionEnvironment | boolean | true to use the production environment, false for the test environment |
digitalWalletConfig | DigitalWalletConfig | Initialization options for digital wallets |
1updateDigitalWalletConfig(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:
Param | Type | Description |
---|---|---|
digitalWalletConfig | DigitalWalletConfig | The new configuration settings for digital wallets. See DigitalWalletConfig for more details. |
1createDigitalWalletPaymentMethod(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:
1try { 2 const { paymentMethod } = await createDigitalWalletPaymentMethod({ amount: 5.00 }); 3 if (paymentMethod === undefined) { 4 // User canceled the digital wallet flow 5 } else { 6 // Send paymentMethod to Olo's Ordering API 7 } 8} catch (error) { 9 // Handle error 10}
Param | Type | Description |
---|---|---|
options | DigitalWalletPaymentRequestOptions | Options for processing a digital wallet payment. |
Returns: Promise<DigitalWalletPaymentMethodResult>
1isInitialized() => Promise<InitializationStatus>
Check if the Olo Pay SDK has been initialized
Returns: Promise<InitializationStatus>
1isDigitalWalletInitialized() => 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>
1isDigitalWalletReady() => 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>
Options for intializing digital wallets
Property | Description | Default |
---|---|---|
countryCode | A two character country code for the vendor that will be processing the payment | 'US' |
currencyCode | Currency code to be used for transactions | CurrencyCode</a>.usd |
companyLabel | The company display name | - |
emailRequired | Whether an email will be collected and returned when processing transactions | false |
fullNameRequired | Whether a full name will be collected and returned when processing transactions | false |
fullBillingAddressRequired | Whether a full billing address will be collected and returned when processing transactions | false |
phoneNumberRequired | Whether a phone number will be collected and returned when processing transactions | false |
initializeApplePay | Whether Apple Pay should be initialized. | - |
initializeGooglePay | Whether Google Pay should be initialized. | - |
applePayConfig | Configuration options for initializing Apple Pay. Required if initializeApplePay is true | - |
googlePayConfig | Configuration 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; }
Type alias representing currency codes supported by Olo Pay.
'USD' | 'CAD'
Options for initializing Apple Pay
Property | Description |
---|---|
merchantId | The merchant id registered with Apple for Apple Pay |
{ merchantId: string; }
Options for intializing Google Pay
Property | Description | Default |
---|---|---|
productionEnvironment | Whether Google Pay will use the production environment | true |
existingPaymentMethodRequired | Whether an existing saved payment method is required for Google Pay to be considered ready | false |
currencyMultiplier | Multiplier to convert the amount to the currency's smallest unit (e.g. $2.34 * 100 = 234 cents) | 100 |
{ productionEnvironment?: boolean; existingPaymentMethodRequired?: boolean; currencyMultiplier?: number; }
Type alias representing a digital wallet payment method result.
Property | Description |
---|---|
paymentMethod | The payment method generated by the digital wallet flow, or undefined if the user canceled the flow |
{ paymentMethod?: PaymentMethod; }
Payment method used for submitting payments to Olo's Ordering API
Property | Description |
---|---|
id | The payment method id. This should be set to the token field when submitting a basket |
last4 | The last four digits of the card |
cardType | The issuer of the card |
expMonth | Two-digit number representing the card's expiration month |
expYear | Four-digit number representing the card's expiration year |
postalCode | Zip or postal code. Will always have the same value as billingAddress.postalCode |
countryCode | Two character country code. Will always have the same value as billingAddress.countryCode |
isDigitalWallet | true if this payment method was created by digital wallets (e.g. Apple Pay or Google Pay), false otherwise |
productionEnvironment | true if this payment method was created in the production environment, false otherwise |
email | The email address associated with the transaction, or an empty string if unavailable. Only provided for digital wallet payment methods (see isDigitalWallet ) |
digitalWalletCardDescription | The description of the card, as provided by Apple or Google. Only provided for digital wallet payment methods (see isDigitalWallet ) |
billingAddress | The 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 ) |
fullName | The full name associated with the transaction. Will only have a non-empty value for digital wallet payment methods (see isDigitalWallet ) |
{ 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; phoneNumber: string; }
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.
Property | Description |
---|---|
address1 | The first line of the address |
address2 | The second line of the address, or an empty string |
address3 | The third line of the address, or an empty string |
postalCode | The postal or zip code |
countryCode | The two digit ISO country code |
administrativeArea | A country subdivision, such as a state or province |
{ address1: string; address2: string; address3: string; locality: string; postalCode: string; countryCode: string; administrativeArea: string; }
Type alias representing options for a digital wallet payment method request
GooglePayPaymentRequestOptions | ApplePayPaymentRequestOptions
Options for requesting a payment method via Google Pay
Property | Description | Default |
---|---|---|
amount | The amount to be charged | - |
checkoutStatus | The checkout status to be used for the transaction | FinalImmediatePurchase |
totalPriceLabel | A custom value to override the default total price label in the Google Pay sheet | - |
lineItems | A list of line items to be displayed in the digital wallet payment sheet | - |
validateLineItems | Whether 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; }
Represents a line item in a digital wallet transaction
Property | Description |
---|---|
label | The label of the line item |
amount | The amount of the line item |
type | Enum representing the type of a line item in a digital wallet transaction |
status | Enum representing the status of a line item. If not provided, default value is LineItemStatus.final |
{ label: string; amount: number; type: LineItemType; status?: LineItemStatus; }
Options for requesting a payment method via Apple Pay
Property | Description | Default |
---|---|---|
amount | The amount to be charged | - |
lineItems | A list of line items to be displayed in the digital wallet payment sheet | - |
validateLineItems | Whether 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; }
Represents the status for SDK initialization
Property | Description |
---|---|
isInitialized | true if the SDK is initialized, false otherwise |
{ isInitialized: boolean; }
Represents the status of digital wallets.
Property | Description |
---|---|
isReady | true if digital wallets are ready to be used, false otherwise |
{ isReady: boolean; }
Members | Value | Description |
---|---|---|
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 |
Members | Value | Description |
---|---|---|
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". |
Members | Value | Description |
---|---|---|
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 |
Members | Value | Description |
---|---|---|
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 ("...") |
Members | Value | Description |
---|---|---|
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 |
Represents the different input fields of the PaymentCardDetailsView
and PaymentCardDetailsForm
components
Property | Value | Description |
---|---|---|
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 |
Options for determining the weight of the font.
Property | Description |
---|---|
ultraLight | Ultra light font weight. Corresponds to a value of 100 |
thin | Thin font weight. Corresponds to a value of 200 |
light | Light font weight. Corresponds to a value of 300 |
regular | Regular font weight. This is the default in most cases. Corresponds to a value of 400 |
medium | Medium font weight. Corresponds to a value of 500 |
semiBold | Semi Bold font weight. Corresponds to a value of 600 |
bold | Bold font weight. Corresponds to a value of 700 |
extraBold | Extra bold font weight. Corresponds to a value of 800 |
black | Heaviest font weight. Corresponds to a value of 900 |
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
Property | Limitations | Description |
---|---|---|
automatic | iOS 14+ | A button that automatically switches between light mode and dark mode |
black | A black button with white lettering | |
white | A white button with black lettering | |
whiteOutline | A white button with black lettering and a black outline |
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
Property | Limitations | Description |
---|---|---|
addMoney | iOS 14+ | A button that uses the phrase "Add Money with" in conjunction with the Apple Pay logo |
book | A button that uses the phrase "Book with" in conjunction with the Apple Pay logo | |
buy | A button that uses the phrase "Buy with" in conjunction with the Apple Pay logo | |
checkout | A button that uses the phrase "Checkout with" in conjunction with the Apple Pay logo | |
continue | iOS 15+ | A button that uses the phrase "Continue with" in conjunction with the Apple Pay logo |
contribute | iOS 14+ | A button that uses the phrase "Contribute with" in conjunction with the Apple Pay logo |
donate | A button that uses the phrase "Donate with" in conjunction with the Apple Pay logo | |
inStore | A button that uses the phrase "Pay with" in conjunction with the |
No vulnerabilities found.
No security vulnerabilities found.