> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bachs.io/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Money is always a decimal string at the currency's precision (for example "29.00"), paired with an ISO 4217 currency field. Never use minor units.
> Build against the sandbox first: base URL https://sandbox-api.bachs.io with sk_sandbox_ keys. Production is https://api.bachs.io with sk_live_ keys; going live is a key swap.
> Treat webhooks (for example collection.succeeded) as the source of truth for fulfilment, never client-side events or redirects.
> Subscriptions are created by completing a checkout for a recurring product. There is no direct create-subscription endpoint.
> IDs carry resource prefixes (cust_, prod_, sub_, chk_, inv_, ref_) and timestamps are ISO 8601 UTC.

# Set up your development environment

> Get a sandbox key, the Bachs CLI and a server SDK ready, and send your first request to the sandbox.

Build and test everything in the sandbox first. Charges there are simulated, so no real money moves. This page gets you a sandbox key, the CLI, a server SDK and a working first request.

## Switch to the sandbox

In your dashboard, open the **organization switcher dropdown** at the top left and select **Sandbox**. The dashboard reloads with your sandbox account and its own balance, charges and settings. To switch back, select your organization name from the same dropdown.

The sandbox is entirely separate from your live account. None of these are shared between the two:

* Balance and charge history
* Customers and payment methods
* Payout destinations
* Webhook endpoints and event history
* API keys

See [Test your integration](https://docs.bachs.io/integrate/sandbox.md) for the full sandbox reference.

## Create a sandbox key

While you are in the sandbox, open the developer section of the dashboard and click **Create secret key**. Give the key a name and the scopes your integration needs. A key cannot reach any endpoint outside its scopes.

Sandbox keys start with `sk_sandbox_` and route to `https://sandbox-api.bachs.io`. Production keys start with `sk_live_` and only work after your account is verified. Keep the key in an environment variable, never in source control or client code:

```bash Set your key theme={"dark"}
export BACHS_API_KEY=sk_sandbox_...
```

See [Get your API keys](https://docs.bachs.io/authentication.md) for scopes and security practices.

## Install the CLI

The Bachs CLI is a single binary with no runtime to install first.

```bash macOS and Linux theme={"dark"}
brew install bachsdev/bachs/bachs
```

```bash Node projects theme={"dark"}
npm install -g @bachs/cli
```

```powershell Windows theme={"dark"}
scoop bucket add bachs https://github.com/bachsdev/scoop-bachs
scoop install bachs
```

Then pair it with your sandbox account. The command prints a code and opens your browser; approve the request in the dashboard after checking the code matches.

```bash Pair against sandbox theme={"dark"}
bachs login --sandbox
```

See [Bachs CLI](https://docs.bachs.io/cli/overview.md) for other install options and how credentials are stored.

## Install a server SDK

The official SDKs run on your server only. The Node.js SDK needs Node.js 22 or later, and the Python SDK needs Python 3.10 or later.

```bash Node.js theme={"dark"}
npm install @bachs/sdk
```

```bash Python theme={"dark"}
pip install bachs
```

Create the client with your sandbox key and `environment: "sandbox"`. See the [Node.js SDK](https://docs.bachs.io/sdks/node.md) and the [Python SDK](https://docs.bachs.io/sdks/python.md) for setup, including pnpm, yarn, uv and Poetry.

## Forward webhooks to your machine

Bachs confirms payments with webhook events. While you build, forward live sandbox events to a local port. The connection opens outbound, so you need no public URL and no tunnel.

```bash Forward every event theme={"dark"}
bachs listen --forward-to localhost:3000/webhooks
```

Add `--events` with a comma-separated list to forward only some event types. See [Test webhooks locally](https://docs.bachs.io/developer-portal/local-testing.md) for the signing secret and verifying a real signature.

## Make your first request

Send your sandbox key as a Bearer token. This lists your products:

```bash Sandbox theme={"dark"}
curl https://sandbox-api.bachs.io/v1/products \
  -H "Authorization: Bearer $BACHS_API_KEY" \
  -H "Accept: application/json"
```

If the key works, you get a `200` and your products in `items`. A sandbox you have just created has none yet, so the list is empty until you [create a product](https://docs.bachs.io/guides/products/overview.md). A `401` means the key is wrong or missing; see [Get your API keys](https://docs.bachs.io/authentication.md).

When you go live, the request is the same against `https://api.bachs.io` with an `sk_live_` key.

## Next steps

* [Accept a payment with Checkout](https://docs.bachs.io/guides/checkout/checkout-sessions.md): create a hosted checkout and confirm the payment with a webhook.
* [Test webhooks locally](https://docs.bachs.io/developer-portal/local-testing.md): receive live events on your machine and verify a real signature.
* [Bachs CLI](https://docs.bachs.io/cli/overview.md): every command for working with your integration from the terminal.
* [SDKs](https://docs.bachs.io/sdks/overview.md): the official server SDKs, the browser checkout overlay and community SDKs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.