Add AI Agent Checkout to Your Existing Store with GOAT Flow

Nov 23, 2026

Share

Category /

other

12 min read

GOAT Network

Add AI Agent Checkout to Your Existing Store with GOAT Flow

Add a server-created GOAT Flow checkout to your existing cart, tie it to a buyer-approved quote, and recover interrupted payments through the original order.

scroll

Table of contents

Add a server-created GOAT Flow checkout to your existing cart, tie it to a buyer-approved quote, and recover interrupted payments through the original order.

An AI agent can initiate checkout for a cart your store already knows how to sell. Add a server-side action that turns an approved cart into a GOAT Flow hosted Checkout Session. Your store calculates the quote, records the buyer's authorization and updates its existing order after verifying payment. A support operator should be able to recover the same order if the agent or browser disappears during payment.

Consider a lab supplier whose customer asks an agent to reorder two replacement filters for a specific instrument. The buyer needs the correct filter revision shipped to an approved location. The store can reserve two units for a limited time. Once the agent finds the SKU, the integration has to preserve that exact deal through checkout and deal with a payment that may finish near the end of the reservation.

The cart your store already owns

Give the agent a way to refer to the existing store cart as an authorized customer. It can propose a SKU, quantity and delivery option. Your backend resolves those values through the same inventory, price and customer rules it uses for other orders. For the filters, it looks up the compatible revision, checks that two units are available, applies any account-specific price, and calculates tax and shipping for the approved address. An assistant's description of the cart is useful context for the buyer. Calculate the payable amount from store records.

Save the resulting cart version with the actual line items, delivery promise and total. If your order system already supports a pending-payment record, create or reuse it at this point. If it creates final orders only after payment, reserve an internal purchase reference and map it to the eventual order. In either setup, persist a payment attempt beneath that reference. Give the attempt its own ID and state so support can follow a second attempt on the same order without confusing it with the first.

A small checkout action can now take the cart reference and buyer approval and call your existing quote and order services. Reuse the store's access controls when you expose it. The actor who adds filters to a cart may have narrower permissions than the person who authorizes payment. Resolve the buyer's identity on the store side and check their permissions again before creating a payable session. The browser can display the quote and later show progress by asking the store about the order.

The ownership division also helps when an order is visible in two systems. GOAT Flow hosts the payable page and records the result of the selected rail. The store owns the stock reservation, buyer approval, order record and fulfillment decision. In the internal attempt, put the approved cart version and local order reference beside the corresponding GOAT Flow identifiers as they become available. A warehouse employee should reach the same line items and shipping address whether the customer started in the store or through the agent.

Give the buyer a deadline that reflects the order

Approval should describe an actual purchase the store can still honor. Show the buyer the two filters and their revision, the shipping destination and service, the quoted payable amount and currency or token terms, and when they need to proceed. If the buyer has delegated limited spending to a compatible agent, evaluate that policy against the final quote and intended payment rail. For a hosted Card handoff, the authorized payer still completes the payment flow. The store's permission to initiate checkout and the payer's authorization to move funds occur at different points.

Model three deadlines in your attempt record. The store quote can expire when its inventory hold or shipping terms end. The buyer's approval can expire independently, including under a delegated spending policy. GOAT Flow returns expiresAt for the hosted Checkout Session. Use the earliest applicable cutoff when deciding whether to open or resume the payment at the store. When creating the session, request a lifetime consistent with the authority and stock hold that remain, and use the actual returned expiry afterward. Design for the fact that a buyer who already holds the URL can still reach a hosted page that remains open.

For example, say the store has twenty minutes left on its inventory hold when a buyer approves the order for ten minutes. The agent waits until there is only a minute left on the approval. Your store can ask for a fresh approval before creating a session, even though the stock is still reserved. Starting a hosted handoff that the payer has little time to complete can produce an exception the warehouse and payments team will have to resolve. Give the buyer the new quote and enough time to approve and pay. Choose this window according to the payment experience you can test for your customers.

Revalidate the cart as close as practicable to initiating payment. A cheaper total may still represent a different order if the shipping service changed or one filter disappeared. For a material change, close or retire the old attempt according to its actual provider state, reprice the cart, and seek approval against the replacement terms. Keep prior attempts visible to support in case funds arrive against an earlier quote. A canceled local attempt is a decision about your store's ordering workflow. The payment result still needs reconciliation.

Create the session from your server

