In-App Payments SDK React Native Plugin Technical Reference

February 26, 2025 · View on GitHub

This technical reference outlines the methods available in the React Native plugin for the In-App Payments SDK. For comprehensive documentation on the In-App Payments SDK, visit this link.



Methods at a glance

Card entry methods

MethodReturn ObjectDescription
setSquareApplicationIdvoidSets the Square Application ID.
startCardEntryFlowvoidDisplays a full-screen card entry view.
startCardEntryFlowWithBuyerVerificationvoidDisplays a full-screen card entry view with buyer verification flow enabled.
completeCardEntryvoidCloses the card entry form on success.
showCardNonceProcessingErrorvoidShows an error in the card entry form without closing the form.
setIOSCardEntryThemevoidSets the customization theme for the card entry view controller in the native layer.
startBuyerVerificationFlowvoidDisplays the enabled buyer verification flow.

Apple Pay methods

MethodReturn ObjectDescription
setSquareApplicationIdvoidSets the Square Application ID.
initializeApplePayvoidInitializes the In-App Payments React Native plugin for Apple Pay.
canUseApplePayboolReturns true if the device supports Apple Pay and the user has added at least one card that Square supports.
requestApplePayNoncevoidStarts the Apple Pay payment authorization and returns a nonce based on the authorized Apple Pay payment token.
completeApplePayAuthorizationvoidNotifies the native layer to close the Apple Pay sheet with success or failure status.

Google Pay methods

MethodReturn ObjectDescription
setSquareApplicationIdvoidSets the Square Application ID.
initalizeGooglePayvoidInitializes the React Native plugin for Google Pay.
canUseGooglePayboolReturns true if the device supports Google Pay and the user has added at least one card that Square supports.
requestGooglePayNoncevoidStarts the Google Pay payment authorization and returns a nonce based on the authorized Google Pay payment token.

Method details

setSquareApplicationId

Used to set a Square Application ID on the InAppPaymentsSDK object.


Note: This method must be called before any other operations.


ParameterTypeDescription
applicationIdStringThe Square Application ID otained from the developer portal

Example usage


import {
  SQIPCore
} from 'react-native-square-in-app-payments';

await SQIPCore.setSquareApplicationId('APPLICATION_ID');

startCardEntryFlow

Displays a full-screen card entry view. The method takes one configuration object and two call back parameters which correspond to the possible results of the request.

ParameterTypeDescription
cardEntryConfigcardEntryConfigConfiguration object for card entry behavior, pass null for default configuration
onCardNonceRequestSuccesscardEntryNonceRequestSuccessCallbackInvoked when card entry is completed and the SDK has processed the payment card information.
onCardEntryCancelcardEntryCancelCallbackInvoked when card entry is canceled.

Example usage

import {
  SQIPCardEntry
} from 'react-native-square-in-app-payments';

await SQIPCardEntry.startCardEntryFlow(
  null,
  (cardDetails) => { ... }, // onCardNonceRequestSuccess
  () => { ... }, // onCardEntryCancel
);

startCardEntryFlowWithBuyerVerification

Displays a full-screen card entry view with buyer verification flow enabled. The method takes one configuration object and three call back parameters which correspond to the possible results of the request.

ParameterTypeDescription
cardEntryConfigcardEntryConfigConfiguration object for card entry behavior, pass null for default configuration
onBuyerVerificationSuccessBuyerVerificationSuccessCallbackInvoked when card entry with buyer verification is completed successfully.
onBuyerVerificationFailureBuyerVerificationErrorCallbackInvoked when card entry with buyer verification encounters errors.
onCardEntryCancelcardEntryCancelCallbackInvoked when card entry is canceled.

Example usage

import {
  SQIPCardEntry
} from 'react-native-square-in-app-payments';

const cardEntryConfig = {
  collectPostalCode: true,
  squareLocationId: SQUARE_LOCATION_ID,
  buyerAction: 'Charge',
  amount: 100,
  currencyCode: 'USD',
  givenName: 'John',
  familyName: 'Doe',
  addressLines: ['London Eye', 'Riverside Walk'],
  city: 'London',
  countryCode: 'GB',
  email: 'johndoe@example.com',
  phone: '8001234567',
  postalCode: 'SE1 7'
};

