Skip to main content
The @zbdpay/ramp-react-native package is a React Native wrapper for the ZBD Ramp widget that enables Buying Bitcoin with USD directly to the Lightning Network.

Features

  • React Native Optimized: Built specifically for React Native with WebView
  • TypeScript Support: Full type safety with comprehensive TypeScript definitions
  • Cross-Platform: Works on iOS and Android
  • Ref API: Access to WebView methods and ramp instance
  • Hook Support: useZBDRamp hook for programmatic usage

Installation

iOS Setup

1. Install CocoaPods dependencies

2. Add Privacy Permissions

Add the following entries to your ios/{YourAppName}/Info.plist:
These permissions are required for the ZBD Ramp widget to access device features like camera (document verification) and microphone (liveness detection) within the WebView context.

Android Setup

Add the following permissions to your android/app/src/main/AndroidManifest.xml:
These permissions prevent permissions_unavailable errors when the ZBD Ramp widget tries to access device features.

Quick Start

1. Create Session Token

First, create a session token using the ZBD API:

2. Use ZBDRamp Component

API Reference

initRampSession

Creates a new session token for the ZBD Ramp widget.
InitRampSessionConfig
required
Configuration object for creating a session

Configuration Parameters

string
required
Your ZBD API key
string
required
User’s email address
string
required
Lightning address or Bitcoin address
QuoteCurrencyEnum
required
Quote currency (e.g., USD)
BaseCurrencyEnum
required
Base currency (e.g., BTC)
string
Webhook URL for notifications
string
Your internal reference ID
Record<string, any>
Additional metadata to attach to the session

ZBDRamp Component

React Native component that renders the ZBD Ramp widget using WebView.

Props

string
required
Session token from ZBD API
WebViewProps['style']
WebView style
Omit<WebViewProps, 'source' | 'onMessage' | 'style'>
Additional WebView props

Callback Props

(data: any) => void
Called when payment is successful
(error: RampError) => void
Called when an error occurs
(step: string) => void
Called when user navigates to a different step
(log: RampLog) => void
Debug/info logging callback
() => void
Called when widget is fully loaded
() => void
Called when user closes the widget

Ref API

useZBDRamp Hook

Hook for managing ZBD Ramp instances programmatically.

Usage Examples

Basic Component

With Ref for Control

Using the Hook

Custom WebView Configuration

Error Handling

TypeScript Support

The package includes comprehensive TypeScript definitions:

Type Examples

Development Setup

Running the Example App

The repository includes a complete React Native example app:
The example app includes:
  • Session token creation
  • Debug logging
  • Full integration with all event handlers
  • Error handling examples

TypeScript

Core TypeScript/JavaScript SDK

React

React components and hooks

Flutter

Flutter plugin

Resources

Support

For support and questions: