This guide will walk you through the essential steps to search for a product, initiate a checkout, and track your order using the Henry API.

Prerequisites

  • You have received your X-API-Key from the Henry team. If not, please contact us.
  • You have a basic understanding of how to make curl requests.
Our base API endpoint is: https://api.henrylabs.ai All requests must include your X-API-Key in the header for authentication. For checkout and order management, you must also include a X-User-ID, which should be a unique identifier for each of your end-users.

Step 1: Search for a Product

First, find a product you want to purchase using the product search endpoint. This will give you a productId and other details you’ll need for the next steps.
curl -X POST 'https://api.henrylabs.ai/api/products/search' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  --data '{
    "query": "nike running shoes",
    "limit": 1
  }'
200 Success
[
  {
    "Id": "17f0605b-c2e3-4383-8582-bbbdc5ae2bfd",
    "Name": "Nike Air Zoom Pegasus 40",
    "ProductLink": "https://www.nike.com/t/air-zoom-pegasus-40-mens-road-running-shoes-d1J0bV/DV3853-001",
    "Price": 130.00
  }
]

Step 2: Get Product Details

Next, use the Id from the search results to get more detailed information about the product, including available stores, reviews, and variants.
curl -X POST 'https://api.henrylabs.ai/api/products/details' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  --data '{
    "productId": "17f0605b-c2e3-4383-8582-bbbdc5ae2bfd"
  }'
200 Success
{
  "product_results": {
    "title": "Nike Air Zoom Pegasus 40",
    "stores": [
      {
        "name": "Nike",
        "link": "https://www.nike.com/t/air-zoom-pegasus-40-mens-road-running-shoes-d1J0bV/DV3853-001",
        "price": "$130.00"
      }
    ]
  }
}

Step 3: Initiate a Checkout

Now, you can initiate a checkout using the productLink and other details gathered in the previous steps. The user’s default payment method on file will be used for the purchase.
curl -X POST 'https://api.henrylabs.ai/api/checkout/single' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'X-User-ID: f47ac10b-58cc-4372-a567-0e02b2c3d479' \
  -H 'Content-Type: application/json' \
  --data '{
    "shippingDetails": {
      "city": "West New York",
      "email": "user@example.com",
      "fullName": "John Doe",
      "postalCode": "07093",
      "countryCode": "US",
      "phoneNumber": "5512295627",
      "addressLine1": "350 5th Ave",
      "stateOrProvince": "New Jersey"
    },
    "productDetails": {
      "name": "Nike Air Zoom Pegasus 40",
      "price": "130",
      "quantity": 1,
      "metadata": {
        "Size": "10.5",
        "Color": "Black"
      }
    },
    "productLink": "https://www.nike.com/t/air-zoom-pegasus-40-mens-road-running-shoes-d1J0bV/DV3853-001"
  }'
201 Success
{
  "id": "d1e2f3a4-b5c6-7d8e-9f0a-1b2c3d4e5f6a",
  "internalOrderId": "17f0605b-c2e3-4383-8582-bbbdc5ae2bfd",
  "status": "payment_pending",
  "statusMessage": "Your order has been received and is pending payment processing."
}

Step 4: Check Order Status

After creating an order, you can check its status by querying the internalOrderId returned in the previous step.
curl -X GET 'https://api.henrylabs.ai/api/orders/17f0605b-c2e3-4383-8582-bbbdc5ae2bfd' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'X-User-ID: f47ac10b-58cc-4372-a567-0e02b2c3d479'
200 Success
{
  "id": "17f0605b-c2e3-4383-8582-bbbdc5ae2bfd",
  "userId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "totalAmount": "130.00",
  "status": "payment_pending",
  "refundAmount": "0",
  "currency": "USD",
  "receivedAmount": "0",
  "receivedCurrency": null,
  "transactionHash": null
}

Next Steps

  • Explore the API Reference for more details on each endpoint.
  • Learn about Webhooks to receive real-time updates on order status.
  • See how to handle potential issues in the Error Handling guide.