await SQIPCardEntry.startCardEntryFlowWithBuyerVerification(
  cardEntryConfig,
  (buyerVerificationDetails) => { ... }, // onBuyerVerificationSuccess
  (errorInfo) => { ... }, // onBuyerVerificationFailure
  () => { ... }, // onCardEntryCancel
);

completeCardEntry

Called in the onCardNonceRequestSuccess callback. Closes the card entry form.

ParameterTypeDescription
onCardEntryCompletecardEntryCompleteCallbackThe callback invoked when card entry is completed and is closed.

completeCardEntry should be called after all other callback logic is executed. If callback logic makes a server call to process the supplied nonce, this method is called after getting a success response from the server.

If any nonce processing logic is to be executed after the card entry form is closed, call completeCardEntry after getting the card nonce from the onCardNonceRequestSuccess cardDetails parameter.

Example usage

import {
  SQIPCardEntry
} from 'react-native-square-in-app-payments';

/**
* cardEntryNonceRequestSuccessCallback
*/
async onCardNonceRequestSuccess(cardDetails) {
  ...
  // payment finished successfully
  // you must call this method to close card entry
  await SQIPCardEntry.completeCardEntry(
    () => {},  // onCardEntryComplete
  );
}

showCardNonceProcessingError

Called in the onCardNonceRequestSuccess callback. Returns execution to the card entry form with an error string to be shown in the form.

showCardNonceProcessingError should be called after all other callback logic is executed. If callback logic makes a server call to request a payment with the supplied nonce, this method is called after getting an error response from the server call.

ParameterTypeDescription
errorMessageStringThe error message to be shown in the card entry form.

Example usage

import {
  SQIPCardEntry
} from 'react-native-square-in-app-payments';

/**
* cardEntryNonceRequestSuccessCallback
*/
async onCardNonceRequestSuccess(cardDetails) {
  ...
  // payment failed to complete due to error
  // notify card entry to show processing error
  await SQIPCardEntry.showCardNonceProcessingError(errorMessage);
}

setIOSCardEntryTheme

iOS Only

Sets the customization theme for the card entry view controller in the native layer.

It is not necessary to call this method before starting Apple Pay. The SDK provides a default theme which can be customized to match the theme of your app.

ParameterTypeDescription
themeConfigurationIOSThemeAn object that defines the theme of an iOS card entry view controller.

Example usage

import {
  Platform
} from 'react-native';
import {
  SQIPApplePay
} from 'react-native-square-in-app-payments';

...
if (Platform.OS === 'ios') {
  await SQIPCardEntry.setIOSCardEntryTheme({
    saveButtonFont: {
      size: 30,
    },
    saveButtonTitle: 'Pay 💳 ',
    keyboardAppearance: 'Light',
    saveButtonTextColor: {
      r: 213,
      g: 133,
      b: 12,
      a: 0.9,
    },
  });
}

startBuyerVerificationFlow

Starts the buyer verification for a given payment source id. The most likely use case will be to pass in a card-on-file (cof). This will display a verification view to the user for some geographies to address Strong Customer Authentication. The method takes two callback parameters which correspond to the possible results of the request. Please see this link for more detailed documentation on this flow.

ParameterTypeDescription
paymentSourceIdpaymentSourceIdConfiguration object for card entry behavior, pass ccof:customer-card-id-requires-verification for default configuration
cardEntryConfigcardEntryConfigConfiguration object for card entry behavior, pass null for default configuration
onBuyerVerificationSuccessBuyerVerificationSuccessCallbackInvoked when card entry with buyer verification is completed successfully.
onBuyerVerificationFailureBuyerVerificationErrorCallbackInvoked when card entry with buyer verification encounters errors.
onCardEntryCancelcardEntryCancelCallbackInvoked when card entry is canceled.

Example usage for a charge

