Complete integration guide for Henry’s checkout automation system.

Integration Flow

  1. Set up authentication
  2. Configure payment storage
  3. Implement product search
  4. Handle checkout process
  5. Monitor order status

1. Authentication Setup

Store your API credentials securely:
const HENRY_TOKEN = process.env.HENRY_API_TOKEN;
const headers = {
  'Authorization': `Bearer ${HENRY_TOKEN}`,
  'Content-Type': 'application/json'
};

2. Payment Configuration

Store user payment details using Nekuda:
async function storePaymentDetails(productInfo) {
  const response = await fetch('https://api.henrylabs.ai/api/mandate/create', {
    method: 'POST',
    headers,
    body: JSON.stringify(productInfo)
  });
  return response.json();
}

3. Product Search Integration

Search for products users want to buy:
async function searchProducts(query) {
  const response = await fetch('https://api.henrylabs.ai/trpc/serpApiShoppingSearch', {
    method: 'POST',
    headers,
    body: JSON.stringify({ query, limit: 10 })
  });
  return response.json();
}

4. Checkout Processing

Process automated checkout:
async function processCheckout(products) {
  const response = await fetch('https://api.henrylabs.ai/trpc/order.createOrder', {
    method: 'POST',
    headers,
    body: JSON.stringify({ products })
  });
  return response.json();
}

5. Order Monitoring

Track order status:
async function getOrderStatus() {
  const response = await fetch('https://api.henrylabs.ai/trpc/order.getOrders', {
    method: 'GET',
    headers
  });
  return response.json();
}

Best Practices

  • Always validate user input before API calls
  • Implement proper error handling
  • Use webhooks for real-time order updates
  • Cache product search results appropriately