Sandbox testing
Sandbox workspaces let you exercise billing flows without real money movement. Two test artifacts are available in sandbox and return 403 FORBIDDEN in live workspaces: test clocks simulate the passage of time, and payment simulations pin deterministic charge outcomes. Sandbox keys use the sk_test_... prefix - see Workspace context.
Test clocks
In sandbox workspaces, test_clocks simulate the passage of time so you can exercise renewal, dunning, and trial-expiration logic without waiting.
Code
Request body:
| Field | Type | Default | Notes |
|---|---|---|---|
name | string | "Default Clock" | Optional label. |
frozen_at | RFC 3339 timestamp | null | omitted | Initial pinned time. |
Response (201) returns the clock with fields id, workspace_id, name, frozen_at, status (active | advancing | completed), created_at, updated_at.
Code
The frozen_at field is required on advance. The advance triggers any time-dependent jobs (invoice runs, dunning steps, trial transitions) that would have fired between the previous and the new pinned time.
Other test-clock endpoints: GET /v1/test-clocks, GET /v1/test-clocks/{id}, DELETE /v1/test-clocks/{id}.
Payment simulations
Assign a fixed outcome to a payment method so that any charge against it resolves to that outcome instead of being sent to a real gateway.
Code
| Field | Required | Notes |
|---|---|---|
payment_method_id | yes | UUID of an existing sandbox payment method. |
outcome | yes | One of: success, decline, insufficient_funds, expired_card, fraud, processing_error, network_error. |
Other endpoints: GET /v1/test-payment-simulations, DELETE /v1/test-payment-simulations/{id}.