import {
  SQIPCardEntry
} from 'react-native-square-in-app-payments';

const paymentSourceId  =  'ccof:customer-card-id-requires-verification';
const cardEntryConfig = {
  collectPostalCode: true,
  squareLocationId: SQUARE_LOCATION_ID,
  buyerAction: 'Charge', // Either Charge or Store, depending on your usage.
  amount: 100,
  currencyCode: 'USD',
  givenName: 'John',
  familyName: 'Doe',
  addressLines: ['London Eye', 'Riverside Walk'],
  city: 'London',
  countryCode: 'GB',
  email: 'johndoe@example.com',
  phone: '8001234567',
  postalCode: 'SE1 7'
};

await SQIPCardEntry.startBuyerVerificationFlow(
  paymentSourceId,
  cardEntryConfig,
  (buyerVerificationDetails) => { ... }, // onBuyerVerificationSuccess
  (errorInfo) => { ... }, // onBuyerVerificationFailure
  () => { ... }, // onCardEntryCancel
);

initializeApplePay

iOS Only

Initializes the In-App Payments React Native plugin for Apple Pay.

This is a method called only once when React Native app is being initialized on an iOS device. Call this method only on an iOS device and when your app is intended to support Apple Pay.

ParameterTypeDescription
applePayMerchantIdStringRegistered Apple Pay merchant ID

Example usage

import {
  Platform
} from 'react-native';
import {
  SQIPApplePay
} from 'react-native-square-in-app-payments';

...
  if (Platform.OS === 'ios') {
    await SQIPApplePay.initializeApplePay('APPLE_PAY_MERCHANT_ID');
  }
...

canUseApplePay

iOS Only

Returns true if the device supports Apple Pay and the user has added at least one card that Square supports. Not all brands supported by Apple Pay are supported by Square.

Example usage

import {
  Platform
} from 'react-native';
import {
  SQIPApplePay
} from 'react-native-square-in-app-payments';

...
  if (Platform.OS === 'ios') {
    let digitalWalletEnabled = await SQIPApplePay.canUseApplePay();
  }
...

requestApplePayNonce

iOS Only

Starts the Apple Pay payment authorization and returns a nonce based on the authorized Apple Pay payment token.

ParameterTypeDescription
applePayConfigapplePayConfigConfiguration for Apple Pay
onApplePayNonceRequestSuccessapplePayNonceRequestSuccessCallbackInvoked before Apple Pay sheet is closed. The success callback carries the generated nonce
onApplePayNonceRequestFailureapplePayNonceRequestFailureCallbackInvoked before Apple Pay sheet is closed. The failure callback carries information about the failure.
onApplePayCompleteapplePayCompleteCallbackInvoked when Apple Pay sheet is closed after success, failure, or cancellation.

Throws InAppPaymentsException

Example usage

import {
  Platform
} from 'react-native';

import {
  SQIPApplePay
} from 'react-native-square-in-app-payments';

if (Platform.OS === 'ios') {
  const applePayConfig = {
    price: '1.00',
    summaryLabel: 'Test Item',
    countryCode: 'US',
    currencyCode: 'USD',
    paymentType: SQIPApplePay.PaymentTypeFinal,
  };
  try{ 
    await SQIPApplePay.requestApplePayNonce(
      applePayConfig,
      (cardDetails) => { ... }, // onApplePayNonceRequestSuccess
      (errorInfo) => { ... }, // onApplePayNonceRequestFailure
      () => { ... }, // onApplePayComplete
    );
  } catch(ex) {
    // handle InAppPaymentsException
  }
}

completeApplePayAuthorization

iOS Only

Notifies the native layer to close the Apple Pay sheet with success or failure status.

ParameterTypeDescription
isSuccessboolIndicates success or failure.
Optional: errorMessageStringThe error message that Apple Pay displays in the native layer card entry view controller.

Example usage

import {
  Platform
} from 'react-native';
import {
  SQIPApplePay
} from 'react-native-square-in-app-payments';

/**
 * Callback when the apple pay sheet is closed after
 * call completeApplePayAuthorization or user tap to close apple pay sheet manually
 */
