Skip to main content

GrailSociety Commerce lab

This is an isolated backend for integration tests. It has its own database, contracts, customers, orders and keys. Use test assets and fictional customer details. Nothing here ships a physical item or charges a real card.

Connection​

DYLI_COMMERCE_BASE_URL=https://dyli-commerce-lab-api-dyli.vercel.app/api/commerce/v1
DYLI_READ_BASE_URL=https://dyli-commerce-lab-api-dyli.vercel.app/api/public/v1
DYLI_EXPECTED_ENVIRONMENT=lab
DYLI_API_KEY=YOUR_SEPARATELY_SHARED_LAB_KEY

Create and manage your own keys at API access: sign in, choose Test, then Read or Commerce. Test access is free; Live Commerce requires DYLI Pro. Copy the key when it is created, or rotate it if it was lost. You can revoke test keys from the same page without contacting DYLI.

Keep DYLI_API_KEY on your server. The production key does not work in this database. Never place the key in browser code or a NEXT_PUBLIC_ variable. The starter derives the Read API URL from the Commerce URL; the explicit override above keeps that relationship clear.

First request:

curl "$DYLI_COMMERCE_BASE_URL" -H "x-api-key: $DYLI_API_KEY"

Require environment: "lab" and capabilities.box_play.chain_id: 84532 before enabling a test purchase. Read capabilities and /bootstrap; do not assume every production capability is enabled in this lab. The public Read endpoint accepts GET requests only.

Test assets and inventory​

ItemValue
NetworkBase Sepolia, chain 84532
USDC0x036CbD53842c5426634e7929541eC2318f3dCF7e
Pack9498, LAB ONLY — Commerce test pack
Pack price0.50 test USDC, before any configured fee
Initial stock90 test collectibles; availability decreases after openings
Collectible token IDs1000000001, 1000000002, 1000000003

Use the current catalog, prices, availability and transaction instructions. The inventory is finite, and automatic restocking is not enabled for the fixture pack. Do not hardcode a mainnet contract, recipient, gas estimate or price.

Wallets need a small amount of Base Sepolia ETH for transactions. Gas sponsorship is not activated in this lab yet. Obtain native test USDC from Circle's faucet and test ETH from Onchain tools → Faucet in Coinbase Developer Platform. Never send real ETH or USDC. Low fixture prices allow testing without thousands of tokens; higher-price or larger-volume tests need additional test liquidity.

Customer identity​

The initial lab uses your existing-login model with existing test wallets. Use a new EVM signer wallet, not a production wallet. Generic deployed contract-wallet registration is not enabled in this native lab path.

  1. Choose a stable external_customer_id from your authenticated server session.
  2. POST /customers/{external_customer_id}/wallet-authorizations with wallet_address and an Idempotency-Key.
  3. Have that exact wallet sign the returned authorization.message.
  4. POST /customers/{external_customer_id}/wallet-authorizations/{id}/confirm with the signature.
  5. Save the returned customer and wallet mapping. No pre-existing DYLI or Abstract account is required for this lab registration.

Do not accept a browser-supplied customer ID as authentication. Your server must map the logged-in member to that permanent ID and check ownership before returning an order or opening to the browser.

DYLI-managed wallet/login activation is a separate remaining setup step. Send DYLI your auth provider, JWT issuer, audience, signing algorithm and public verification/JWKS URL, the stable member-ID claim, and your exact deployed test origin(s). Cookie-only login needs a server-issued signed identity bridge. Do not invent a verification endpoint, share a signing private key, or replace your production provider app to run these tests.

USDC checkout and opening​

  1. GET /catalog/packs; select a row with purchase.supported: true and copy its purchase.quote_item unchanged. The response may retain the legacy boxes array name.
  2. POST /quotes for the registered customer, with that item and a quantity from 1 to 10.
  3. Before any payment, POST /pack-plays with quote_id, external_customer_id and an Idempotency-Key. Save the play ID, order ID and opening reference.
  4. If present, send the exact approval_transaction, then box_play.transaction, from the registered wallet on chain 84532. This call collects the quoted test USDC and starts the opening; do not also send a separate transfer.
  5. Save the buy hash immediately. Call /pack-plays/{id}/results with tx_hash. Poll using retry_after_ms until ready: true. Rewards are withheld until delivery is verified.
  6. Call /review when showing final choices. The five-minute review deadline does not reset on refresh. It is not an item-claim or forfeiture deadline.
  7. Call /decision with one claim or sell_back per reward. All Keep completes without another wallet transaction. For Sell, send the returned approval if needed, then the sale transaction, and submit its hash to /finalize.

If someone leaves without finishing, their items stay in their collection. Show a sale payout only after confirmed settlement. Reuse saved order/play IDs, idempotency keys and transaction hashes after a lost response; never charge again because polling timed out. The full reference describes selection revisions, expired unsigned sales and recovery states.

Cards and funded prizes​

For a card purchase, create a quote and call POST /quotes/{id}/stripe-checkout. Use the returned Stripe test checkout with Stripe's test card 4242 4242 4242 4242, a future expiry and a test CVC. It includes the disclosed processing fee. DYLI verifies Stripe's signed callback. Read /stripe-checkouts/{id} until status: "fulfilled" supplies an order_id, then prepare /pack-plays using that order ID. The opening must not charge the wallet again.

Exact loopback return URLs are allowed for local development. A deployed return URL must use an approved application origin; send DYLI your test domain before using an unregistered deployment URL.

For a leaderboard prize, a separate partner treasury wallet can pay for a registered winner. Follow the reference's upfront USDC payment and payer-authorization flow, including the exact quote amount and payer signature. Create the paid order with the winner as its customer, then open using order_id. One transfer pays one order; the winner receives the items directly and does not pay again. Do not use the priced-buy flow's wallet debit for an already-paid prize.

Shipping simulation​

The normal address-validation, redemption quote, prepare and confirm endpoints are available. Lab address validation checks syntax only. Select lab_standard (5 test USDC) or lab_express (10 test USDC) using shipping_selection.manual.

Send the returned actual Sepolia redemption transaction and confirm its original hash. It burns the selected test items and records a simulated shipment. Responses include fulfillment_mode: "simulated". They do not create a carrier label, tracking number, warehouse request or physical delivery. Repeating confirmation must recover the same shipment without another burn or charge.

Reporting an issue​

Send the request ID, HTTP status/error code, external customer/order ID, play/redemption/checkout ID, test transaction hash and the step that failed. Never include API keys, private keys, signed session tokens or real customer addresses. Preserve the existing payment and opening until it has been reconciled.