React Native Quick Start
Get started with Volume in under 5 minutes.
The React Native Volume component is a lightweight wrapper that lets you integrate Volume Transparent Checkout and start accepting payments instantly in any React Native app.
1. Install Dependencies
You need the following packages:
💡 @react-native-async-storage/async-storage stores the customer's last used payment method on the device to improve the user experience. This avoids forcing users to select their payment method repeatedly.
Installation
yarn add @getvolume/react-native @react-native-async-storage/async-storage
OR
npm install @getvolume/react-native @react-native-async-storage/async-storage
2. Setup Volume Provider
Place VolumeProvider at the root of your app. It provides global configuration and handles events.
export default function App() { return ( <VolumeProvider applicationId="123456789" // Provided by Volume volumeEnvironment="sandbox" onEvent={handleEvent} // Event handler > <App /> </VolumeProvider> ); }
VolumeProvider Props
Required Props:
Key | Type | Example | Description |
|---|---|---|---|
| string |
| Your Application ID (provided by Volume) |
| string |
| Environment: |
Optional Props:
Key | Type | Example | Description |
|---|---|---|---|
| function | Handles Volume events ( | |
| boolean |
| Show sandbox banks in addition to installed banks (redirects to browser) |
| object |
| Enable/disable optional features |
| number |
| Minimum payment amount |
| number |
| Maximum payment amount |
| string |
| Override the default button text |
| object |
| Customize button style, color, text, border |
3. Add the Volume Button
After setting up the provider, use the <Volume /> component anywhere in your app.
<Volume paymentMeta={{ amount: 50, currency: 'GBP', country: 'GB', reference: 'Example Reference', // Generate a new value on each PAYMENT_AUTHORIZED_SDP merchantPaymentId: '123456', // Generate new value on each PAYMENT_AUTHORIZED_SDP metadata: { type: 'shirt', color: 'black', owner: { name: 'John Doe', position: 'CTO' } }, merchantProvidedPayerDetails: { email: 'john.doe@example.com', name: 'John Doe', phone: '+44 20 7946 0958', account: { holderName: 'John Doe', accountNumber: '12345678', sortCode: '123456', iban: 'DE89370400440532013000', }, address: { addressLine1: '123 Main Street', addressLine2: 'Apt 4B', countryCode: 'GB', town: 'London', postCode: 'SW1A 1AA', }, useForUxFlowOptimisation: true } }} onButtonEvent={(event) => { switch (event.type) { case 'GENERIC_ERROR': console.log('GENERIC_ERROR: ') // Meta does not exist // console.log('GENERIC_ERROR: ', event.meta); break case 'PAYMENT_AMOUNT_TOO_LARGE': case 'PAYMENT_AMOUNT_TOO_SMALL': case 'PAYMENT_AUTHORIZED_SDP': case 'PAYMENT_INITIATED': console.log(`${event.type}: ${event.meta?.merchantPaymentId}`) break case 'PAYMENT_ERROR': console.log( `PAYMENT_ERROR: ${event.meta?.merchantPaymentId} | ${event.meta?.error}` ) break default: break } }} buttonContainerStyles={{ marginBottom: 50 }} isButtonEnabled={true} />
Props Overview
paymentMeta (required) – Details for the payment:
Key | Type | Description |
|---|---|---|
| number | Payment amount |
| string | ISO 4217 currency code |
| string | ISO 3166-1 alpha-2 country code |
| string | Bank transfer reference |
| string | Unique ID for the payment |
| JSON object | Optional, returned via webhooks |
| object | Optional payer info for better UX |
| function | Event callback for button events |
Other optional props: buttonContainerStyles, isButtonEnabled.
Metadata
Metadata must be a valid JSON object (not a string, number, or array). Nested objects are allowed:
metadata: { id: '0001', type: 'donut', batters: { batter: [{ id: '1001', type: 'Regular' }] } }
Regenerating Merchant Payment ID
Each time the event PAYMENT_AUTHORIZED_SDP occurs, generate a new unique Merchant Payment ID.
Merchant Provided Payer Details
Pre-fill payer information to improve UX and enable Confirmation of Payer.
Benefits:
Automatic bank detection (IBAN for EURO payments)
Faster checkout with pre-filled forms
Verify account holders against KYC data
Example:
merchantProvidedPayerDetails: { email: 'john.doe@example.com', name: 'John Doe', phone: '+44 20 7946 0958', account: { holderName: 'John Doe', accountNumber: '12345678', sortCode: '123456', iban: 'DE89370400440532013000' }, address: { addressLine1: '123 Main Street', addressLine2: 'Apt 4B', countryCode: 'GB', town: 'London', postCode: 'SW1A 1AA' }, useForUxFlowOptimisation: true }
Rules:
Use either IBAN (EUR) or account number + sort code (GBP), not both.
Ensure the
countrymatches the IBAN if provided.
4. iOS Bank Detection Setup
Add supported bank schemes in your Info.plist:
<key>LSApplicationQueriesSchemes</key> <array> <string>BMBGB</string> <string>revolut</string> <string>natwestbank</string> <string>monzo</string> <string>santanderretail</string> <string>rbs</string> <string>lloyds-retail</string> <string>ukcomhsbcmobilebanking</string> <string>zappcfi437759</string> <string>hsbc-pwnwguti5z</string> <string>zapp</string> <string>launchAIB</string> <string>ie.aib.mobilebanking</string> <string>BOIOneAPP</string> <string>halifax-retail</string> <string>starlingbank</string> <string>tescobank</string> <string>tsbmobile</string> <string>sparda-app</string> <string>bankingappspardaproduktion</string> <string>secureappspardaproduktion</string> <string>sapp-pushtan</string> <string>sapp-invest</string> <string>de.sparda.securego</string> <string>bos-retail</string> <string>launchbca</string> <string>comfirstdirectbankingonthego</string> <string>cs-com.virginmoney.uk.mobile.ios</string> <string>transferwise</string> <string>ybssavings</string> <string>chase-international</string> </array>
This allows Volume to detect installed banking apps and show only relevant options.
5. Testing
Use sandbox environment before going live.
Sandbox testing opens banks in a browser instead of the app.
Use Sandbox Bank Credentials to test with Natwest Sandbox and other banks.
VolumeEvent Structure
The VolumeEvent object is passed as the only parameter to the onEvent function in VolumeProvider.
export interface VolumeEvent { /** * Unique event type */ type: VolumeEventType; /** * Unix timestamp when the event occurred */ time: number; /** * Event-specific metadata (optional) */ meta?: Record<string, any>; }
VolumeEventType
The type field in VolumeEvent can be one of the following:
PAYMENT_INITIATED
'PAYMENT_INITIATED'
Occurs when a payment is initiated.
PAYMENT_AUTHORIZED_SDP
'PAYMENT_AUTHORIZED_SDP'
Occurs when a payment is authorized and the callback to the merchant app will be triggered.
PAYMENT_ERROR
'PAYMENT_ERROR'
Occurs when a payment fails, for example due to bank-specific rules or errors.
GENERIC_ERROR
'GENERIC_ERROR'
Occurs when any general error happens related to the Volume React component, such as failing to fetch the list of supported banks.
PAYMENT_AMOUNT_TOO_SMALL
'PAYMENT_AMOUNT_TOO_SMALL'
Occurs when the payment amount is too small.
PAYMENT_AMOUNT_TOO_LARGE
'PAYMENT_AMOUNT_TOO_LARGE'
Occurs when the payment amount is too large.