onApplePayEntryComplete() {
  // handle the apple pay sheet closed event
}

/**
 * Callback when successfully get the card nonce details for processig
 * apple pay sheet is still open and waiting for processing card nonce details
 * @param cardDetails
 */
async onApplePayNonceRequestSuccess(cardDetails) {
  try {
    // take payment with the card nonce details
    // you can take a charge
    // await chargeCard(cardDetails);

    // you must call completeApplePayAuthorization to close apple pay sheet
    await SQIPApplePay.completeApplePayAuthorization(true);
  } catch (ex) {
    // handle card nonce processing failure

    // you must call completeApplePayAuthorization to close apple pay sheet
    await SQIPApplePay.completeApplePayAuthorization(false, ex.message);
  }
}

/**
 * Callback when failed to get the card nonce
 * apple pay sheet is still open and waiting for processing error information
 */
async onApplePayNonceRequestFailure(errorInfo) {
  // handle this error before close the apple pay sheet

  // you must call completeApplePayAuthorization to close apple pay sheet
  await SQIPApplePay.completeApplePayAuthorization(false, errorInfo.message);
}

initializeGooglePay

Android Only

Optional: Used to enable Google Pay in an Android app. Initialize React Native plugin for google pay. This is a method called only once when React Native app is being initialized on an Android device.


Note: The location ID is found in the Square developer dashboard, on the locations page.


ParameterTypeDescription
squareLocationIdStringThe Square Location ID from the developer portal.
environmentIntSpecifies the Google Pay environment to run Google Pay in: Test or Production

Example usage

import {
  Platform
} from 'react-native';
import {
  SQIPGooglePay
} from 'react-native-square-in-app-payments';

...
if (Platform.OS === 'android') {
  await SQIPGooglePay.initializeGooglePay('SQUARE_LOCATION_ID', SQIPGooglePay.EnvironmentTest);
}

canUseGooglePay

Android Only

Returns true if the device supports Google Pay and the user has added at least one card that Square supports. Square doesn't support all the brands apple pay supports.

  • Google Pay supported: returns true.
  • Google Pay not supported: returns false.

Throws InAppPaymentsException

Example usage

import {
  Platform
} from 'react-native';
import {
  SQIPGooglePay
} from 'react-native-square-in-app-payments';

...
if (Platform.OS === 'android') {
  try {
    let digitalWalletEnabled = await SQIPGooglePay.canUseGooglePay();
  } catch (ex) {
    // handle InAppPaymentsException
  }
}

requestGooglePayNonce

Android Only

Starts the Google Pay payment authorization and returns a nonce based on the authorized Google Pay payment token.

ParameterTypeDescription
googlePayConfiggooglePayConfigConfiguration for Google Pay
onGooglePayNonceRequestSuccessgooglePayNonceRequestSuccessCallbackSuccess callback invoked when a nonce is available.
onGooglePayNonceRequestFailuregooglePayNonceRequestFailureCallbackFailure callback invoked when SDK failed to produce a nonce.
onGooglePayCanceledgooglePayCancelCallbackCancel callback invoked when user cancels payment authorization.

Throws InAppPaymentsException

Example usage

import {
  Platform
} from 'react-native';
import {
  SQIPGooglePay
} from 'react-native-square-in-app-payments';

...
if (Platform.OS === 'android') {
  const googlePayConfig = {
    price: '1.00',
    currencyCode: 'USD',
    priceStatus: SQIPGooglePay.TotalPriceStatusFinal,
  };
  try {
    await SQIPGooglePay.requestGooglePayNonce(
      googlePayConfig,
      (cardDetails) => { ... }, // onGooglePayNonceRequestSuccess
      (errorInfo) => { ... }, // onGooglePayNonceRequestFailure
      () => { ... }, // onGooglePayCancel
    );
  } catch (ex) {
    // Handle InAppPaymentsException
  }
}

Callback functions

cardEntryNonceRequestSuccessCallback

Callback invoked when card entry is returned successfully with card details.

