# Gateway checkout handoff for OpenAI-powered applications

Find a matching service, read current merchant-supplied prices and delivery terms, then use the existing checkout. Discovery never authorizes spending and never creates a quote or payment.

For an existing MCP connection, `recommend_product` offers the same optional matching through a structured, discovery-only tool. See [structured agent communication](../agent-communication.md). Deterministic lookup remains available without model matching; use the connection that fits your client rather than calling both matchers for the same task.

For a known hosted offer, use `GET /api/catalog/v1/search?id=PRODUCT_ID` for a focused price and payment handoff. Use the public products endpoint below for the full executable contract and catalog-wide totals:

```http
GET https://gatewayinformationgroup.com/api/catalog/v1/products?id=webhook-event-check
```

The optional service finder accepts a general task description:

```http
POST https://gatewayinformationgroup.com/api/catalog/v1/checkout-help
Content-Type: application/json

{"query":"Check webhook events before a release"}
```

The response includes `discoveryOnly: true`, `spendingAuthorized: false` and either a current `product` or `null`. Check HTTP status and `ok`. `assistance: unavailable` means to use normal catalog search; it does not mean payment is disabled. No wallet connection or payment credential belongs in this request. Your description is processed by OpenAI when matching is available; use non-sensitive task details only.

A product has separately qualified browser `checkout` and `wallet` choices. Respect each channel's `available` field. Listed price and currency come from Gateway. The actual wallet quote/challenge remains authoritative for exact token amount, chain, recipient and expiry. Opening a checkout page does not authorize payment. A quote URL is a POST API endpoint, not a browser payment link. Use the documented service input schema and original durable recovery flow for a wallet purchase.

For your own server-side OpenAI connection, download [checkout-assistant.mjs](./checkout-assistant.mjs), [checkout-core.mjs](./checkout-core.mjs), and [openai-cache.mjs](./openai-cache.mjs) into one private integration folder. Add [responses-discovery.mjs](./responses-discovery.mjs) for structured discovery. With Node22.18+ or24+, set your OpenAI key in the process environment, never in browser code or command arguments:

```sh
node checkout-assistant.mjs --query "Check webhook events before a release"
node checkout-assistant.mjs --product webhook-event-check
node checkout-assistant.mjs --discover "Read the handoff for webhook-event-check"
```

The product-ID lookup makes no OpenAI request. A query uses one Responses call and has no automatic retry. These first-party examples may be copied and adapted to integrate with Gateway; retain existing third-party notices. Copyright © 2026 Gateway Information Group LLC. All rights reserved.

## Structured discovery for applications

`--discover` makes one Responses request using three strict functions: `find_products`, `get_product_handoff`, and `get_payment_options`. It executes the selected read-only function and returns its structured merchant record. No automatic model loop follows. Your own application can continue its conversation using `continuationInput`, which preserves the exact `call_id` and `function_call_output`. Retain that context privately and only for as long as needed.

```js
import {discoverWithOpenAI} from './responses-discovery.mjs';
const discovery = await discoverWithOpenAI({
  query: 'Read the handoff for webhook-event-check',
  apiKey: process.env.OPENAI_API_KEY,
});
console.log(discovery.result);
```

Function execution accepts only the documented arguments and fixed public Gateway GET endpoints. It never receives a wallet key, payment signature, bearer receipt or customer file. The adapter does not create a quote, order, subscription or payment. Discovery pages use public cursors; they are unrelated to private receipt access. Use non-sensitive task descriptions only. Your OpenAI API account is charged for the single model request at its applicable rates; ordinary deterministic search and product lookup make no OpenAI request.

For an existing OAuth-capable MCP connection, `gatewayReadOnlyMcpTool()` returns the canonical endpoint and a read-only allowlist with tool-call approval retained. Supply authorization through your client's supported OAuth handling; the helper does not sign in, create credentials or promise compatibility with every host. It excludes optional `recommend_product` to avoid an additional matching call inside the same request.

See [function calling](https://developers.openai.com/api/docs/guides/function-calling) and [remote MCP](https://developers.openai.com/api/docs/guides/tools-connectors-mcp) for the corresponding OpenAI request formats.

[Catalog](https://gatewayinformationgroup.com/catalog) · [Wallet integration](https://gatewayinformationgroup.com/developers) · [Privacy](https://gatewayinformationgroup.com/privacy#checkout-guidance)

This connection is not ChatGPT Instant Checkout enrollment or approval, a payment processor, wallet adapter, currency conversion service or settlement guarantee. Support for additional currencies depends on the available merchant payment methods and their qualified adapters.

## Reading a growing catalog

Prefer task search or an exact product lookup when you already know the work needed. For a complete public checkout index, the helper can read bounded pages without relying on a single large response:

```js
import {fetchPagedCatalog,checkoutResult} from './checkout-core.mjs';
const catalog=await fetchPagedCatalog();
const handoff=checkoutResult(catalog,'webhook-event-check');
```

This reads current prices and independently enabled payment navigation. It does not create a quote or authorize spending. Pages must retain one revision, consistent counts and unique product IDs; an incomplete or changed observation is rejected rather than returned as a partial purchase index. Use the exact product endpoint for execution contracts and input examples. `fetchCatalog()` now uses paginated discovery by default. `fetchPagedCatalog()` remains an explicit alias for that workflow. `fetchLegacyCatalog()` retains the bounded full-response reader for compatibility; older downloaded helpers should be updated for bulk discovery. Exact product lookups and payment terms remain available independently. Transport and time budgets protect the reader and do not impose payment limits.
