Skip to main content
Add checkout in two steps: create a session on your server and show it with the React component. Your API key stays server-side; the browser only needs a session ID. Use the merchant guide to verify payment webhooks before fulfilling orders.

Install

Install the React SDK
Requires React 17+.

Create and show checkout

1

Create a session on your server

Call the Checkout API from your server with the price and order details. Keep the idempotency key stable for retries of this order; use a new key for each new purchase.
Server: create a session
2

Render checkout in your app

Pass the session ID to the LocusCheckout component on the client.
CheckoutPage.tsx

With receipt

Add receiptConfig when creating the session to show line items, tax, and seller information. The same React component displays the receipt automatically.
Server: create a session with a receipt

receiptConfig fields

After payment, receipt details also appear in the buyer’s Purchases tab on the Locus dashboard.

Display modes

Set mode on LocusCheckout to choose the experience: For custom buttons, use useLocusCheckout. It provides openPopup, redirectToCheckout, and getCheckoutUrl.