ParameterTypeDescription
cardDetailscardDetailsThe results of a successful card entry

Example usage

import {
  SQIPCardEntry
} from 'react-native-square-in-app-payments';

/**
 * Callback when successfully get the card nonce details for processig
 * card entry is still open and waiting for processing card nonce details
 * @param cardDetails
 */
onCardNonceRequestSuccess(cardDetails) {
  try {
    // take payment with the card details
    // await chargeCard(cardDetails);

    // payment finished successfully
    // you must call this method to close card entry
    SQIPCardEntry.completeCardEntry(
      () => { ... }, // onCardEntryComplete
    );
  } catch (ex) {
    // payment failed to complete due to error
    // notify card entry to show processing error
    SQIPCardEntry.showCardNonceProcessingError(ex.message);
  }
}

BuyerVerificationSuccessCallback

Callback invoked when Buyer Verification flow succeeds.


BuyerVerificationErrorCallback

Callback invoked when Buyer Verification flow fails.


cardEntryCancelCallback

Callback invoked when card entry canceled and has been closed.

Do not call completeCardEntry because the operation is complete and the card entry form is closed.


cardEntryCompleteCallback

Callback invoked when card entry is completed and has been closed.

Example usage

import {
  SQIPCardEntry
} from 'react-native-square-in-app-payments';

/**
 * Callback when the card entry is closed after call 'SQIPCardEntry.completeCardEntry'
 */
onCardEntryComplete() {
  // Update UI to notify user that the payment flow is completed
}

/**
 * Callback when successfully get the card nonce details for processig
 * card entry is still open and waiting for processing card nonce details
 * @param cardDetails
 */
onCardNonceRequestSuccess(cardDetails) {
  try {
    // take payment with the card details
    // await chargeCard(cardDetails);

    // payment finished successfully
    // you must call this method to close card entry
    SQIPCardEntry.completeCardEntry(
      this.onCardEntryComplete(),
    );
  } catch (ex) {
    // payment failed to complete due to error
    // notify card entry to show processing error
    SQIPCardEntry.showCardNonceProcessingError(ex.message);
  }
}

applePayNonceRequestSuccessCallback

iOS Only

Callback invoked when Apple Pay card details are available

This is called before the Apple Pay payment authorization sheet is closed. Call completeApplePayAuthorization to close the apple pay sheet.

ParameterTypeDescription
cardDetailsCardDetailsThe non-confidential details of the card and a nonce.

Example usage

import {
  Platform
} from 'react-native';
import {
  SQIPApplePay
} from 'react-native-square-in-app-payments';

...
/**
 * Callback when successfully get the card nonce details for processig
 * apple pay sheet is still open and waiting for processing card nonce details
 * @param cardDetails
 */
async onApplePayNonceRequestSuccess(cardDetails) {
  try {
    // take payment with the card nonce details
    // await chargeCard(cardDetails);

    // you must call completeApplePayAuthorization to close apple pay sheet
    await SQIPApplePay.completeApplePayAuthorization(true);
  } catch (ex) {
    // handle card nonce processing failure

    // you must call completeApplePayAuthorization to close apple pay sheet
    await SQIPApplePay.completeApplePayAuthorization(false, ex.message);
  }
}

applePayNonceRequestFailureCallback

iOS Only

Callback invoked when a card nonce cannot be generated from Apple Pay payment authorization card input values.

This callback is invoked before the native iOS Apple Pay payment authorization view controller is closed. Call completeApplePayAuthorization with an error message to let the user modify input values and resubmit.

ParameterTypeDescription
errorerrorInformation about the error condition that prevented a nonce from being generated.

Example usage

import {
  Platform
} from 'react-native';

import {
  SQIPApplePay
} from 'react-native-square-in-app-payments';

/**
 * Callback when failed to get the card nonce
 * apple pay sheet is still open and waiting for processing error information
 */
async onApplePayNonceRequestFailure(errorInfo) {
  // handle this error before close the apple pay sheet

  // you must call completeApplePayAuthorization to close apple pay sheet
  await SQIPApplePay.completeApplePayAuthorization(false, errorInfo.message);
}

