Skip to main content

Checkout

The SDK uses Shopify’s web checkout flow. Each cart has a checkoutUrl that opens Shopify’s hosted checkout page.

Getting the Checkout URL

Hook API

Returns null if the cart is empty or doesn’t exist.

Alternative: From useCart

The checkout URL is also available through useCart:

Opening Checkout

Use react-native-inappbrowser-reborn to open the checkout URL:

Checkout Flow

  1. Build the cart with addLines and updateBuyerIdentity
  2. Get the checkoutUrl
  3. Open it in an in-app browser
  4. Shopify handles the full checkout flow (address, shipping, payment)
  5. After completion, Shopify redirects to your configured return URL
  6. Clear the cart with clearCart() on return
The useCheckout hook is a thin wrapper — it calls useStackfront().cart.getCheckoutUrl(). Use useCart directly if you already need cart state.