You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bolt React Native SDK for payments. Provides Credit Card tokenization, 3D Secure verification, Apple Pay, and Google Pay — all integrated with the Bolt payment platform.
Architecture
Credit Card & 3DS — WebView-based, loading secure pages from connect.bolt.com. Card data never touches your app (PCI compliant).
Apple Pay & Google Pay — Native Fabric view components for buttons (PKPaymentButton on iOS, PayButton on Android) with TurboModules for the payment sheet.
Installation
npm install @boltpay/react-native react-native-webview
# or
yarn add @boltpay/react-native react-native-webview
For iOS:
cd ios && pod install
Requirements
React Native >= 0.73.0
React >= 18.0.0
react-native-webview >= 13.0.0
Quick Start
1. Initialize Bolt
import{Bolt,BoltProvider}from'@boltpay/react-native';constbolt=newBolt({publishableKey: 'YOUR_PUBLISHABLE_KEY',environment: 'sandbox',// or 'production'});functionApp(){return(<BoltProviderclient={bolt}><CheckoutScreen/></BoltProvider>);}
2. Credit Card Payment
import{CreditCard,useThreeDSecure}from'@boltpay/react-native/payments';functionCheckoutScreen(){constcc=CreditCard.useController();constthreeDSecure=useThreeDSecure();// Listen for field eventscc.on('valid',()=>setCanSubmit(true));cc.on('error',(msg)=>setFieldError(msg));consthandlePayment=async()=>{// 1. Tokenize — returns TokenResult | Error (never throws)constresult=awaitcc.tokenize();if(resultinstanceofError){console.error(result.message);return;}// result: { token?, last4?, bin?, network?, expiration?, postal_code? }// 2. Fetch 3DS reference ID — throws ThreeDSError on failureconstreferenceID=awaitthreeDSecure.fetchReferenceID({token: result.token,bin: result.bin,last4: result.last4,});// 3. Send token to your backend to create the paymentconstpaymentResponse=awaityourApi.createPayment(result);// 4. Handle 3DS challenge if required — returns ThreeDSResult (never throws)if(paymentResponse['.tag']==='three_ds_required'){constchallengeResult=awaitthreeDSecure.challengeWithConfig(paymentResponse.id,{
referenceID,jwtPayload: paymentResponse.jwt_payload,stepUpUrl: paymentResponse.step_up_url,});if(!challengeResult.success){console.error(challengeResult.error?.message);}}};return(<><CreditCard.Componentcontroller={cc}/><threeDSecure.Component/><ButtononPress={handlePayment}title="Pay"/></>);}
3. 3DS with Stored Card ID
If you've already added a card via Bolt's Add Card API and have a creditCardID, you can perform 3DS without re-tokenizing:
import{useThreeDSecure}from'@boltpay/react-native/payments';functionStoredCardPayment(){constthreeDSecure=useThreeDSecure();consthandlePayment=async(creditCardId: string,expiration: string)=>{// Fetch 3DS reference using stored card IDconstreferenceID=awaitthreeDSecure.fetchReferenceID({id: creditCardId,
expiration,});// Create payment on your backend with the 3DS referenceconstpaymentResponse=awaityourApi.createPayment({
creditCardId,
referenceID,});// Handle 3DS challenge if requiredif(paymentResponse['.tag']==='three_ds_required'){constresult=awaitthreeDSecure.challengeWithConfig(paymentResponse.id,{
referenceID,jwtPayload: paymentResponse.jwt_payload,stepUpUrl: paymentResponse.step_up_url,});if(!result.success){console.error(result.error?.message);}}};return<threeDSecure.Component/>;}
Apply global styles to all Bolt components, or per-element styles at creation time. Uses the v3 CSS custom property format (--bolt-{target}-{property}). See Bolt styling docs for the full list of tokens.
// Global styles — applies to all elementsbolt.configureOnPageStyles({'--bolt-input-fontFamily': 'Inter, sans-serif','--bolt-input-fontSize': '16px','--bolt-input-borderRadius': '8px',});// Per-element styles — passed at creation timeconstcc=CreditCard.useController({styles: {'--bolt-input-borderColor': '#ccc','--bolt-input_focus-borderColor': '#5A31F4',},});// Update styles after creationcc.setStyles({'--bolt-input-backgroundColor': '#f9f9f9',});