> ## 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.

# Documentation

> Your customer pays in naira or shillings. You settle in dollars or naira. Guides, references and working code for Bachs payments, billing, payouts and sub accounts.

Bachs documentation

# Payments built for internet businesses.

Guides, references and working code for every Bachs flow, all testable in the sandbox.

[Get started](https://docs.bachs.io/get-started.md)
[How Bachs works](https://docs.bachs.io/concepts/overview.md)

Dashboard balance page showing a USD balance of 148.19 with Withdraw and Manage payouts buttons

Developer portal event details with a 204 OK delivery and the JSON payload of a collection event

Hosted checkout for a 29 dollar product with the currency picker open on naira and Bank transfer selected

Payments
[Accept a payment](https://docs.bachs.io/guides/checkout/checkout-sessions.md)
[Add an overlay checkout](https://docs.bachs.io/guides/checkout/overlay-checkout.md)
[Charge in your customer's currency](https://docs.bachs.io/guides/checkout/any-currency-checkout.md)

Billing
[Sell subscriptions](https://docs.bachs.io/guides/subscriptions/overview.md)
[Offer a free trial](https://docs.bachs.io/guides/subscriptions/trials.md)
[Set up the customer portal](https://docs.bachs.io/guides/customer-portal/overview.md)

Payouts and Connect
[Create a payout](https://docs.bachs.io/guides/payouts/payout-using-api.md)
[Schedule automatic payouts](https://docs.bachs.io/guides/payouts/payout-schedules.md)
[Split a payment with a seller](https://docs.bachs.io/connect/split-payments.md)

Developers
[Set up your development environment](https://docs.bachs.io/get-started/development-environment.md)
[Build with AI](https://docs.bachs.io/build/ai/skills.md)
[Test webhooks locally](https://docs.bachs.io/developer-portal/local-testing.md)

## Build with Bachs

> [tab] Accept a payment
>
> ### Hosted checkout, confirmed by a webhook
>
> Create a checkout session with a product from your catalog, send the customer to the hosted page, and fulfil the order when `collection.succeeded` arrives.
>
> [Accept a payment with Checkout](https://docs.bachs.io/guides/checkout/checkout-sessions.md)
>
> ```bash cURL theme={"dark"}
> curl https://sandbox-api.bachs.io/v1/checkout-sessions \
>   -H "Authorization: Bearer $BACHS_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "product_cart": [
>       { "product_id": "prod_abc123", "quantity": 1 }
>     ],
>     "customer": { "email": "ngozi@example.com", "name": "Ngozi Okafor" },
>     "success_url": "https://shop.example.com/thanks",
>     "cancel_url": "https://shop.example.com/cart"
>   }'
> ```
>
> ```ts Node.js theme={"dark"}
> const checkout = await bachs.checkoutSessions.create(
>   {
>     product_cart: [{ product_id: "prod_abc123", quantity: 1 }],
>     customer: { email: "ngozi@example.com", name: "Ngozi Okafor" },
>     success_url: "https://shop.example.com/thanks",
>     cancel_url: "https://shop.example.com/cart",
>   },
>   { idempotencyKey: `checkout-${order.id}` },
> );
> ```
>
> ```python Python theme={"dark"}
> checkout = bachs.checkout_sessions.create(
>     product_cart=[{"product_id": "prod_abc123", "quantity": 1}],
>     customer={"email": "ngozi@example.com", "name": "Ngozi Okafor"},
>     success_url="https://shop.example.com/thanks",
>     cancel_url="https://shop.example.com/cart",
>     idempotency_key=f"checkout-{order.id}",
> )
> ```

> [tab] Sell a subscription
>
> ### A checkout for a recurring product
>
> A subscription starts when a customer completes a checkout for a product with a recurring price. Send a `customer` so Bachs knows who to charge on every renewal, and your own user id in `metadata`.
>
> [Sell SaaS subscriptions](https://docs.bachs.io/build/use-cases/saas-subscriptions.md)
>
> ```bash Request theme={"dark"}
> curl -X POST https://sandbox-api.bachs.io/v1/checkout-sessions \
>   -H "Authorization: Bearer $BACHS_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "product_cart": [{ "product_id": "prod_8f3a2c9d1e4b7a6c5d0f", "quantity": 1 }],
>     "customer": { "email": "ngozi@example.com", "name": "Ngozi Okafor" },
>     "billing_currency": "USD",
>     "metadata": { "user_id": "8812" },
>     "success_url": "https://app.example.com/billing/success",
>     "cancel_url": "https://app.example.com/pricing"
>   }'
> ```
>
> ```json Response theme={"dark"}
> {
>   "checkout_id": "chk_2N3o4P5q6R7s8T9u",
>   "checkout_url": "https://checkout.bachs.io/c/V8xQ2mZpLj9RfTa",
>   "status": "open",
>   "expires_at": "2026-10-09T10:00:00Z",
>   "created_at": "2026-10-09T09:00:00Z"
> }
> ```

> [tab] Pay a seller
>
> ### One sale, split at settlement
>
> Name the seller's sub account in `transfer_data` and your cut in `platform_fee`. The customer pays once, the seller's share lands in their balance, and the fee is yours.
>
> [Build a marketplace](https://docs.bachs.io/build/use-cases/marketplace.md)
>
> ```bash Request theme={"dark"}
> curl -X POST https://sandbox-api.bachs.io/v1/checkout-sessions \
>   -H "Authorization: Bearer sk_sandbox_abc123xyz..." \
>   -H "Content-Type: application/json" \
>   -d '{
>     "product_cart": [
>       { "product_id": "prod_a3ef11afb6c446f9ba41", "quantity": 1 }
>     ],
>     "transfer_data": { "destination": "acct_Shi4LnKkKht5bmbS" },
>     "platform_fee": "20000.00",
>     "customer": { "email": "ngozi@example.com" },
>     "success_url": "https://example.com/thank-you",
>     "cancel_url": "https://example.com/checkout"
>   }'
> ```
>
> ```json Response theme={"dark"}
> {
>   "checkout_id": "chk_yMpCSunbArKaSnzJ",
>   "status": "open",
>   "amount": "100000.00",
>   "currency": "NGN",
>   "platform_fee": "20000.00",
>   "checkout_url": "https://sandbox-checkout.bachs.io/c/SfxP7y-gSkzJsZs"
> }
> ```

> [tab] Forward webhooks
>
> ### Live sandbox events on localhost
>
> The CLI pairs with your account through the browser and forwards every sandbox event to a port on your machine. Trigger a sample event to check your handler before a real payment arrives.
>
> [Test webhooks locally](https://docs.bachs.io/developer-portal/local-testing.md)
>
> ```bash Forward every event theme={"dark"}
> bachs listen --forward-to localhost:3000/webhooks
> ```
>
> ```bash Emit a sample event theme={"dark"}
> bachs trigger collection.succeeded
> ```

## Browse by product

Payments
[**Checkout**Hosted and overlay checkout for one-time payments.](https://docs.bachs.io/guides/checkout/checkout-sessions.md)
[**Payment methods**Cards, bank transfers and mobile money, by currency.](https://docs.bachs.io/guides/payments/payment-method-support.md)
[**Virtual accounts**A permanent NGN account number for bank transfers.](https://docs.bachs.io/guides/virtual-accounts/overview.md)
[**Refunds and disputes**Return a payment and answer a chargeback.](https://docs.bachs.io/guides/refunds.md)

Billing
[**Products and pricing**Fixed, free or custom prices, in local currencies.](https://docs.bachs.io/guides/products/overview.md)
[**Subscriptions**Recurring plans, trials, upgrades and payment recovery.](https://docs.bachs.io/guides/subscriptions/overview.md)
[**Customer portal**A hosted page where customers manage their own billing.](https://docs.bachs.io/guides/customer-portal/overview.md)

Payouts
[**Payouts**Withdraw your balance from the dashboard or the API.](https://docs.bachs.io/guides/payouts/overview.md)
[**Automatic payouts**Pay out settled collections on a schedule.](https://docs.bachs.io/guides/payouts/payout-schedules.md)
[**Payout currencies and methods**Where you can pay out and the details each route needs.](https://docs.bachs.io/guides/payouts/global-payouts.md)

Connect
[**Sub accounts**A balance of its own for every seller or partner.](https://docs.bachs.io/connect/overview.md)
[**Split payments**Take your platform's cut of each sale.](https://docs.bachs.io/connect/split-payments.md)
[**Onboarding**Collect each account's details from the dashboard, a hosted link or the API.](https://docs.bachs.io/connect/onboarding.md)

## Developers and help

> [card] [API reference](https://docs.bachs.io/api-reference/overview.md)
>
> Every endpoint, object and error.

> [card] [SDKs](https://docs.bachs.io/sdks/overview.md)
>
> Node.js and Python, the checkout overlay, the CLI.

> [card] [Changelog](https://docs.bachs.io/changelog/product.md)
>
> What shipped, week by week.

> [card] [Support](mailto:support@bachs.io)
>
> Direct help from the team.


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