Setup

Configuration

Create a Publishable API Key from your Bridge Dashboard. These are not masked in the UI, and have a green check next to them.

BE CAREFUL - Do not use a secret API key in your frontend!

BridgeSdkProvider

This component must be rendered as a parent to any other Bridge components or hooks.

1interface BridgeSdkConfig {
2 publishableKey: string
3 logger?: Logger
4 environment?: "production" | "sandbox" | string
5 analyticsHandler?: AnalyticsHandler
6}

In your layout.tsx, wrap children in BridgeSdkProvider:

1const BridgeLayoutProvider = ({ children }) => {
2 return (
3 <BridgeSdkProvider config={{ publishableKey: "pk_..." }}>
4 {children}
5 </BridgeSdkProvider>
6 )
7}

To use sandbox, set environment: "sandbox".

To attach your own logger, implement the Logger interface or use consoleLogger (exported from the SDK package).