Call createCheckoutSession() from your backend, using the server SDK or the documented HMAC-authenticated POST /api/v1/checkout/sessions contract. Put the merchant key and secret in backend configuration. Supply the price the server calculated, the applicable rail fields, your saved reference and an appropriate expiry. Use clientReferenceId to correlate this specific approved attempt with the provider request. Save your checkout attempt before the call so an interrupted response still leaves a record to recover. GOAT Flow Hosted Checkout guide

On a successful response, persist checkoutId, the hosted url and expiresAt before sending the buyer onward. Associate them with the approved cart version and local order reference. Your storefront can use the returned hosted URL or open the hosted page with the opaque checkout ID. Treat both as access credentials for that session. Restrict access to the intended customer or authorized operator, and keep the raw values out of analytics, support logs and payment receipts sent to unrelated recipients. If you carry store metadata into the session, keep personal account details out of exposed line items and public metadata.

Protect the decision to create a session in your own database. An agent can submit its request just as the buyer clicks the store checkout button. Have both entry points acquire the same active attempt for the order and cart version. One worker claims session creation. A second request sees creation in progress or receives the saved URL when creation finishes. Keep an ambiguous attempt active for this purpose until someone can resolve it. This local coordination still matters when GOAT Flow rejects duplicate references. Your service can return the original attempt to the second caller because it owns the persisted mapping.

Choose the rail explicitly and confirm that the merchant and environment support it. The public DIRECT crypto path transfers the accepted ERC-20 token to the configured merchant recipient. In session creation, checkoutType: 'DIRECT' selects the subsystem and paymentRails selects the methods offered. A Card-only session can therefore still carry the DIRECT checkout type. It uses fiatAmount and fiatCurrency. If you offer both methods, supply the crypto price and the fiat amount separately. GOAT Flow's documented session fields do not convert one into the other. Quote and show the amount the buyer will authorize for their selected rail.

Keep the merchant credentials, API host and hosted Checkout origin in the same deployment. Use the top-level hosted page and approved success and cancel destinations. A same-tab redirect is a practical starting point when the server call completes asynchronously. If you open a new tab after a lengthy request, browser popup protection may block it. Offer a clear route back to the logged-in store order so a buyer who loses the hosted tab can still see the attempt. The return page can display that payment is being checked while your backend collects the result.

A session created this way gives an agent a completion path if its client can hand off or operate the enabled rail with the buyer's authority. Treat UI handoff, supported agent payment and unattended payment as separate capabilities when testing that client. The store can start with one compatible buyer experience.

Confirm payment against the store order

Determine which provider record your deployment exposes for authenticated reconciliation before activating fulfillment. GOAT Flow documents Checkout Session states such as OPEN, BOUND, COMPLETED, EXPIRED and CANCELLED. The linked order has its own status. GOAT Flow's server SDK order waiters accept PAYMENT_CONFIRMED and INVOICED. A DIRECT order can advance to INVOICED before a poller sees the earlier state. Preserve the linked order identifier once it is available and read it using trusted backend status or a verified deployment webhook.

Match the payment evidence against your saved attempt. For the Crypto rail, check the associated order and transfer against the expected amount, token, network and recipient. For Card, reconcile the provider-backed result for the linked order with the approved fiat amount and currency. A provider-backed Card result can lack a transaction hash. Your order record needs room for evidence appropriate to either rail, with a link to the attempt that produced it.

Treat a success redirect or browser message as a prompt to refresh the store view. A buyer may close the tab and never return, so the server needs an independent way to learn the outcome. Where the deployment supports a webhook with a confirmed authentication and delivery contract, validate that actual contract and use the event to update or re-read the associated record. Add authenticated lookup and reconciliation for missing notifications. If no verified notification contract is available, use authenticated order status or an operator's trusted reconciliation process. Agree on how the provider order is linked to your local attempt during staging, including the case where the browser never returns.

When the trusted evidence matches, transition the existing pending order once. Make writing the paid record and arranging fulfillment atomic in your system, for example with a database transaction that writes a uniquely keyed fulfillment job alongside the paid state. A poll result and a webhook can arrive close together. Both should converge on the same store order and one warehouse request to pick two filters. Keep the committed stock and fulfillment state on that original order, so support can still find it by the customer reference used before payment.

Hand an interrupted checkout to a person

Give the buyer a way to pull up the order from an authenticated store view, without relying on the agent's conversation history. Let support look up the local order reference and see the last verified payment state, approved quote version, attempt deadline and whether the original hosted session can be resumed. A verified buyer or approved backup payer can take over by reopening the saved session where the store and provider still allow it. Check the buyer's authority and current terms before exposing the saved URL.


