DashForDevsDocs
DocsNewsAPI v1
dashfordevs.comSign in

© 2026 DashForDevs

DocsNewsdashfordevs.comLegalStatus
DocsRecipesBuild a Checkout Flow
Introduction
Getting Started
Authentication
Products
Categories
Cart
Checkout
Blog
Reviews
Webhooks
Customers
Orders
Inventory
Shipping
Discounts
Affiliates
Email
Media & Files
Analytics & Tracking
Locations
Tax
Global Data
SEO
Error Handling
Geography
Finance
Automations
Page Types
Surveys
Billing & Subscriptions
Storefront Payments
SDK Reference
REST API
Storefront Architecture
Notifications
Security
Team & Permissions
Migrations & Import
Calendar & Appointments
Contact Forms
AI Bots
Dashboard API
Deployment
Changelog
Troubleshooting
Recipes
Build a Product PageBuild a Cart DrawerBuild a Checkout FlowAdd SearchBuild a BlogAffiliate Landing PageCustomer Account PageWholesale Storefront
CLI & Deployment
Image Pipeline
White-label Platforms
Records Engine
Platform Modules
Platform Security
Site Keys & Client Sites
Use Cases
Operations

Build a Checkout Flow

Multi-step checkout with address and payment.

Updated March 29, 2026

On this page
  • Build a Checkout Flow
  • Related

Build a Checkout Flow

A multi-step checkout with shipping, payment, and confirmation.

typescript
"use client"
import { useState } from "react"
import dash from "@/lib/dash"

export function CheckoutFlow() {
  const [step, setStep] = useState(1) // 1: info, 2: shipping, 3: payment
  const [email, setEmail] = useState("")
  const [shipping, setShipping] = useState({})
  const [otp, setOtp] = useState("")

  // Step 1: Start checkout
  async function handleStart() {
    await dash.checkout.start({ cartId: dash.cart.cartId, email })
    setStep(2)
  }

  // Step 2: Get shipping rates
  async function handleShipping(address) {
    setShipping(address)
    setStep(3)
  }

  // Step 3: Process payment
  async function handlePayment() {
    await dash.payment.load()
    const { token, descriptor } = await dash.payment.tokenize({
      cardNumber: "...", expDate: "...", cvv: "...",
    })

    const { order } = await dash.checkout.complete({
      cartId: dash.cart.cartId,
      email,
      code: otp,
      shipping,
      payment_token: { token, descriptor },
    })

    // Redirect to confirmation
    window.location.href = `/order-confirmation?id=${order.id}`
  }

  // Render steps...
}

Related

  • Create Order
  • Payment Processing
  • Shipping Rates
PreviousBuild a Cart DrawerNextAdd Search

On this page

  • Build a Checkout Flow
  • Related