applePayCompleteCallback

iOS Only

Callback invoked when the native iOS Apple Pay payment authorization sheet is closed with success, failure, or cancellation.

This callback notifies caller widget when it should switch to other views.


googlePayNonceRequestSuccessCallback

Android Only

Callback invoked when cardDetails with Google Pay are available.

ParameterTypeDescription
cardDetailscardDetailsThe non-confidential details of the card and a nonce.

Example usage

import {
  Platform
} from 'react-native';
import {
  SQIPGooglePay
} from 'react-native-square-in-app-payments';

/**
 * Callback when successfully get the card nonce details for processig
 * google pay sheet has been closed when this callback is invoked
 */
async onGooglePayNonceRequestSuccess(cardDetails) {
  try {
    // take payment with the card nonce details
    // await chargeCard(cardDetails);

  } catch (ex) {
    // handle card nonce processing failure
  }
}

googlePayNonceRequestFailureCallback

Android Only

Callback invoked a card nonce could not be obtained.

ParameterTypeDescription
errorerrorInformation about the cause of the error.

googlePayCancelCallback

Android Only

Callback invoked when Google Pay payment authorization is canceled.


Objects

cardDetails

Represents the result of a successful request to process payment card information.

FieldTypeDescription
nonceStringA one-time-use payment token that can be used with the Square Connect APIs to charge the card or save the card information.
cardCardNon-confidential details about the entered card, such as the brand and last four digits of the card number.

Example JSON

{
  "nonce": "CARD_NONCE",
  "card": {
    "brand": "VISA",
    "lastFourDigits": "1111"
  }
}

buyerVerificationDetails

Represents the result of a successful buyer verification request.

FieldTypeDescription
nonceStringA one-time-use payment token that can be used with the Square Connect APIs to charge the card or save the card information.
cardCardNon-confidential details about the entered card, such as the brand and last four digits of the card number.
tokenStringThe token representing a verified buyer.

Example JSON

{
  "nonce": "CARD_NONCE",
  "card": {
    "brand": "VISA",
    "lastFourDigits": "1111"
  },
  "token": "VERIFICATION_TOKEN"
}

card

Represents the non-confidential details of a card.

FieldTypeDescription
brandBrandThe brand (for example, VISA) of the card.
lastFourDigitsStringThe last 4 digits of this card's number.
expirationMonthintThe expiration month of the card. Ranges between 1 and 12, with 1 corresponding to January and 12 to December.
expirationYearintThe four-digit expiration year of the card.
postalCode@nullable StringThe billing postal code associated with the card.
typeCardTypeThe type of card (for example, Credit or Debit).
Note: This property is experimental and will always return UNKNOWN.
prepaidTypeCardPrepaidTypeThe prepaid type of the credit card (for example, a Prepaid Gift Card).
Note: This property is experimental and will always return UNKNOWN.

Example JSON

{
  "brand": "VISA",
  "lastFourDigits": "1111",
  "expirationMonth": 12,
  "expirationYear": 12,
  "postalCode": "98001"
}

cardEntryConfig

Represents the Card Entry configuration.

FieldTypeDescription
collectPostalCodeBooleanIndicates that the customer must enter the postal code associated with their payment card. When false, the postal code field will not be displayed. Defaults to true.
Notes: A Postal code must be collected for processing payments for Square accounts based in the United States, Canada, and United Kingdom. Disabling postal code collection in those regions will result in all credit card transactions being declined.
Optional:squareLocationIdStringThe location that is being verified against. Should be specified if calling startCardEntryFlowWithBuyerVerification method.
Optional:buyerActionStringIndicates the action (Charge or Store) that will be performed onto the card after retrieving the verification token. Should be specified if calling startCardEntryFlowWithBuyerVerification method.
Optional:amountIntPayment amount. Should be specified if calling startCardEntryFlowWithBuyerVerification method.
Optional:currencyCodeStringISO currency code of the payment amount. Should be specified if calling startCardEntryFlowWithBuyerVerification method.
Optional:givenNameStringGiven name of the contact. Should be specified if calling startCardEntryFlowWithBuyerVerification method.
Optional:familyNameStringLast name of the contact. Should be specified if calling startCardEntryFlowWithBuyerVerification method.
Optional:addressLinesArrayThe street address lines of the contact address. Should be specified if calling startCardEntryFlowWithBuyerVerification method.
Optional:cityStringThe city name of the contact address. Should be specified if calling startCardEntryFlowWithBuyerVerification method.
Optional:countryCodeStringA 2-letter string containing the ISO 3166-1 country code of the contact address. Should be specified if calling startCardEntryFlowWithBuyerVerification method.
Optional:emailStringEmail address of the contact. Should be specified if calling startCardEntryFlowWithBuyerVerification method.
Optional:phoneStringThe telephone number of the contact. Should be specified if calling startCardEntryFlowWithBuyerVerification method.
Optional:postalCodeStringThe postal code of the contact address. Should be specified if calling startCardEntryFlowWithBuyerVerification method.
Optional:regionStringThe applicable administrative region (e.g., province, state) of the contact address. Should be specified if calling startCardEntryFlowWithBuyerVerification method.

Example JSON

{
  "collectPostalCode": false,
}

applePayConfig

Represents the Apple Pay configuration.

FieldTypeDescription
priceStringThe payment authorization amount as a string.
summaryLabelStringA label that displays the checkout summary in the Apple Pay view.
countryCodeStringThe Apple Pay country code.
currencyCodeStringISO currency code of the payment amount.
Optional:paymentTypeIntType of the payment summary item, PaymentTypeFinal for default, check apple_pay_payment_type.

Example JSON

{
  "price": "1.00",
  "summaryLabel": "Apple Pay Sample",
  "countryCode": "US",
  "currencyCode": "USD",
  "paymentType": SQIPApplePay.PaymentTypeFinal,
}

googlePayConfig

Represents the Google Pay configuration.

FieldTypeDescription
priceStringThe payment authorization amount as a string.
currencyCodeStringThe ISO currency code
priceStatusIntThe status of the total price used, check google_pay_constants

Example JSON

{
  "price": "1.00",
  "currencyCode": "USD",
  "priceStatus": SQIPGooglePay.TotalPriceStatusFinal,
}

error

Contains information about a payment card processing error.

FieldTypeDescription
codeErrorCodeThe enumerated error types
messageStringA description of the usage error
debugCodeStringInformation about error state
debugMessageStringA description of the error state

Example JSON

   {
     "code" : "USAGE_ERROR",
     "message": "Something went wrong. Please contact the developer of this application and provide them with this error code: rn_invalid_type",
     "debugCode": "rn_invalid_type",
     "debugMessage": "..."
   }

InAppPaymentsException

Signals that card entry exception of some sort has occurred. This class is the general class of exceptions produced by failed payment card processing operations.

FieldTypeDescription
codeErrorCodeThe enumerated error types
messageStringA description of the usage error
debugCodeStringInformation about error state
debugMessageStringA description of the error state

Example JSON

   {
     "code" : "USAGE_ERROR",
     "message": "Something went wrong. Please contact the developer of this application and provide them with this error code: rn_apple_pay_not_initialized",
     "debugCode": "rn_apple_pay_not_initialized",
     "debugMessage": "..."
   }

IOSTheme

Encapsulates options used to style the iOS native card entry view controller.

FieldTypeDescription
Optional: fontFontThe text field font.
Optional: backgroundColorRGBAColorThe background color of the card entry view controller.
Optional: foregroundColorRGBAColorThe fill color for text fields.
Optional: textColorRGBAColorThe text field text color.
Optional: placeholderTextColorRGBAColorThe text field placeholder text color.
Optional: tintColorRGBAColorThe tint color reflected in the text field cursor and submit button background color when enabled.
Optional: messageColorRGBAColorThe text color used to display informational messages.
Optional: errorColorRGBAColorThe text color when the text is invalid.
Optional: saveButtonTitleStringThe text of the entry completion button
Optional: saveButtonFontFontThe save button font.
Optional: saveButtonTextColorRGBAColorThe save button text color when enabled.
Optional: keyboardAppearanceKeyboardAppearanceThe appearance of the keyboard.

