Environment URLs
| Environment | Type | API Base URL | Test operations |
|---|---|---|---|
sandbox | "sandbox" | https://sandbox-payments.oaknetwork.org | Allowed |
production | "production" | https://payments.oaknetwork.org | Blocked |
Custom URL
Override the built-in URL by passingcustomUrl. This is useful for local development or self-hosted API instances:
customUrl is set, it takes priority over the environment’s default URL. The environment field is still required — it controls sandbox-only behavior regardless of the URL.
Environment utilities
The SDK exports helper functions for environment checks:Sandbox-only restrictions
Some SDK operations are restricted to the sandbox environment using the@SandboxOnly decorator. If you call a sandbox-only method with environment: 'production', the SDK returns an EnvironmentViolationError in the Result without making a network request.
How it works
The@SandboxOnly decorator (and its function equivalent sandboxOnlyFn) checks the environment field on the client config before executing the method:
- If
environment === 'sandbox'— the method runs normally - If
environment === 'production'— anEnvironmentViolationErroris returned (for async methods) or thrown (for sync methods)
For the full error type reference, see Error Handling.