@peltier/react-native
v0.2.0
Published
Peltier React Native SDK — provider, headless flow hooks, and drop-in RN widgets (<DepositWidget>, <RequestWidget>, <SendWidget>, <StealthRequestWidget>).
Downloads
404
Readme
@peltier/react-native
Drop-in payment widgets for React Native — accept any ERC-20 on any chain and
settle as USDC at your destination. Ships <DepositWidget>, <SendWidget>,
<RequestWidget>, and <StealthRequestWidget>, plus the provider and headless
hooks. Zero native-module dependencies — QR rendering and clipboard access are
injected via props, so it works in Expo and bare RN alike.
npm install @peltier/react-native viem react-native-get-random-valuesQuickstart
import 'react-native-get-random-values' // FIRST import in your app entry
import { PeltierProvider, DepositWidget } from '@peltier/react-native'
import QRCode from 'react-native-qrcode-svg'
import * as Clipboard from 'expo-clipboard'
<PeltierProvider apiUrl="https://api.peltier.dev" publishableKey="pk_live_…">
<DepositWidget
destinationAddress="0xYourAddress"
destinationChainId={8453}
renderQr={(address) => <QRCode value={address} size={200} />}
onCopyAddress={(address) => Clipboard.setStringAsync(address)}
onComplete={(id) => console.log('Done:', id)}
/>
</PeltierProvider>publishableKey is required — <PeltierProvider> throws at mount without a valid
pk_test_… / pk_live_… key (a secret sk_ key is rejected outright; never ship it in
the app). The key's prefix selects the environment (test → testnet, live → mainnet), and
every session the widgets create is tagged with your merchant (GET /v1/requests + the
dashboard's Requests page).
Widgets
| Widget | Flow |
|---|---|
| <DepositWidget> | one-time deposit from any chain/token |
| <SendWidget> | send driven by any EIP-1193 provider (e.g. WalletConnect's RN provider), with fail-closed calldata verification — allowedRouters is required |
| <RequestWidget> | request/receive — share a link or QR, watch it settle |
| <StealthRequestWidget> | stealth-address request flow |
Building your own UI? Every widget's engine is a headless hook —
useDepositSession, useSendFromWallet, useRequestSession, useStealthRequest —
and the browser-safe @peltier/core
surface (registerSession, watchSession, signing, stealth) is re-exported on the
package root.
Server-only sk_ helpers (payment-session creation, webhook verification, the
subscriptions REST client) are deliberately not exported here — they belong on
your server, via @peltier/node.
Setup notes
- Crypto polyfill — import
react-native-get-random-valuesfirst in your app entry; viem key generation needscrypto.getRandomValues. (Declared as an optional peerDependency, so installs stay warning-free either way.) - Live updates — React Native has no
EventSource;watchSessionfalls back to polling automatically. For true SSE pass one in:watchSession(url, id, cb, onErr, { eventSource: RNEventSource })(e.g. fromreact-native-sse, also an optional peerDependency). Either way a network blip won't kill the watch: SSE reconnects with capped backoff, then degrades to polling. - QR codes — bring your own renderer (
react-native-qrcode-svg) viarenderQr.
Test mode
Use a pk_test_ key and every flow routes to testnet counterparts automatically —
Stripe-style key parity, no config flag.
Docs
Full documentation lives at peltier.dev/docs.
License
MIT
