React Native SDK Reference
React Native SDK > Reference
Below is a summary of objects and methods most applicable to the latest version of the React Native SDK.
The SDK refers to these community projects for Apple Pay and Google Pay support:
The SDK refers to these community projects for general support:
- @gorhom/react-native-bottom-sheet
- @gorhom/react-native-reanimated
- @gorhom/react-native-gesture-handler
- @gorhom/react-native-bottom-sheet
- @react-native-clipboard/clipboard
- @lucide-icons/lucide
WestpacProvider
A component to configure the payment gateway and available payment methods. All components such as PaymentSheet must be descendants of WestpacProvider.
EXAMPLE
<WestpacProvider
apiConfig={{
gateway: "quickstream",
merchantIdentifier: "MYBUSINESS",
publishableKey: "MY_PUBLISHABLE_KEY",
}}
paymentProviders={{
directDebit: {},
payTo: {},
payId: {
helpUrl: "https://www.westpac.com.au/personal-banking/online-banking/making-the-most/payid/",
merchantName: "My Business",
},
card: {},
applePay: {
merchantIdentifier: "merchant.com.ab1234567890",
},
googlePay: {
gatewayMerchantId: "qvalent",
merchantInfo: {
merchantId: "AB1234567890",
},
},
}}
>
</WestpacProvider>
PROPERTIES
| Name | Type | Description |
|---|---|---|
themeConfig |
ThemeConfig |
Optional. Your theming configuration. |
apiConfig |
ApiConfig |
Your QuickStream facility configuration. |
paymentProviders |
PaymentProvidersObject |
The payment methods to be made available in the Payment Sheet UI. |
ApiConfig
Provide your QuickStream facility configuration.
PROPERTIES
| Name | Type | Description |
|---|---|---|
gateway |
string |
quickstream |
publishableKey |
string |
Your Publishable API key. |
merchantIdentifier |
string |
A Supplier Business Code in your QuickStream facility. |
environment |
string |
Optional. Set to dev to use the Test environment, or prod for the Production environment. Defaults to dev. |
PaymentProvidersObject
Provide the payment methods to be made available in the Payment Sheet UI.
PROPERTIES
| Name | Type | Description |
|---|---|---|
order |
array of string |
Optional. Provide to change the order of some payment methods in the Payment Sheet UI. Defaults to ["card","directDebit","payTo","payId"] when not provided. The Apple Pay or Google Pay button is always displayed first. |
card |
CardProviderConfig |
Optional. Provide to display Card as an option in the Payment Sheet UI. |
directDebit |
DirectDebitProviderConfig |
Optional. Provide to display Direct Debit (Australian Bank Accounts) as an option in the Payment Sheet UI. |
payId |
PayIdProviderConfig |
Optional. Provide to display PayID as an option in the Payment Sheet UI. |
payTo |
PayToProviderConfig |
Optional. Provide to display PayTo as an option in the Payment Sheet UI. |
applePay |
ApplePayProviderConfig |
Optional. Provide to display Apple Pay as an option in the Payment Sheet UI. |
googlePay |
GooglePayProviderConfig |
Optional. Provide to display Google Pay as an option in the Payment Sheet UI. |
| any | CustomPaymentTypeConfig |
Optional. Provide configuration for handling custom payment types in the Payment Sheet UI. |
CardProviderConfig
Provide to display Card as a payment method in the Payment Sheet UI. Card allows you to collect a credit or debit card details, and to display your configured surcharge rates.
PROPERTIES
| Name | Type | Description |
|---|---|---|
showLabels |
boolean |
Optional. Set to false to hide field labels. Defaults to true. |
cvnRequired |
boolean |
Optional. Set to false to hide the CVN field. Use this when configuring the Payment Sheet to register an account without taking a payment first. Defaults to true. |
savePaymentDetails |
SavePaymentDetails |
Optional. Provide to configure a checkbox for the user to indicate they wish to save their payment details for later. |
skipSurchargeCalculation |
boolean |
Optional. Set to true to skip calculating the surcharge based on the card entered. This option requires you to calculate any applicables fees or surcharges before initialising the Payment Sheet UI. Defaults to false. |
DirectDebitProviderConfig
Provide to display Direct Debit as a payment method in the Payment Sheet UI. Direct Debit allows you to collect an Australian Bank Account details.
PROPERTIES
| Name | Type | Description |
|---|---|---|
finalisePaymentButtonText |
string |
Optional. Provide alternative button text for the finalise button in the Payment Sheet UI. Defaults to "Authorise $${finalPrice}". |
showLabels |
boolean |
Optional. Set to false to hide field labels. Defaults to true. |
savePaymentDetails |
SavePaymentDetails |
Optional. Provide to configure a checkbox for the user to indicate they wish to save their payment details for later. |
PayIdProviderConfig
Provide to display PayID as a payment method in the Payment Sheet UI. PayID allows you to generate a PayID and display it in the Payment Sheet UI.
PROPERTIES
| Name | Type | Description |
|---|---|---|
helpUrl |
string |
Optional. A URL to a help page on how to pay with PayID. Displayed as a help link in the Payment Sheet UI. |
merchantName |
string |
Optional. The name to appear on the PayID page in the Payment Sheet UI. Provide the name the PayID is registered for so that customers can match this to the one displayed in their internet banking app. |
PayToProviderConfig
Provide to display PayTo as a payment method in the Payment Sheet UI. PayTo allows you to collect an Australian Bank Account (BSB and Account Number) or PayID.
PROPERTIES
| Name | Type | Description |
|---|---|---|
showLabels |
boolean |
Optional. Set to false to hide field labels. Defaults to true. |
ApplePayProviderConfig
Provide to display Apple Pay as a payment method in the Payment Sheet UI. Apple Pay allows you to display an Apple Pay button and trigger the Apple Pay Payment Sheet UI.
PROPERTIES
| Name | Type | Description |
|---|---|---|
currencyCode |
string |
Optional. Defaults to AUD. |
countryCode |
string |
Optional. Optional. Defaults to AU. |
merchantIdentifier |
string |
Your Apple Pay merchant ID. |
supportedNetworks |
array of SupportedNetworkEnum |
Provide the card schemes you accept. These must match the configuration in your QuickStream facility. See Apple Developer - PKPaymentNetwork. |
merchantCapabilities |
array of IosPKMerchantCapability |
Provide PKMerchantCapability3DS, PKMerchantCapabilityCredit and PKMerchantCapabilityDebit. See Apple Developer - PKMerchantCapability. |
buttonType |
string |
The ApplePayButtonType. Defaults to plain. |
skipSurchargeCalculation |
boolean |
Optional. If true, skips card type selection and surcharge calculation. You must pre-calculate any fees/surcharges and specify supported card networks in supportedNetworks. Defaults to false. |
GooglePayProviderConfig
Provide to display Google Pay as a payment method in the Payment Sheet UI. Google Pay allows you to display a Google Pay button and trigger the Google Pay Payment Sheet UI.
PROPERTIES
| Name | Type | Description |
|---|---|---|
currencyCode |
string |
Optional. Defaults to AUD. |
countryCode |
string |
Optional. Optional. Defaults to AU. |
gatewayMerchantId |
string |
Your QuickStream community code. |
cardParameters |
CardParameters |
Define the accepted card schemes and methods. |
merchantInfo |
MerchantInfo |
Define your Google Merchant ID and name. Register with the Google Pay & Wallet Console and use the assigned merchant ID for your integration. |
buttonType |
ButtonType |
Optional. Change the Google Pay button type. Defaults to GooglePayButtonConstants.Types.Plain. |
skipSurchargeCalculation |
boolean |
Optional. If true, skips card type selection and surcharge calculation. You must pre-calculate any fees/surcharges and specify supported card networks in cardParameters. Defaults to false. |
CustomPaymentTypeConfig
Provide to display any custom payment type as a payment method in the Payment Sheet UI. For example, if you have integration into PayPal or Buy-now Pay-later and Wallet providers, you can display these in the Payment Sheet UI.
EXAMPLE
paymentProviders={{
order: ["card", "paypal"],
paypal: {
id: "paypal",
displayName: "PayPal",
icon: <Text>PayPal</Text>,
} as CustomPaymentTypeConfig,
card: {}
}}
PROPERTIES
| Name | Type | Description |
|---|---|---|
id |
string |
An identifier that is passed to the onCustomPaymentInitiation callback function. |
displayName |
string |
A name to display in the Payment Sheet UI. |
icon |
React.JSX.Element |
An icon to display in the Payment Sheet UI. |
SavePaymentDetails
PROPERTIES
| Name | Type | Description |
|---|---|---|
default |
boolean |
Optional. Set to true to tick the Save Payment Details checkbox in the Payment Sheet UI. Defaults to false. |
hidden |
boolean |
Optional. Set to true to hide the Save Payment Details checkbox in the Payment Sheet UI. Defaults to false. |
text |
string |
Optional. Provide the Save Payment Details checkbox label text in the Payment Sheet UI. Defaults to "Save payment details." |
PaymentSheet
Configure the pre-built Payment Sheet UI for customers to enter their payment details.
EXAMPLE
<PaymentSheet
onPaymentSubmitted={onPaymentSubmitted}
onPaymentFailure={onPaymentFailure}
onPayIdInitiation={onPayIdInitiation}
lineItems={[
{
label: "Purchase amount",
amount: purchaseAmount,
},
{
label: "Administration fee",
amount: adminFee,
},
]}
/>
PROPERTIES
| Name | Type | Description |
|---|---|---|
isOpen |
boolean |
true when the Payment Sheet UI is open, otherwise false. |
openPaymentSheet |
function |
Optional. A function to open the Payment Sheet UI manually. |
closePaymentSheet |
function |
Close the Payment Sheet UI. |
onPaymentSubmitted |
function |
Use to handle sending a singleUseTokenId to your server for processing a transaction or storing a account details, or determining an existing saved payment method selected by the customer. |
onPaymentFailure |
function |
Use to handle error conditions. |
onPayIdInitiation |
function |
Use to provide a PayID and an optional reference for your customer to pay via their banking app. |
onCustomPaymentInitiation |
function |
Use to handle when a user selects a custom payment method in the Payment Sheet UI. |
lineItems |
array of LineItem |
Optional. Provide individual items that make up a purchase. The total amount displayed in the Payment Sheet UI is calculated based on the summed amount of each item. Individual line items are displayed on the Apple Pay and Google Pay Payment Sheet UI. |
setSavedPaymentMethods |
function |
Optional. A function to set existing payment methods to display to the user to choose from. |
openPaymentSheet ( screen?: DirectScreenType, backButton: boolean ) → void
A function to open the Payment Sheet UI. Optionally provide the DirectScreenType and if the backButton is displayed to the user.
DirectScreenType
One of the following:
PaymentSelectorScreenCreditCardScreenDirectDebitScreenPayToIdScreenPayToBsbScreenPayIdScreen
closePaymentSheet() → void
Close the Payment Sheet UI.
onPaymentSubmitted( payment: PaymentSubmission ) → void
A callback function which is executed once:
- a single-use-token is retrieved from QuickStream, or
- a saved payment method was selected by the customer.
EXAMPLE
async function onPaymentSubmitted(payment: PaymentSubmission) {
if(payment.type == "single-use") {
console.log(payment.token.singleuseTokenId);
} else if (payment.type == "saved") {
console.log(payment.accountToken);
}
}
PARAMETERS
| Name | Type | Description |
|---|---|---|
payment |
PaymentSubmission |
The result of the user selection in the Payment Sheet UI. |
PaymentSubmission
An object, provided as an argument to onPaymentSubmitted(), representing a successful outcome of user interaction in the Payment Sheet UI.
PROPERTIES
| Name | Type | Description |
|---|---|---|
type |
string |
One of single-use or saved. |
token |
SingleUseTokenResponse |
When single-use, the SingleUseTokenResponse. |
accountToken |
string |
When type=saved, the accountToken of a saved card or bank account. |
SingleUseTokenResponse
An object containing:
- a
singleUseTokenIdis returned in the response, - the masked account details and surcharge percentage (if applicable) are returned in the response for you to use in a confirmation step,
- the account details are stored in QuickStream for 10 minutes,
- a boolean property
savePaymentDetailsrepresenting if the customer has selected to save their payment details.
You should send the singleUseTokenId in a request from your server to:
PROPERTIES
| Name | Type | Description |
|---|---|---|
savePaymentDetails |
boolean |
true when the customer has selected the checkbox in the Payment Sheet UI to save their payment details. Otherwise false. See SavePaymentDetails. |
| others | others | Other properties in this object are based on the Single-use Token Response Model. |
onPaymentFailure( error ) → void
A callback function to be executed on error conditions.
EXAMPLE
async function onPaymentFailure(error: OnPaymentFailureError) {
console.log("code:", error.code);
console.log("type:", error.type);
console.log("message:", error.message);
console.log("details?:", error.details);
}
PROPERTIES
| Name | Type | Description |
|---|---|---|
error |
OnPaymentFailureError |
Details of an error condition. |
OnPaymentFailureError
This object represents an error condition.
PROPERTIES
| Name | Type | Description |
|---|---|---|
code |
WestpacErrorCode |
The type of error condition. |
type |
WestpacErrorType |
The area in which the error condition occurred. |
message |
string |
A description of the error. |
details |
WestpacErrorDetails |
Raw error information. |
WestpacErrorCode
Indicates the type of error condition.
VALUES
| Name | Type | Description |
|---|---|---|
ApiError |
api-error |
An error occurred while processing a request to the QuickStream REST API. |
UserCodeError |
user-code-error |
The area in which the error condition occurred. |
UnknownError |
unknown-error |
An unexpected error. See message and details for more. |
WestpacErrorType
Indicates the area that the error condition occurred.
VALUES
| Name | Type | Description |
|---|---|---|
ApiSetup |
api-setup |
An error occurred while processing the data provided in ApiConfig. |
ApplePay |
apple-pay |
An error occurred during Apple Pay processing. |
Card |
card |
An error occurred during Card processing. |
DirectDebit |
direct-debit |
An error occurred during Direct Debit processing. |
GooglePay |
google-pay |
An error occurred during Google Pay processing. |
PayId |
payid |
An error occurred during PayID processing.. |
PayTo |
payto |
An error occurred during PayTo processing. |
SingleUseToken |
single-use-token |
An error occurred while processing a request to the Single-use-tokens API. |
Surcharge |
surcharge |
An error occurred while processing the surcharge rates from the Businesses API. |
WestpacErrorDetails
This type provides additional details about the error condition.
PROPERTIES
| Name | Type | Description |
|---|---|---|
rawError |
Error |
Optional. The underlying error. |
| any | any | Optional. Additional fields provided for clarity. |
onPayIdInitiation() → PayIdInitiationResponse
A callback function to be executed to retrieve a PayID to display to your customer in the Payment Sheet UI. In this function you may call your server to generate a PayID using the PayIDs API, or retrieve a pre-generated PayID.
Return a PayIdInitiationResponse containing the PayID and an optional reference number.
EXAMPLE
async function onPayIdInitiation() {
const [email, referenceNumber] = await generatePayId();
return { email, referenceNumber };
}
PayIdInitiationResponse
PROPERTIES
| Name | Type | Description |
|---|---|---|
email |
string |
A PayID for this customer. Generate a PayID using the PayIDs API from your server. |
referenceNumber |
string |
Optional. A reference number your customer can use to provide as a description in their internet banking. |
onCustomPaymentInitiation( id ) → void
A callback function to be executed when a custom payment method was selected in the Payment Sheet UI. The id identifies the custom payment method that was selected when multiple are configured.
EXAMPLE
async function onCustomPaymentMethodSelected( id: string ) {
// handle a custom payment method based on the id argument.
}
LineItem
PROPERTIES
| Name | Type | Description |
|---|---|---|
label |
string |
A label for the line item. |
amount |
number |
The amount of a payment item. The total purchase amount displayed in the Payment Sheet UI is calculated from the sum of all amount fields provided. |
PaymentMethodSource
One of:
CustomerPaymentBankAccountModel
An object closely matching Bank Account Customer Account Model.
CustomerPaymentCreditCardModel
An object closely matching Card Customer Account Model.
setSavedPaymentMethods( methods: PaymentMethodSource[] ) → void
A function to be called from within the WestpacProvider context to set saved cards or bank accounts for the customer.
This function accepts an array of PaymentMethodSource.
QuickStreamGateway
A class that exposes helper functions to build a custom UI using this SDK. Provide your ApiConfig containing your QuickStream facility details and Publishable API key.
EXAMPLE
export const quickStreamApi = new QuickStreamGateway(apiConfig);
PROPERTIES
| Name | Type | Description |
|---|---|---|
createSingleUseToken |
function |
A function that accepts SingleUseTokenRequestData and returns a Single-use token |
getSurcharges |
function |
A function that returns an array of surcharge information. |
createSingleUseToken ( data ) → string
Creates a single-use token using the Single-use Tokens API. Provide an implementation of SingleUseTokenRequestData containing the payment account information you have collected.
SingleUseTokenRequestData
An interface with these implementations:
- QuickstreamCardSingleUseTokenRequestData
- QuickstreamPayToSingleUseTokenRequestData
- QuickstreamDirectDebitSingleUseTokenRequestData
- QuickstreamGooglePaySingleUseTokenRequestData
- QuickstreamApplePaySingleUseTokenRequestData
QuickstreamCardSingleUseTokenRequestData
Provide to createSingleUseToken() to request a singleUseTokenId for a card account.
PROPERTIES
| Name | Type | Description |
|---|---|---|
supplierBusinessCode |
string |
A business in your facility to be used for validation of other fields. Accepted values can be obtained via the Businesses API. |
accountType |
string |
CREDIT_CARD |
cardholderName |
string |
Optional. Name printed on the card. |
cardNumber |
string |
Digits printed on the card. |
expiryDateMonth |
string |
Two digit expiry month. |
expiryDateYear |
string |
Four digit expiry year. |
cvn |
string |
Optional. Card Verification Number. Also known as Security Code, CVV2 and CVC2. The three or four digit security code. |
QuickstreamDirectDebitSingleUseTokenRequestData
Provide to createSingleUseToken() to request a singleUseTokenId for an Australian Bank Account.
PROPERTIES
| Name | Type | Description |
|---|---|---|
supplierBusinessCode |
string |
A business in your facility to be used for validation of other fields. Accepted values can be obtained via the Businesses API. |
accountType |
string |
DIRECT_DEBIT |
accountName |
string |
Name of account holder. |
bsb |
string |
The bank-state-branch holding their account. |
accountNumber |
string |
The account number at that branch. |
QuickstreamPayToSingleUseTokenRequestData
Provide to createSingleUseToken() to request a singleUseTokenId for a PayTo Payer Account.
PROPERTIES
| Name | Type | Description |
|---|---|---|
supplierBusinessCode |
string |
A business in your facility to be used for validation of other fields. Accepted values can be obtained via the Businesses API. |
accountType |
string |
PAYTO |
payId |
string |
Required when payIdType is provided. The PayID for the Payer's payment account. |
payIdType |
string |
Required when payId is provided. One of EMAL, TELI, AUBN, ORGN. |
bsb |
string |
Required when accountNumber is provided. The 6 digit BSB for the Payer's payment account. |
accountNumber |
string |
Required when bsb is provided. The 6 to 9 digit Account Number for the Payer's payment account. |
payerType |
string |
The type of payer. One of ORGN, PERS. |
payerName |
string |
The Payer's name. |
QuickstreamGooglePaySingleUseTokenRequestData
Provide to createSingleUseToken() to request a singleUseTokenId for Google Pay.
EXAMPLE
import { quickStreamApi } from "./your-api-service-file";
import {
PaymentRequest,
PaymentMethodNameEnum,
SupportedNetworkEnum,
EnvironmentEnum,
} from "@rnw-community/react-native-payments";
const handleGooglePay = async () => {
const methodData = [
{
supportedMethods: PaymentMethodNameEnum.AndroidPay,
data: {
supportedNetworks: [
SupportedNetworkEnum.Visa,
SupportedNetworkEnum.Mastercard,
],
environment: EnvironmentEnum.Test, // Use 'Production' for release
countryCode: "AU",
currencyCode: "AUD",
gatewayConfig: {
gateway: "quickstream",
gatewayMerchantId: quickStreamApi.config.merchantIdentifier,
},
},
},
];
const paymentDetails = {
total: {
label: "Your Merchant Name",
amount: { currency: "AUD", value: "15.00" },
},
};
const paymentRequest = new PaymentRequest(methodData, paymentDetails);
try {
const response = await paymentRequest.show();
if (!response) {
console.log("User cancelled Google Pay.");
return null;
}
const googlePayToken = response.details.androidPayToken;
const cardDetails = response.details.androidPayToken.cardInfo.cardDetails;
const token = await quickStreamApi.createSingleUseToken({
displayAccountNumber: cardDetails,
googlePayToken,
supplierBusinessCode: "MYBUSINESS",
accountType: "GOOGLE_PAY",
});
console.log("Successfully created gateway token:", token.singleUseTokenId);
return gatewayToken;
} catch (error) {
console.error("Google Pay process failed:", error);
return null;
}
};
PROPERTIES
| Name | Type | Description |
|---|---|---|
supplierBusinessCode |
string |
A business in your facility to be used for validation of other fields. Accepted values can be obtained via the Businesses API. |
accountType |
string |
GOOGLE_PAY |
googlePayToken |
PaymentMethodTokenizationData.token |
Provide PaymentMethodTokenizationData.token. |
accountType |
string |
Provide CardInfo.cardDetails. |
QuickstreamApplePaySingleUseTokenRequestData
Provide to createSingleUseToken() to request a singleUseTokenId for Apple Pay.
EXAMPLE
import { quickStreamApi } from "./your-api-service-file";
import {
PaymentRequest,
PaymentMethodNameEnum,
SupportedNetworkEnum,
} from "@rnw-community/react-native-payments";
const handleApplePay = async () => {
const methodData = [
{
supportedMethods: PaymentMethodNameEnum.ApplePay,
data: {
merchantIdentifier: "merchant.com.your-app.namespace",
supportedNetworks: [
SupportedNetworkEnum.Visa,
SupportedNetworkEnum.Mastercard,
],
countryCode: "AU",
currencyCode: "AUD",
},
},
];
const paymentDetails = {
total: {
label: "Your Merchant Name",
amount: { currency: "AUD", value: "15.00" },
},
};
const paymentRequest = new PaymentRequest(methodData, paymentDetails);
try {
const response = await paymentRequest.show();
if (!response) {
console.log("User cancelled Apple Pay.");
return null;
}
const applePayToken = response.details.applePayToken;
const displayName =
response.details.applePayToken.paymentMethod.displayName;
const cardDetails = displayName.trim().split(" ").pop() ?? "1234"; // in a simulator Apple returns "Simulated Instrument"
const gatewayToken = await quickStreamApi.createPaymentToken({
displayAccountNumber: cardDetails,
applePayToken,
supplierBusinessCode: "MYBUSINESS",
accountType: "APPLE_PAY",
});
console.log("Successfully created gateway token:", gatewayToken);
response.complete("success");
return gatewayToken;
} catch (error) {
console.error("Apple Pay process failed:", error);
return null;
}
};
PROPERTIES
| Name | Type | Description |
|---|---|---|
supplierBusinessCode |
string |
A business in your facility to be used for validation of other fields. Accepted values can be obtained via the Businesses API. |
accountType |
string |
APPLE_PAY |
applePayToken |
PKPaymentToken |
Provide PKPaymentToken as JSON. |
accountType |
string |
Provide the last 4 digits of the value from PKPaymentMethod.displayName. |
getSurcharges() → SurchargeDetail[]
Returns an array of SurchargeDetail to list card surcharges using the Businesses API.
EXAMPLE
import { quickStreamApi } from "./your-api-service-file";
async function fetchSurcharges() {
try {
const surcharges = await quickStreamApi.getSurcharges();
console.log("Available surcharges:", surcharges);
// The response is an array of SurchargeDetail objects:
// [{ scheme: 'visa', type: 'credit', rate: 1.5 }, ...]
return surcharges;
} catch (error) {
console.error("Failed to fetch surcharges:", error);
return null;
}
}
SurchargeDetail
Represents a card scheme surcharge configured in your QuickStream facility.
PROPERTIES
| Name | Type | Description |
|---|---|---|
scheme |
CardSchemes |
The card scheme. E.g. visa or mastercard. |
type |
CardTypes |
The type of card. E.g. debit or credit. |
rate |
number |
The surcharge percentage. |
CardSchemes
VALUES
| Name | Value |
|---|---|
Visa |
visa |
Mastercard |
mastercard |
Amex |
amex |
JCB |
jcb |
Unionpay |
unionpay |
CardTypes
VALUES
| Name | Value |
|---|---|
Debit |
debit |
Credit |
credit |
ApplePayButton
A component that renders an Apple Pay button. Use in conjunction with createSingleUseToken() and QuickStreamApplePaySingleUseTokenRequestData.
EXAMPLE
import React from "react";
import { View } from "react-native";
import { ApplePayButton } from "@westpac-developers/sdk";
const MyPaymentScreen = () => {
const handleApplePay = async () => {
// Handle Apple Pay
};
return (
<View>
<ApplePayButton onPress={handleApplePay} />
</View>
);
};
PROPERTIES
| Name | Value | Description |
|---|---|---|
onPress |
function |
A callback function executed when the Apple Pay button is pressed. |
buttonLabel |
ApplePayButtonType | Optional. Change the Apple Pay button type. Defaults to plain. |
theme |
string |
One of light or dark. |
GooglePayButton
A component that renders a Google Pay button. Use in conjunction with createSingleUseToken() and QuickStreamGooglePaySingleUseTokenRequestData.
EXAMPLE
import React from "react";
import { View } from "react-native";
import { GooglePayButton } from "@westpac-developers/sdk";
const MyPaymentScreen = () => {
const handleGooglePay= async () => {
// Handle Google Pay
};
return (
<View>
<GooglePayButton onPress={handleGooglePay} />
</View>
);
};
PROPERTIES
| Name | Type | Description |
|---|---|---|
onPress |
function |
A callback function executed when the Google Pay button is pressed. |
buttonLabel |
ButtonType |
Optional. Change the Google Pay button type. Defaults to GooglePayButtonConstants.Types.Plain. |
theme |
string |
One of light or dark. |
ThemeConfig
Provide your theming configuration.
EXAMPLE
{
mode: "light",
theme: {
darkColors: {
primary: "#da1710"
},
components: {
button: {
primary: {
view: {
borderRadius: 10
}
}
}
}
}
}
PROPERTIES
| Name | Type | Description |
|---|---|---|
mode |
string |
Optional. One of: light , dark or system . Defaults to system . |
theme |
Theme |
Optional. Theme overrides for colours, fonts, components etc. |
Theme
Provide to modify the light and dark colours, and components in the Payment Sheet UI.
PROPERTIES
| Name | Type | Description |
|---|---|---|
lightColors |
Colors |
Optional. Modify the set of light colors to be displayed when mode=light or mode=system and the device is using light mode. |
darkColors |
Colors |
Optional. Modify the set of dark colors to be displayed when mode=light or mode=system and the device is using dark mode. |
components |
ComponentTheme |
Optional. Modify the theme for components in the Payment Sheet UI. |
Colors
Each of the following properties can be provided as a string hex color value starting with #.
backgroundtexttextMutedprimaryprimaryTextsecondarysecondaryTextsecondaryBordertextInputBackgroundtextInputBordertextInputPlaceholderTexterrorerrorLightsegmentedControlBackgroundsegmentedControlActiveBackgroundsegmentedControlActiveTextsegmentedControlMutedText
ComponentTheme
PROPERTIES
| Name | Type | Description |
|---|---|---|
textInput |
TextStyle |
Optional. |
button |
ButtonTheme |
Optional. |
segmentedControl |
StyleSet |
Optional. |
segmentedControlButton |
StyleSet |
Optional. |
segmentedControlButtonActive |
StyleSet |
Optional. |
text |
TextTheme |
Optional. |
ButtonTheme
Each of the following optional properties can be provided as a StyleSet.
baseprimarysecondarylinkpaymentSelectcardSelect
TextTheme
Each of the following optional properties can be provided as a TextStyle.
defaulttitlesemiBoldsubtitleerrornote
StyleSet
PROPERTIES
| Name | Type | Description |
|---|---|---|
view |
ViewStyle |
Optional. |
text |
TextStyle |
Optional. |
API Headers
The following headers are sent to QuickStream for each request to the Single-use Tokens API and the Businesses API.
| Header | Description |
|---|---|
X-Qvalent-Sdk-Applicationpackagename |
The consuming applications package name. E.g. com.payments.westpac |
X-Qvalent-Sdk-Devicemodel |
The device module. E.g. iPhone17,1 |
X-Qvalent-Sdk-Devicename |
The device name. E.g. iPhone 16 Pro |
X-Qvalent-Sdk-Ipaddress |
The device IP address. E.g. 192.168.1.1 |
X-Qvalent-Sdk-Locale |
The device locale. E.g. en-AU |
X-Qvalent-Sdk-Osname |
The device operating system name. E.g. iOS |
X-Qvalent-Sdk-Osversion |
The device operating system version. E.g. 18.5 |
X-Qvalent-Sdk-Platform |
The device platform. E.g. ios |
X-Qvalent-Sdk-Screenresolution |
The device screen resolution. E.g. 1206x2622 |
X-Qvalent-Sdk-Timezone |
The device timezone. E.g. Australia/Sydney |
X-Qvalent-Sdk-Version |
The SDK version. E.g. 1.1.0 |