How an AI Agent Checks Out on Login Gated Merchants

Some merchants only sell to signed in customers, and many send a verification code at sign in. An agent that checks out as a guest stops there. This guide shows how an AI agent signs in to the customer’s own merchant account, handles the code and completes the order with CartAI.

The short answer

Save the customer’s merchant login once in CartAI’s secure credential vault. At checkout, tell the agent to sign in with it and turn on interactive checkout. If the merchant sends a one time code, CartAI pauses the order, asks the customer for the code and finishes the checkout.

The order lands in the customer’s own account on the merchant’s site, with their order history, saved addresses and loyalty points. The merchant stays the merchant of record.

Why login gated checkout stops most agents

  • Accounts. Member pricing, loyalty points and some products are only available after sign in.

  • Verification codes. Many merchants text or email a code at sign in, and it expires quickly. Someone has to supply it while it is still valid.

  • Credentials. Your platform should not hold the customer’s password, and your agent should never see it.

What you need

  • A CartAI API key. The key is free and signup is self serve at portal.cartai.ai.

  • A webhook endpoint set in the CartAI portal, so CartAI can tell you when a code is needed.

  • The customer’s email. Use the same email to save the login and to create the checkout.

  • A product page URL on the same merchant site as the saved login.

Step 1. Save the customer’s merchant login

Create a credential vault session for the merchant and the customer’s email. CartAI returns a link to a secure hosted page where the customer enters their login. Embed it in an iframe or send it as a link. The link expires after 10 minutes.

curl https://api.cartai.ai/credentials/session \
  -H "x-api-key: $CARTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantDomain": "https://merchant.example",
    "email": "jane@example.com"
  }'
curl https://api.cartai.ai/credentials/session \
  -H "x-api-key: $CARTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantDomain": "https://merchant.example",
    "email": "jane@example.com"
  }'
curl https://api.cartai.ai/credentials/session \
  -H "x-api-key: $CARTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantDomain": "https://merchant.example",
    "email": "jane@example.com"
  }'

The login is stored against that email and merchant. It never passes through your backend or your agent. Do this once per customer and merchant.

Step 2. Create the checkout with sign in turned on

Create the checkout as usual and set two options. useSavedCredentialToLogin tells the agent to sign in with the saved login. allowInteraction lets it pause and ask the customer when the merchant sends a code.

curl https://api.cartai.ai/checkout \
  -H "x-api-key: $CARTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": {
      "contact": {
        "firstName": "Jane",
        "lastName": "Doe",
        "phone": "+1 555 010 0000",
        "email": "jane@example.com"
      },
      "shippingAddress": {
        "addressLine1": "123 Main St",
        "city": "Austin",
        "province": "TX",
        "postalCode": "78701",
        "country": "US"
      },
      "payment": { "data": { "sessionId": "SESSION_ID" } }
    },
    "tasks": [
      { "url": "https://merchant.example/products/item", "quantity": 1 }
    ],
    "options": {
      "useSavedCredentialToLogin": true,
      "allowInteraction": true
    }
  }'
curl https://api.cartai.ai/checkout \
  -H "x-api-key: $CARTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": {
      "contact": {
        "firstName": "Jane",
        "lastName": "Doe",
        "phone": "+1 555 010 0000",
        "email": "jane@example.com"
      },
      "shippingAddress": {
        "addressLine1": "123 Main St",
        "city": "Austin",
        "province": "TX",
        "postalCode": "78701",
        "country": "US"
      },
      "payment": { "data": { "sessionId": "SESSION_ID" } }
    },
    "tasks": [
      { "url": "https://merchant.example/products/item", "quantity": 1 }
    ],
    "options": {
      "useSavedCredentialToLogin": true,
      "allowInteraction": true
    }
  }'
curl https://api.cartai.ai/checkout \
  -H "x-api-key: $CARTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": {
      "contact": {
        "firstName": "Jane",
        "lastName": "Doe",
        "phone": "+1 555 010 0000",
        "email": "jane@example.com"
      },
      "shippingAddress": {
        "addressLine1": "123 Main St",
        "city": "Austin",
        "province": "TX",
        "postalCode": "78701",
        "country": "US"
      },
      "payment": { "data": { "sessionId": "SESSION_ID" } }
    },
    "tasks": [
      { "url": "https://merchant.example/products/item", "quantity": 1 }
    ],
    "options": {
      "useSavedCredentialToLogin": true,
      "allowInteraction": true
    }
  }'

Step 3. Collect the verification code

When the merchant asks for a code, CartAI sends a checkout task webhook with a requiredInputs entry whose intent is mfa-request. You have two ways to answer it.

  • Hosted screen. The entry includes a link to a ready made code screen. Show it in an iframe or a new window. It collects the code and sends it to the agent, with no further API calls.

  • Your own screen. Build the field from the inputSchema in the webhook, then send the code from your backend.

curl https://api.cartai.ai/checkout/TASK_ID/mfa \
  -H "x-api-key: $CARTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "otp": "482913" }'
curl https://api.cartai.ai/checkout/TASK_ID/mfa \
  -H "x-api-key: $CARTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "otp": "482913" }'
curl https://api.cartai.ai/checkout/TASK_ID/mfa \
  -H "x-api-key: $CARTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "otp": "482913" }'

Send the code once per task, and never expose your API key in the browser. Codes expire quickly, so notify the customer the moment the webhook arrives.

Step 4. Track the order

The checkout continues as soon as the code arrives. You get a COMPLETED webhook when the order is placed, or FAILED if the merchant rejects the code.

Interactive checkout covers more than codes

The same allowInteraction option lets CartAI pause for anything a checkout needs that it does not have, such as a shipping or billing address, payment details or a shipping choice. See Programmatic and interactive checkout for how each input is requested.

What to expect

  • No merchant integration. The order is placed on the merchant’s own site, so the merchant keeps fulfillment, returns and the customer relationship, and stays the merchant of record.

  • Checkout works on merchant sites worldwide, on guest and login gated flows.

  • In a November 2026 benchmark, CartAI completed 95.88% of checkouts across 97 live merchants on the first attempt, from product page through payment.

  • Checkout runs on supported merchants. A merchant can choose not to allow agent checkouts, and CartAI respects that choice.

  • Checkout is asynchronous. Build around webhooks, not a blocking call.

Get started

Get a free API key at portal.cartai.ai and read the full reference at docs.cartai.ai. The full walkthrough is in Handling MFA with interactive checkout, and the general flow is in How to place orders on merchant sites from an AI agent. If you run a platform that needs orders placed at volume, talk to us.

© 2026 All rights reserved.

© 2026 All rights reserved.

© 2026 All rights reserved.