API reference · Sandbox
Trigger a sandbox test purchase
/sandbox/test-purchasesSandbox only: the production API does not serve this operation. Buys the named listings of the authenticated seller as Snapcaster's sandbox buyer, through the same checkout a buyer uses, and pays in Stripe test mode. The capture then creates the order and sends the usual signed order.created webhook, or inventory.adjusted for an inventory subscription. The buyer, its contact details, its address and the card are Snapcaster's; send only the lines and, optionally, a shipping option. A purchase takes at most 5 lines of at most 10 cards each, totals at most 25000 cents before tax and fees, and a platform may start 20 an hour. Retrying with the same Idempotency-Key and body returns the same test_purchase_ref and never pays twice. Poll GET /sandbox/test-purchases/{ref} until status is succeeded or failed. The sandbox catalog holds product 86 as SKUs 14602 (NM), 363348 (LP), 316074 (DM); list two of them to file a substitution.
Example
These examples send requests to the sandbox.
curl --request POST \
--url 'https://api-sandbox.snapcaster.ca/api/v1/marketplace/sandbox/test-purchases' \
--header "Authorization: Bearer $MARKETPLACE_API_KEY" \
--header "Idempotency-Key: $(uuidgen)" \
--header 'Content-Type: application/json' \
--data '{
"lines": [
{
"skuId": 14602,
"quantity": 1
}
]
}'$(uuidgen) makes a new Idempotency-Key each time you run the command. To retry a command after a lost response, send the key from the first attempt.
{
"success": true,
"data": {
"test_purchase_ref": "tpr_3f2c0b9d8e7a6f5c4b3a29180f7e6d5c",
"checkout_id": "chk_4e1f7a2b9c3d",
"status": "processing",
"order_ids": [],
"failure": null
}
}Endpoint
| Environment | URL |
|---|---|
| Sandbox | https://api-sandbox.snapcaster.ca/api/v1/marketplace |
marketplaceApiKey-http bearer. Send the seller's marketplace API key asAuthorization: Bearer mp_{sellerCode}_{hex}. Themp_{sellerCode}_prefix identifies the seller; the trailing hex is the secret. The seller generates the key and supplies it to your platform.
Request
Headers
Idempotency-Keystring requiredKeep this UUID when retrying the same order operation and body. Keys remain valid for the lifetime of the order. Changed contents return 409 IDEMPOTENCY_CONFLICT; a concurrent attempt returns 409 REQUEST_IN_PROGRESS with Retry-After.
Constraints: format: uuid Example
f04e4a96-3c99-44dc-abce-5b6862c589c9X-Snapcaster-Api-VersionstringOverride the platform pin for this request only. Webhook versions and the platform pin do not change.
Constraints: allowed values:
2026-10Example2026-10
Request body
linesarray of object requiredThe line items in this request, response, or event.
Constraints: minimum items: 1; maximum items: 5
Show child fieldsHide child fields
lines[].integer requiredskuId A SKU of one of the authenticated seller's listings.
Constraints: exclusive minimum: 0 Example
14602lines[].integer requiredquantity The number of units.
Constraints: minimum: 1; maximum: 10 Example
1
shippingOptionIdintegerOne of the seller's shipping options. Omit it to use the cheapest option that carries every card in the purchase.
Constraints: exclusive minimum: 0
Response
202
The test purchase, paid and waiting for its order, or failed.
Response body: Sandbox
successboolean requiredWhether the operation completed as requested.
Constraints: allowed values:
trueExampletruedataSandboxrequiredTest Purchase The operation or event payload.
Show child fieldsHide child fields
data.string requiredtest_purchase_ref Stable for the Idempotency-Key that started the purchase.
Example
tpr_3f2c0b9d8e7a6f5c4b3a29180f7e6d5cdata.string requiredcheckout_id The checkout the sandbox buyer paid through.
Example
chk_4e1f7a2b9c3ddata.string requiredstatus processinguntil the payment is captured and the order exists, thensucceeded.failedwhen the payment did not complete.Constraints: allowed values:
processing,succeeded,failedExampleprocessingdata.array of string requiredorder_ids The orders the purchase created, as
order_idvalues. Empty untilsucceeded.Field example
[]data.object or null requiredfailure Why the purchase failed, or null.
Show child fieldsHide child fields
data.string requiredfailure. code The stable machine-readable code for this result.
Constraints: allowed values:
TEST_PAYMENT_FAILED,TEST_PURCHASE_NOT_AVAILABLEdata.string requiredfailure. message A human-readable explanation of the result.
Errors
Errors return a Marketplace body, except HTTP 413, 500 (Api). Error codes explains both error bodies and lists every code.
400
INVALID_REQUESTIDEMPOTENCY_KEY_REQUIREDUNSUPPORTED_API_VERSIONInvalid command body or missing/invalid UUID Idempotency-Key. Unknown or retired API-version override (
UNSUPPORTED_API_VERSION).Do this: Correct the request fields and supply a UUID Idempotency-Key. Keep the same key when retrying the same command. For UNSUPPORTED_API_VERSION, choose a supported version from the API versioning guide.
401
UNAUTHORIZEDMissing or invalid marketplace API key (
UNAUTHORIZED).Do this: Send the marketplace API key for this seller as a Bearer token, then retry.
409
IDEMPOTENCY_CONFLICTREQUEST_IN_PROGRESSINSUFFICIENT_STOCKIDEMPOTENCY_CONFLICT when the key was used with a different body, REQUEST_IN_PROGRESS while another request with this key runs, or INSUFFICIENT_STOCK when a line asks for more than the listing has available.
Do this: For REQUEST_IN_PROGRESS, wait Retry-After seconds and retry the same key and body. For IDEMPOTENCY_CONFLICT, reuse the original body or a new UUID. For INSUFFICIENT_STOCK, push more on-hand or ask for fewer cards.
413
PAYLOAD_TOO_LARGEThe body is larger than this route accepts (
PAYLOAD_TOO_LARGE).Do this: Send a smaller body and retry.
422
TEST_LISTING_NOT_BROWSABLESHIPPING_OPTION_INVALIDTEST_PURCHASE_LIMIT_EXCEEDEDTEST_LISTING_NOT_BROWSABLE when a SKU has no browsable listing for this seller, SHIPPING_OPTION_INVALID when the shipping option is not the seller's or cannot carry the cards, or TEST_PURCHASE_LIMIT_EXCEEDED when merchandise and shipping total more than 25000 cents.
Do this: Check the listing with GET /listings until it reads browsable, omit shippingOptionId to use the cheapest option that fits, or buy fewer or cheaper cards.
429
RATE_LIMITEDMore than 20 test purchases in the last hour for this platform (
RATE_LIMITED).Do this: Wait the Retry-After duration in seconds, then retry.
500
INTERNAL_ERRORAn unexpected failure (
INTERNAL_ERROR).Do this: Retry with bounded retries and jitter. If the failure persists, contact Snapcaster with the X-Correlation-ID response header.
503
TEST_PURCHASE_NOT_AVAILABLEThis deployment cannot run a test purchase right now (
TEST_PURCHASE_NOT_AVAILABLE): it is not the sandbox, its payments are not in test mode, or its sandbox buyer is missing.Do this: Call the sandbox API. If this persists there, contact Snapcaster with the X-Correlation-ID response header.