Skip to main content
The SandboxService class (accessed via client.sandbox) is developer tooling for the sandbox (test) environment: reset test data in one call, fast-forward time so time-dependent behavior fires immediately, replay a webhook without recreating the underlying record, and create the discount instruments a checkout needs. Each removes a manual setup step from a test run, so the run can start from a known state. Promotions, gift cards, and campaigns are normally created by the merchant in their admin, which always writes production data. The seed methods are how those instruments come to exist in your sandbox, so a sandbox order can carry a discount. A sandbox order never lowers the merchant’s live stock. Sandbox stock levels give a variant a sandbox-only count instead, which test keys read and sandbox orders take from, so low-stock and sold-out behaviour can be exercised.
Every Sandbox method requires a secret test key (tybrite_sk_test_*). Publishable keys and live keys are rejected with 403. These operations only ever touch your sandbox data — your live data and store configuration are never affected.

Methods

resetSandbox

Wipe all of your store’s sandbox test data immediately — orders, customers, carts, wishlists, returns, store credits, reviews, messages, analytics events, webhook events, and more — instead of waiting for the automatic 30-day cleanup. Returns 204 No Content.
deleteSandboxData (mapped to DELETE /v1/sandbox/data) is an exact alias if you prefer a DELETE:

advanceSandboxTime

Fast-forward your sandbox by a number of days so time-dependent behavior happens now. It back-dates your sandbox abandoned carts, stock reservations, and analytics events, then runs the expiry/rollup jobs — so abandoned-cart windows elapse, reserved stock is released, and analytics roll forward, without waiting. The response reports what was shifted and what was intentionally left alone.
Subscription trials/renewals are real account state and are not time-shifted; promotions and gift cards aren’t shifted either. To test their expiry, seed one with a near-future end_date or expiry_date using the methods below. The not_shifted object explains each.

replaySandboxWebhook

Re-send a previously-recorded sandbox webhook event to all your matching, enabled webhook endpoints — so you can re-test your handler without recreating the order/customer/etc. Identify the event by event_id, or by type to replay the most recent sandbox event of that type. The original event is unchanged.

seedSandboxPromotion

Create a promotion in your sandbox so a sandbox order can carry a cart discount. Every field is optional — the defaults produce an active percentage promotion starting today and running for 30 days. The environment is set by Galactic Core and is never read from your request body.
Response
type accepts percentage, fixed, bogo, or bundle. percentage and fixed discount the whole cart; bogo and bundle carry product lists configured by the merchant.

seedSandboxGiftCard

Create a gift card in your sandbox, so redemption can be exercised end to end. The defaults issue an active 50.00 digital card expiring in a year with a generated SBX-… code. The same code is valid for your test key and unknown to a live key.
Response

seedSandboxCampaign

Create a marketing campaign in your sandbox. A campaign is a budget with a discount attached: it discounts an order like a promotion, but stops once its budget is spent — so this is how budget exhaustion is exercised without spending a real one. applies_to scopes where it applies: online for storefront orders, pos for in-store, or all for both. A campaign scoped to one channel does not discount the other.
Response
As sandbox orders apply the campaign, budget_spent rises and budget_remaining falls. Once the budget is exhausted the campaign stops discounting, which is the behavior a live campaign has when its budget runs out.

seedSandboxB2BBuyerAccount

Create a B2B buyer account in your sandbox. This is what makes the /v1/b2b/* endpoints reachable with a test key: every B2B endpoint resolves a buyer account for the calling customer before doing anything else, and returns 403 when there isn’t one. Pass the customer_id of a customer you created with a test key. A production customer is refused, so a sandbox buyer account can never attach to one of the merchant’s real customers.
Response
The store still has to have B2B enabled. If it does not, every B2B endpoint keeps returning 404, and seeding a buyer account does not change that.

seedSandboxPricingRule

Create a dynamic-pricing rule in your sandbox, so /v1/prices/* returns a rule-adjusted price you can build against. Rules are environment-scoped: a test key resolves only the rules you seed, and a live key only the merchant’s real ones. Seeding also refreshes your sandbox pricing cache, so the rule takes effect on your next request rather than when the cache expires.
Response
rule_type accepts percentage, fixed_amount, fixed_price and markup. To scope a rule, set applies_to to category, product or collection and pass the matching ids in target_ids — a scoped rule with no targets matches nothing and is refused.

setSandboxStockLevels

Set a sandbox-only stock level for one or more variants. For a variant with a level, a test key reads the level in place of live stock everywhere stock appears — product reads, priced products, shoppable posts and lookbooks, cart and wishlist stock checks, and checkout reservations — and a paid sandbox order takes its quantity from the level. A level of 0 makes the variant sold out for test keys, so adding it to a cart or reserving it is refused. Setting a level again replaces it. Send one level as { variant_id, stock }, or up to 100 as items. Every variant must belong to your store. Live keys, and the merchant’s own admin, keep reading live stock.
Response
A paid sandbox order for more than the level still records, takes the level to 0, and reports the shortfall in post_processing_warnings with the stock_reduction stage, as a live order does.

listSandboxStockLevels

List the sandbox stock levels set for your store, most recently changed first, each beside the variant’s live stock.
Response

deleteSandboxStockLevel

Remove the sandbox stock level for one variant, which then reads live stock again with a test key. Returns 404 when no level is set for that variant.
Response

clearSandboxStockLevels

Remove every sandbox stock level for your store. resetSandbox also removes them.
Response

Response Codes