---
name: test-your-own-storefront
description: Book one sandbox order against the person's own storefront and cancel it, using a sandbox advertiser and ordinary V3 tools. Use when a seller or publisher wants to test its own storefront or products end to end, place a test or sandbox order or media buy, see the order id, and cancel it, with no creative and no spend.
---

# Test your own storefront with a sandbox order

Book one sandbox order against the storefront of the person's own organization, report its ids, then cancel it. The person is usually an administrator of a seller organization testing a product such as "ROS Display". This workflow needs no run identifiers and no validation run: do not send `scope3/*` values in `_meta`.

What a sandbox order is, who may place one, how a held storefront and a draft product affect it, and what the ad server shows are in [Test your own storefront with a sandbox order](https://docs.apostra.com/v3/seller-first-booking#test-your-own-storefront-with-a-sandbox-order). Read it before you answer a question about those. Do not answer them from this file.

## Guardrails

- Use only named tools from `https://api.apostra.com/mcp/v3`. Never call `api_call`, `save_connection` to change advertiser activation, `run_buyer_infra_test_campaign`, `plan_inventory_source_test_campaign` or `execute_inventory_source_test_campaign`.
- Every mutation stays inside one advertiser that carries `sandbox: true`. Never write to a live advertiser. Stop if the advertiser you hold is not sandbox.
- Target only the storefront of the person's own organization. Never another seller.
- Copy every id exactly from a structured tool response. Never build one from a name or a pattern.
- Never change the storefront's hold (`isPaused`) or a product's status. If the hold or a draft product is the reason a step is refused, report what the refusal says and tell the person the test runs while the storefront is open to buyers (the docs page above says why), and stop.
- State plainly before each write that this is a sandbox order and nothing is billed.
- Ask for explicit confirmation before `save_media_buy` and before the cancel. The confirmation before `save_media_buy` covers the whole booking: stage the buy, preview the launch, launch it.
- Do not create or attach a creative unless the person asks. A buy with no creative waits as `pending_creatives`. That is expected and is not a failure.

## 1. Check the account

Call `get_status` and resolve any account action it returns.

The supported route is a **buyer account inside the person's own organization**. If you are in a buyer account of that organization, continue. If you are in the seller account, say the order is placed from a buyer account of the same organization and ask the person to switch to it.

If the organization has no buyer account, ask whether the person wants one. If so, `review_buyer_child_account` then `request_buyer_child_account` create it. Both run only in the organization account, so ask the person to switch there. An organization administrator approves the request on the Apostra site. Before you request it, tell the person what the first buyer account adds to the organization, using the docs page above.

## 2. Confirm the company identity if discovery asks for it

Do this only when `get_status` shows `operatorIdentity.usableForBuying` false, or a read returns `BUYER_SETUP_REQUIRED`.

1. Use the organization's own registrable domain, the one its members' work emails use. Ask when it is not clear. Never invent a test domain and never use a subdomain.
2. Call `save_buyer_operator` with `identityContract: "confirmed-v1"`, the `operatorDomain` and `preview: true`. Show the person the domain and the unit code it returns.
3. After they confirm, repeat the call without `preview` and with the returned `confirmationToken`.
4. Read `get_status` again. Proof is automatic when an organization member has an email on that domain. If the domain is still unproven, report what `get_status` says and offer `save_ask` for support. Do not retry in a loop.

## 3. Use a sandbox advertiser

1. Call `search` with `kind: "advertiser"` and `filter: { sandbox: true }`. When the person names an existing sandbox advertiser, use that one, with the exact id returned.
2. Otherwise call `save_advertiser` with `sandbox: true`, a name, the organization's own brand domain as `brand`, markets and channels taken from the storefront's product (ask when none are known), and one stable `idempotencyKey`. In a Buyer Account the brand must already be in the AAO registry: a sandbox advertiser cannot register an unknown brand. If refused, report the reason and stop. Reuse the same key and the same values for every retry, so a retry never creates a second advertiser. Remember whether you created it.
3. The ad-server advertiser named "Sandbox (auto-created by salesagent - do not bill)" is the seller's own advertiser in its ad server, where the order lands. It is not an Apostra advertiser. Never search for it, pass it as an `advertiserId` or create a lookalike.

## 4. Wait for the storefront account

1. Call `search` with `kind: "seller"` and retain the id and `sellerAccountId` of the person's own storefront. They are different numbers: send `sellerAccountId` on writes, never the seller `id`.
2. Call `get` with `kind: "seller"`, that `id`, the sandbox `advertiserId` and `include: ["products"]`.
3. Find the advertiser in `controlPlane.activation.advertisers` and read `accountReadiness`:
   - `pending`: the storefront is still setting up the advertiser's account, which can take minutes after the identity is set. Tell the person, read again, and keep going for up to about ten reads. Do not recreate anything meanwhile.
   - `needs_attention`: report `requiredAction`, `failureReason` and `actionUrl`, and stop.
   - `active`: continue.
4. If it is still `pending` after those reads, report the state and say the same request can be run again later. Do not abandon the advertiser and do not create another.

## 5. Choose the product from a terminal catalog

A product seen before discovery completes is provisional and cannot authorize a buy.

1. Read the storefront's product catalog and retain its `productQueryId`, revision and completeness marker, the products, and their provenance fields.
2. Follow continuation within the returned bounds. Accept the catalog only when `catalog.ext.interchange.results_complete` is `true`.
3. Pick the product the person named, or every returned product when they asked for all of them. Retain for each one indivisible tuple: product id, seller id, product query id, query revision, and source id, sales agent id and pricing option id when present.
4. If a product the person named is not in the terminal catalog, say so and stop. Do not change the product. Point to the docs page above for what hides a product from buyers.
5. Immediately before `save_media_buy`, prove each chosen product is still in the terminal catalog with the exact same tuple. If anything changed, stop and report `product_disappeared`. Re-run discovery only as a new selection.

## 6. Book the order

Gather the flight start and end and the budget from the person. Use a flight start at least seven days away unless they say otherwise, written as a UTC date-time at the start of a UTC day. Use the smallest budget the product accepts and say what you chose.

1. Create a draft campaign with `save_campaign` on the sandbox advertiser, with the flight, the budget and a unique `idempotencyKey`.
2. State that the order is sandbox and nothing is billed, then ask the person to confirm: stage the buy, preview the launch, launch it.
3. After confirmation, call `save_media_buy` naming the storefront by `sellerAccountId`, with the campaign id, the exact product tuple, the flight and the terminal `productQueryId` as `idempotencyKey`. Several products go into one buy, each with its own tuple.
4. Preview the launch with `save_campaign` and `desiredPhase: "active"`. If it lists a seller requirement or minimum spend you can meet, fix it in a separate call and preview again. Then launch with `confirmLaunch: true`, the returned `expectedRevision` and a fresh `idempotencyKey`.
5. Read the buy with `get`, `kind: "media_buy"`, the media buy id and `include: ["liveStatus"]`. Report the media buy id (`mb_...`), the storefront's id for it (`liveStatus.storefrontMediaBuyId`), and its status. Say where to find the order in the ad server as the docs page above explains. Do not claim the ad server's own order id, and do not say the media buy id is in the order name.

## 7. Cancel and clean up

1. Ask the person to confirm the cancel. A draft buy is not an order: if the launch never dispatched, archive the buy with `isArchived: true` instead.
2. Call `save_media_buy` with `mediaBuyId`, `isCanceled: true`, a fresh `idempotencyKey` and no other field.
3. Read the buy again and report the outcome as returned: `canceled`, `cancel_pending` or `cancel_failed`, with the error and recovery when it failed. Read again while it is `cancel_pending`.
4. Only after the buy is terminal, archive it with `save_media_buy` and `isArchived: true`, alone. An archived buy cannot be undone today: `isArchived: false` is refused on a media buy. Then archive the campaign with `save_campaign`, and archive the advertiser with `save_advertiser` only if this run created it. Never archive a sandbox advertiser the person named.
5. If the cancel is not terminal, leave the campaign and advertiser in place, report the state, and say what to read later.

## Report

Return the storefront and product tuple used, the advertiser (and whether it was reused), the media buy id and storefront id, the state after booking, the cancel outcome, and what was archived. Say the order in the ad server may still need archiving there, as the docs page explains. Include no credentials, signed URLs or another tenant's identity.
