Agentic Commerce with Crossmint
Agents can purchase 1B+ products from Amazon, Shopify, airlines and more all via Crossmint’s Checkout API. Crossmint is the Merchant of Record (MoR) for these transactions, handling payments, shipping costs, taxes, and customer support.
Orders below are performed using USDC assuming an already-funded agent wallet. Check the payments page to explore other supported payment methods.

Integration Steps

1

Setup

Crossmint Project

Create a project in the Crossmint Console (staging environment)

Server-side API Key

Obtain a server-side API key from the Overview page and save it for later use
2

Search for Products

Use an LLM or third-party API provider to search available Amazon products and obtain the product’s Amazon URL or ASIN. Extract the ASIN from the Amazon URL, i.e. https://wwww.amazon.com/Sparkling-Naturally-Essenced-Calories-Sweeteners/dp/B00O79SKV6 has ASIN B00O79SKV6.
3

Create Crossmint Order

Use the Headless Checkout API to create a payment order, specifying the recipient details and payment method.
const baseUrl = 'staging'; // or 'www' for prod environment
const crossmintOrder = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/orders`, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    recipient: {
      email: "john@example.com",
      physicalAddress: {
        name: "John Doe",
        line1: "ABC Street",
        city: "New York",
        state: "NY",
        postalCode: "10007",
        country: "US"
      }
    },
    locale: "en-US",
    payment: {
      receiptEmail: "john@example.com",
      method: "base-sepolia",
      currency: "usdc",
      // Agent's wallet that pays for the transaction
      payerAddress: "0x..."
    },
    lineItems: [{ productLocator: "amazon:B00O79SKV6" }]
  })
});

const { order: paymentOrder } = await crossmintOrder.json();
This returns a valid order with payment preparation details including the serialized transaction.
You can add multiple productLocators from Amazon as part of the same order.
4

Sign and Submit Payment

Sign the transaction with Crossmint’s Create Transaction API using the agent’s wallet to complete the purchase.
const baseUrl = 'staging'; // or 'www' for prod environment
const transaction = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/wallets/${userWallet}/transactions`, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    params: {
      calls: [{
        transaction: paymentOrder.payment.preparation.serializedTransaction
      }],
      chain: "base-sepolia"
    }
  })
});
5

Monitor Order Status

Poll the order status with Crossmint’s Get Order API to track delivery and present updates to your agent or end user.
const baseUrl = 'staging'; // or 'www' for prod environment
const checkStatus = async (orderId) => {
  const response = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/orders/${orderId}`, {
    headers: {
      'Authorization': `Bearer ${API_KEY}`
    }
  });

  const { order } = await response.json();

  switch(order.phase) {
    case 'completed':
      console.log('Amazon order confirmed!');
      break;
    case 'pending':
      console.log('Processing order...');
      break;
    case 'failed':
      console.log('Order failed:', order.delivery.status);
      break;
  }

  return order;
};

const pollStatus = setInterval(async () => {
  const order = await checkStatus(paymentOrder.orderId);
  if (order.phase === 'completed' || order.phase === 'failed') {
    clearInterval(pollStatus);
  }
}, 30000);
6

Receive Order Confirmation

Crossmint automatically sends a purchase receipt to the buyer’s email with the order confirmation number, product details, and cost breakdown.