Overview
The@yuno-payments/react package provides pre-built React components and hooks for integrating Yuno checkout into your React application. Components handle SDK lifecycle management, PCI compliance, and payment state automatically.
React components wrap the Yuno Web SDK. All features available in the Web SDK are accessible through React components and hooks.
Prerequisites
- React 18+ and React DOM
- Yuno API keys (Authentication)
- At least one payment method enabled in your Dashboard
Installation
YunoProvider
Wrap your application (or the section that uses Yuno components) with<YunoProvider> to initialize the SDK context:
YunoProvider Props
YunoCheckout Component
Renders the full checkout UI with all available payment methods.YunoCheckout Props
YunoPaymentForm Component
Renders a card-only payment form for custom checkout flows where you control payment method selection.YunoPaymentForm Props
Hooks
useYunoPayment
Provides imperative control over the payment flow. Use this hook when you need to trigger submission programmatically.useYunoPayment Return Type
useYunoCheckoutSession
Creates and manages checkout sessions client-side. Useful when session creation needs to be triggered dynamically.useYunoCheckoutSession Return Type
TypeScript Interfaces
Theming with CSS Variables
In addition to thetheme prop on <YunoProvider>, you can override styles using CSS variables:
CSS variables take the lowest precedence. The
theme prop on <YunoProvider> overrides CSS variables, and the Checkout Builder in the Dashboard is overridden by both.Error Boundary Integration
Wrap Yuno components in a React error boundary to handle unexpected SDK errors gracefully:Server-Side Rendering (Next.js)
Yuno components require browser APIs and cannot render on the server. Use dynamic imports with SSR disabled:Complete Example
A full checkout page combining provider, session management, and payment handling:Testing with React Testing Library
Since Yuno SDK components depend on browser APIs and external scripts, mock the components in unit tests and use end-to-end tests (e.g., Cypress, Playwright) for full integration testing against the sandbox environment.