OzVault
The main SDK entry point. Manages all payment fields and vault credentials.Always create
OzVault via the async static factory OzVault.create(). Never call new OzVault(...) directly.OzVault.create
onReady fires (or vault.isReady === true).
The optional signal parameter is an AbortSignal for advanced teardown scenarios. The React <OzElements> provider handles this automatically.
VaultOptions
¹ 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.
Properties
Methods
createElement
.mount() on the result to attach it to the DOM.
ElementType values: 'cardNumber' | 'expirationDate' | 'cvv'
getElement
null.
createBankElement
'accountNumber' | 'routingNumber'
getBankElement
null.
createToken
OzError on failure.
Tokenization timeout: If the vault does not respond within 30 seconds,
createToken() rejects with an OzError (errorCode: 'timeout'). This timeout is separate from the element iframe load timeout (loadTimeoutMs) and is not configurable.createBankToken
OzError on failure. Same 30-second timeout applies.
destroy
reset
reset(), every mounted element emits a change event with { complete: false, valid: false, empty: true }. These events arrive asynchronously (via postMessage from the iframes), but in practice they land well before the user can interact with the cleared fields. Any submit-button gating logic that listens to change events will automatically re-disable the button — no manual state reset is required, though resetting your own flags immediately after vault.reset() is harmless defensive practice.
Session model: by design, one session covers the full checkout. The default
sessionLimit: 3 gives you two declined attempts and one final attempt on the same session. Use vault.reset() between declines instead of vault.destroy() + recreate — that would unnecessarily refresh the session and discard remaining budget.debugState
debug: true is set. Safe to log or attach to a support ticket — no sensitive data is returned.
OzElement
Returned bycreateElement() and createBankElement(). Represents a single input field.
Properties
Methods
mount
target can be a CSS selector string or an HTMLElement.
unmount
unmount(). Use destroy() for permanent teardown.
on
this for chaining.
off
once
update
- Properties you include are merged into the current style — they replace their previous values.
- Properties previously set but absent from the new
styleobject retain their current values (no keys are cleared by omission). - To reset a specific property, pass it explicitly with an empty string:
{ base: { color: '' } }. - To fully reset all styles, destroy and recreate the element.
- Vault-level appearance theme styles are always preserved underneath — per-element style merges on top.
focus
blur
clear
destroy
unmount().
Events
change
focus / blur
blur callback receives the current field state.
ready
loaderror
loadTimeoutMs. Receives the element type and an error message.
TokenizeOptions
TokenResponse
BillingDetails
BankTokenizeOptions
BankTokenResponse
CardSaleApiResponse
The raw response envelope from the OzuraPay APIcardSale endpoint. Only relevant when calling the API directly via fetch — the server SDK’s Ozura.cardSale() throws OzuraError on failure rather than returning this shape.
ElementOptions
ElementStyleConfig
ElementStyle keys.
Appearance
FontSource
OzError
React Types
OzElementsProps
UseOzElementsReturn
OzFieldProps
OzCardState
OzBankCardState
createSessionFetcher
getSessionKey callback for a given backend URL. You rarely need to call this directly — pass sessionUrl to OzVault.create() or <OzElements> and the SDK calls it internally.
{ sessionId } to the URL and reads sessionKey from the response. Useful when you need the callback form for custom headers or auth tokens:
OzError instances with a structured errorCode ('timeout' | 'network' | 'auth' | 'validation' | 'server').
createFetchWaxKey is a deprecated alias for createSessionFetcher. Both are exported and work identically.Debug mode
Passdebug: true to VaultOptions (or as a prop on <OzElements debug>) to activate structured console logging.
[OzVault] <event> prefixed console.log entry. Events covered:
No sensitive data is ever logged. Session keys, tokens, CVC sessions, and billing fields appear only as boolean presence flags. Output is safe to paste directly into bug reports.
vault.debugState() is always available regardless of this flag — see vault.debugState() above.
Exports
@ozura/elements
The browser entry. Exports everything needed to initialize the vault, mount fields, tokenize, and handle errors. TheTransaction* and CardSale* types are re-exported here for TypeScript convenience but are primarily used with @ozura/elements/server.