Skip to main content
@ozura/elements/react ships a context provider, hooks, and pre-built field components for both card and bank payments.

Installation

Import from the React-specific entrypoint:

OzElements Provider

Wrap your checkout UI with <OzElements>. It creates the OzVault instance and makes it available to all children via React context. A session option is required. pubKey is required when using a production vault API key; omit it when using a test/sandbox vault API key.
sessionUrl is the simplest option — just pass your session endpoint path. See Server SDK — Session route for the matching backend route. For custom headers or auth tokens, use getSessionKey instead:

OzElements props

¹ Exactly one of sessionUrl, getSessionKey, or fetchWaxKey is required. ² pubKey is required when using a production vault API key. If your vault API key was created for the test/sandbox environment, you can omit pubKey entirely.
Mount one card form at a time inside a single <OzElements> provider. If you render a second <OzCard> (or a second set of individual field components) without first unmounting the first, the older element iframes will be silently replaced. For multi-step flows, unmount one form before mounting the next.

useOzElements Hook

Use useOzElements() inside any component wrapped by <OzElements> to tokenize and track readiness.

useOzElements return values

ready is a composite flag. It is true only when the vault is ready AND every field component that has been mounted has also finished loading. Do not use vault.isReady directly — that only reflects vault readiness, not field readiness.

OzCard — Combined Card Component

OzCard renders card number, expiry, and CVV in a single component with built-in layout, loading skeletons, and inline error display. For maximum layout control, use the individual components instead.

OzCard props

OzCardState


Individual Card Components

Use OzCardNumber, OzExpiry, and OzCvv when you need full layout control.
The expiry component is exported as OzExpiry, not OzExpirationDate.

OzFieldProps (all individual field components)


OzBankCard — Combined Bank Component

OzBankCard renders account number and routing number in a single component with built-in layout, loading skeletons, and inline error display.

OzBankCard props

OzBankCardState


Individual Bank Components

Use OzBankAccountNumber and OzBankRoutingNumber for full layout control. They accept the same OzFieldProps as card fields.

Full Card Checkout Example


Next Steps

Styling

Customize field appearance with style config and global appearance.

Error Handling

Handle OzError codes and surface them to users.

Card Elements Reference

All card options, events, and methods.

Bank Elements Reference

All bank options, events, and methods.