Example JSON

{
  "font": {
    "size": 30,
  },
  "backgroundColor" :{
    "r": 239,
    "g": 239,
    "b": 244,
    "a": 1.0,
  },
  "foregroundColor" :{
    "r": 255,
    "g": 255,
    "b": 255,
  },
  "textColor" :{
    "r": 0,
    "g": 0,
    "b": 0,
    "a": 0.9,
  },
  "placeholderTextColor" :{
    "r": 0.72,
    "g": 0.72,
    "b": 0.75,
    "a": 1.00,
  },
  "tintColor" :{
    "r": 0,
    "g": 122,
    "b": 254,
    "a": 1,
  },
  "messageColor" :{
    "r": 0.72,
    "g": 0.72,
    "b": 0.75,
    "a": 1.0,
  },
  "errorColor" :{
    "r": 139,
    "g": 0,
    "b": 12,
    "a": 0.9,
  },
  "saveButtonTitle": "Pay 💳 ",
  "saveButtonFont" : {
    "size": 30,
    "name": "courier",
  },
  "saveButtonTextColor": {
    "r": 213,
    "g": 133,
    "b": 12,
    "a": 0.9,
  },
  "keyboardAppearance": "Light",
}

Constants

Apple Pay Payment Type values

ConstantTypeValueDescription
PaymentTypePendingint1A summary item representing an estimated or unknown cost.
PaymentTypeFinalint2A summary item representing the known, final cost.

Google Pay Price Status values

ConstantTypeValueDescription
TotalPriceStatusNotCurrentlyKnownint1Used for a capability check.
TotalPriceStatusEstimatedint2Total price may adjust based on the details of the response, such as sales tax collected based on a billing address.
TotalPriceStatusFinalint3Total price will not change from the amount presented to the user.

Google Pay environment values

ConstantTypeValueDescription
EnvironmentProductionint1Environment to be used when an app is granted access to the Google Pay production environment.
EnvironmentTestint3Environment to be used for development and testing an application before approval for production.

Brand

Supported brands for card payments accepted during the In-App Payments SDK checkout flow.

  • VISA - Visa Inc. credit or debit card.
  • MASTERCARD - Mastercard Incorporated credit or debit card.
  • AMERICAN_EXPRESS - American Express Company credit card.
  • DISCOVER - Discover Financial Services credit card.
  • DISCOVER_DINERS - Diners Club International credit card.
  • JCB - Japan Credit Bureau credit card.
  • CHINA_UNION_PAY - China UnionPay credit card.
  • OTHER_BRAND - An unexpected card type.

CardType

The type of card (for example, Credit or Debit). Note: This property is experimental and will always return UNKNOWN.

  • DEBIT - Debit card.
  • CREDIT - Credit card.
  • UNKNOWN - Unable to determine type of the card.

CardPrepaidType

The prepaid type of the credit card (for example, a Prepaid Gift Card). Note: This property is experimental and will always return UNKNOWN

  • PREPAID - Prepaid card.
  • NOT_PREPAID - Card that is not prepaid.
  • UNKNOWN - Unable to determine whether the card is prepaid or not.

ErrorCode

ErrorCodeCauseReturned by
usageErrorIn-App Payments SDK was used in an unexpected or unsupported way.all methods
noNetworkIn-App Payments SDK could not connect to the network.applePayNonceRequestFailureCallback, googlePayNonceRequestFailureCallback
failedSquare Buyer Verification SDK could not verify the provided card.BuyerVerificationErrorCallback
canceledThe result when the customer cancels the Square Buyer Verification flow before a card is successfully verified.BuyerVerificationErrorCallback
unsupportedSDKVersionThe version of the Square Buyer Verification SDK used by this application is no longer supportedBuyerVerificationErrorCallback