State you can establish


Store action

Original attempt awaiting payment, with valid quote and approval

Reopen the saved hosted URL for the authorized payer.

Buyer left after sending a payment or submitting Card details

Reconcile that attempt first. Show that confirmation is pending until its outcome is known.

Provider create timed out and the store lacks the hosted handle

Mark creation uncertain and check merchant records or deployment support for the original attempt.

Original attempt expired without a payment in flight

Recheck stock and quote, obtain current approval and create a replacement attempt when the old one can no longer be paid.

Payment confirmed after the store's hold or approval cutoff

Place the order in exception handling. Verify the payment and resolve whether the order can be honored under the original terms.

The create timeout needs particular care. GOAT Flow rejects a repeat create with the same nonempty clientReferenceId for the same merchant. A conflict may be evidence that a create already succeeded, but it does not return the original handle. The public server SDK lacks a lookup by that reference. A store that generates a fresh reference as soon as it sees a conflict risks leaving two payable sessions for one purchase. Keep the same local attempt visible and capture enough evidence for support to trace it, including the store reference, request time and deployment. Establish a way to resolve or wait out that attempt before authorizing a replacement.

Late confirmation needs a different decision. If the two filters are already committed to a different customer, stop the fulfillment transition while an operator confirms what funds arrived and what the buyer approved. The operator can decide whether the order can proceed, whether new terms need fresh approval, or whether the payment should be resolved under the merchant's established policy. Keep the paid evidence next to the stock exception on the order. A request to pay again would leave the original charge unresolved.

Store the time you learned about the payment separately from any payment timestamp you can verify through the rail. If the shipment is on hold, that distinction helps support identify whether the buyer paid before the cutoff and your app learned about it late. Preserve the quote and reservation history for that decision. If the provider record leaves the timing uncertain, let the operator resolve the case before shipping. A delayed notification should neither erase a valid purchase nor make the store promise stock it no longer holds.

Before release, assign the support team an expected response when a buyer tries to resume during that review. Show a pending order and a contact route to the person who can investigate. A customer who has already authorized a payment should be able to see that their order is under review without access to raw provider records or another checkout button.

Exercise the failure paths before widening access

Enable the new entry for one customer or a small authorized test group. Run the filter order in an appropriate environment using the rail you intend to launch. Confirm that the agent and store see the same SKU, quote and delivery commitment. Follow the expected return flow, then compare the warehouse request to an ordinary order for the same items. Verify that your normal allocation and shipping services receive the original store order reference.

Next, put pressure on the handoffs. Change stock before the buyer authorizes payment. The store should surface the revised terms while the old quote remains visible in its history. Let a buyer's approval lapse after a session exists. The store should stop offering that session, and the operator should be able to check from provider records whether it ever received payment. Create a scenario in which your app loses a provider response and recovers the attempt without issuing an automatic replacement. Write down who can resolve the attempt if the available merchant records cannot recover a usable handle.

Have the test payer close the hosted page after submitting payment and open the order from another signed-in device. Reconcile the attempt without the browser message, then run the same status update twice. Inspect the order and fulfillment records for a single transition. Test takeover with an unpaid, still-valid session separately so you can confirm the support view directs the payer to that same attempt. For a Card pilot, verify Stripe test or live mode independently of the GOAT deployment or crypto network you use for other transactions.

Use those results to decide whether to widen access. Your agent entry is ready for the tested buyer and rail when the store can preserve an approved quote, identify the original payment after an interrupted session and send one order to the warehouse. Keep the recovery paths visible to the operators who will handle the first orders.

FAQ

Can I use a fixed product link for a custom cart?

A QuickPay Product uses its configured price and serves a fixed offer. For a cart with order-specific totals, create a hosted Checkout Session from the store's backend using the approved quote.

Can the support team send a new checkout link when the buyer loses the tab?

First check the original attempt. If its payment is pending and its URL, quote and approval are still usable, resume the saved session through an authorized store view. Reconcile any ambiguous payment or creation state before issuing a replacement.

Does the store have to expose the checkout creation API directly to an agent?

The agent can request checkout via an authenticated store action. Your backend supplies the actual quote and creates the GOAT Flow session with its merchant credentials. The payer receives the hosted URL or the opaque checkout handle.

[01]

AI Knowledge base

More Articles

More Articles

More Articles