Skip to main content
Embedded checkout places Ruba’s hosted payment experience in an iframe over your product. Start with an HTML trigger when you only need to open it; install the package when your application must control its lifecycle or react to events.

Choose the integration depth

Open checkout from HTML

Create a Checkout Link, copy its embed code, and place it on any page that accepts HTML:
The library finds elements carrying data-ruba-checkout and opens the URL inline. The trigger can use your own markup and styling; keep the attribute in place.

Initialize it in an application

Install the checkout package with your package manager:
Call RubaEmbedCheckout.init() once after the application mounts. It attaches behavior to the same declarative triggers used by the HTML version.
The URL may come from a reusable Checkout Link or a dynamically created Checkout Session. For a session, set embed_origin to the exact origin that hosts the iframe. A page at https://example.com/checkout uses https://example.com.

Control an instance directly

create() opens checkout without a declarative trigger and resolves after the iframe is ready. Supply light or dark as the theme.
Use onLoaded instead of registering a later loaded listener. It cannot miss a checkout that finishes loading immediately.

Respond to the payment lifecycle

An instance emits three events:
Call event.preventDefault() inside a listener only when your application will replace the corresponding default behavior.

Manage it in React

Keep the active instance in state, register events immediately after creation, and close it when the component unmounts.

Close checkout from your code

Store the instance returned by create() and call close() when another application state must take priority. The normal close event still fires, so clear your reference in its listener.

Wallet availability

Apple Pay appears when the buyer uses Safari on an Apple device with Apple Pay configured. Google Pay appears in Chrome when the browser is connected to a Google account with Google Pay configured. Hosted checkout needs no additional wallet setup. Embedded checkout requires domain validation before wallet methods can be enabled. Email support@getruba.com with your organization slug and the domain that will host the embed.