# Marketplaces and checkouts

> Give each seller a connected account (API: client) with a client account, take buyers' crypto payments into the seller's account with Crypto checkout, reconcile per seller and pay sellers out.

Source: https://business-api-docs.youhodler.com/use-cases/marketplaces-and-checkouts

You run a marketplace or an online shop and want buyers to pay in crypto,
with each payment credited to the seller who made the sale. This guide shows
how to give every seller an account, where the buyer's payment comes in, and
how to reconcile and pay the seller out.

> **Status: In the API.** Sellers, accounts, balances, deposits, exports, events and withdrawals are in the public API contract. Taking the payment uses [Crypto checkout (beta)](/beta/crypto-checkout), which accepts a platform access token.

## What you build

| Part of your product | What it does | API |
| --- | --- | --- |
| Seller onboarding | Each seller becomes a connected account with a client account that receives its sales | `clients.create`, `client_accounts.create` |
| Taking the payment | A hosted payment page for each order, paid into the seller's account | [Crypto checkout](/beta/crypto-checkout) |
| Seller earnings | What each seller received and their balance | `client_accounts.balances`, `deposits.list` |
| Reconciliation | Deposits per seller, exports for finance, events | `deposits.list`, `operations_activity_exports.create`, `events.list`, webhook subscriptions |
| Seller payouts | Send a seller's balance to their own wallet | `withdrawal_destinations.create`, `withdrawals.create` |

## Before you start

- **Sandbox access and a service account.** Create the service account in the
console under **API Keys** and exchange its credentials for a token as
described in [Authentication](/integrations/authentication). New to the
API? Do the [Quickstart](/quickstart) first.
- **Your enterprise ref.** `GET /me/profile` returns it in `workspace.ref`,
for example `enterprises/11111111-1111-4111-8111-111111111111`.
- **Capabilities** for the service account's role:

| Step | Capabilities |
| --- | --- |
| 1. Create a seller | `clients.create`, `clients.read`, `accounts.create`, `accounts.read` |
| Reconcile | `deposits.read`, `accounts.read`, `operations_reports.create_export`, `events.read`, `webhooks.create` |
| Pay out | `withdrawal_destinations.create`, `withdrawals.create` |
| Sandbox simulations | `sandbox_simulator.run` |

- **Concepts worth five minutes:** [Topology and refs](/concepts/topology-and-refs)
(enterprise, connected accounts and their accounts),
[Accounts](/concepts/accounts) (balances) and
[Operations](/concepts/operations) (the shared status model of deposits,
transfers and withdrawals).

Samples use the sandbox base URL. Money is always an object with a decimal
string, such as `{"value": "45.00", "currency": "USD"}`.

## How it works

```mermaid
sequenceDiagram
  participant Buyer
  participant Shop as Your server
  participant Checkout as Crypto checkout
  participant API as Business API
  Shop->>API: POST /clients and POST /client-accounts for each seller
  Buyer->>Shop: Pay for an order
  Shop->>Checkout: payment request for the seller
  Shop-->>Buyer: redirect to the hosted payment page
  Buyer->>Checkout: sends the crypto
  Checkout-->>Shop: webhook once the seller's account is credited
  Shop->>API: GET /deposits and balances of the seller account
  Shop->>API: POST /withdrawals to pay the seller out
```

1. When a seller signs up, your server creates a connected account (API:
`client`) for them and a client account that will receive their sales.
2. A buyer pays for an order on a hosted payment page of
[Crypto checkout](/beta/crypto-checkout), and the money is credited to
the seller.
3. Later, your server reads the seller's deposits and balance to reconcile,
and pays the seller out with a withdrawal.

## Step 1 — Create the seller and their account

Each seller is a connected account (API: `client`) under your enterprise.
Send your own seller id as `external_id`, so that you can find the seller
again with `GET /clients?scope_ref=<enterprise ref>&external_id=…`
(`scope_ref` is required).

**Create the connected account — POST**
```http
POST https://b2b2x-sandbox.youhodler.com/api/clients
Authorization: Bearer <access_token>
Idempotency-Key: seller-pampa-leather
Content-Type: application/json
```

```json
{
  "scope_ref": "enterprises/11111111-1111-4111-8111-111111111111",
  "display_name": "Pampa Leather Co.",
  "external_id": "seller-pampa-leather",
  "metadata": {"marketplace_seller_id": "seller-pampa-leather"}
}
```

Keep `id` from the `201` response: the seller's ref is `clients/<id>`. The
client comes with a first client account (`default_client_account`). To keep
sales apart from anything else the seller holds, open a dedicated client
account for them:

**Open the seller's sales account — POST**
```http
POST https://b2b2x-sandbox.youhodler.com/api/client-accounts
Authorization: Bearer <access_token>
Idempotency-Key: seller-pampa-leather-sales
Content-Type: application/json
```

```json
{
  "scope_ref": "clients/88888888-8888-4888-8888-888888888888",
  "display_name": "Sales"
}
```

Store the returned `id` as the seller's receiving account,
`client-accounts/<id>`. In the console the seller appears under
**Connected accounts**, and this account as a client account of that
connected account.

**Verify the seller before the first sale.** A connected account counts as
verified when `GET /clients/{client_id}` returns `kyb_stage` `verified` (a
company) or `kyc_stage` `verified` (a person). The platform refuses a deposit
address for an unverified seller's account
([Provision funding endpoint](/api/reference/funding-endpoints/funding-endpoints-create)
answers `422 not_admissible` with `CLIENT_NOT_VERIFIED`), and Crypto checkout
takes payments only for verified connected accounts. Start verification as
described in
[Crypto apps and embedded finance](/use-cases/crypto-app-and-embedded-finance)
(step 1). On sandbox Sandbox-only you can approve it with
[Simulate client verification review](/api/reference/sandbox/sandbox-clients-kyc-review).

## Step 2 — Take the buyer's payment

Use [Crypto checkout (beta)](/beta/crypto-checkout) on sandbox. Connect the
seller's receiving account to Checkout and use a platform access token with
`deposits.read` and `funding_endpoints.provision` on that account. Create a
checkout with the seller's `account_ref` and your `order_id`, then send the
buyer to the returned hosted page. When a webhook arrives, read the checkout
and fulfil the order once its status is `paid`.

## Where the money lands

A payment settles into the seller's connected account, so nothing has to be
split afterwards: the deposit and the balance belong to the seller, and that
is the attribution.

- **What arrived.** Each payment becomes a crypto deposit on the seller's
account. [List deposits](/api/reference/deposits/deposits-list) with
`account_ref` set to the seller's account; a deposit's `fee_summary` breaks
the fee into components. Crypto checkout reports the same payment per order,
with its gross, fees and net; see [Fees](/beta/crypto-checkout#fees).
- **The seller's balance.**
[Get client-account balances](/api/reference/balances/client-accounts-balances)
for the seller's account shows `available`, `held` and `total` per asset.

**Take your commission.** Two ways exist today. A fee in your enterprise
commercial agreement for the `deposit_crypto` service, for all connected
accounts or for one, is deducted from every crypto deposit into that
seller's accounts and paid into your enterprise's default master account.
It appears as an `enterprise_fee` component in the deposit's `fee_summary`.
See [Commercial agreements](/concepts/commercial-agreements).
Or move your share yourself with an internal transfer from the seller's
client account to your master account after the sale:

**Move the commission to your master account — POST**
```http
POST https://b2b2x-sandbox.youhodler.com/api/internal-transfers
Authorization: Bearer <access_token>
Idempotency-Key: commission-ORD-1042
Content-Type: application/json
```

```json
{
  "source_ref": "client-accounts/33333333-3333-4333-8333-333333333333",
  "target_ref": "master-accounts/22222222-2222-4222-8222-222222222222",
  "amount": {"value": "4.50", "currency": "USDT"}
}
```

The transfer answers `202` and follows the shared
[operation statuses](/concepts/operations); it is done when its status is
`settled`.

If you prefer to hold buyers' money yourself and pay sellers later, take
payments with one of your master accounts as the checkout’s `account_ref`, and move each seller's share with the same internal
transfer, master account to client account.

## Reconcile

- **Per seller, from deposits.**
[List deposits](/api/reference/deposits/deposits-list) with
`account_ref` set to the seller's account.
- **Per order, from Crypto checkout.** Use the checkout ID to read the payment with a
platform token that has `deposits.read` on the receiving account. Match its
`order_id` to the order in your shop.
- **Events.** The platform's own events cover the account side, for example
`operations.deposit.settled.v1` for each credited deposit. Subscribe with a
[webhook subscription](/api/reference/webhook-subscriptions/webhook-subscriptions-create)
and backfill with [List events](/api/reference/events/events-list). These
are separate from the Crypto checkout webhooks: checkout says which order
was paid, platform events say what happened on the account. See
[Transaction lifecycle and webhooks](/guides/transaction-lifecycle) and
[Events and webhooks](/guides/events-and-webhooks).

For finance, an operations activity export covers a period, filtered to
sellers or accounts and to deposits:

**Export a month of seller deposits — POST**
```http
POST https://b2b2x-sandbox.youhodler.com/api/operations-activity-exports
Authorization: Bearer <access_token>
Idempotency-Key: export-2026-10-sellers
Content-Type: application/json
```

```json
{
  "format": "csv",
  "requested_scope": {
    "kind": "enterprise",
    "ref": "enterprises/11111111-1111-4111-8111-111111111111"
  },
  "filter_criteria": {
    "date_from_utc": "2026-10-01T00:00:00Z",
    "date_to_utc": "2026-10-31T23:59:59Z",
    "client_refs": ["clients/88888888-8888-4888-8888-888888888888"],
    "operation_families": ["deposit"]
  }
}
```

Read the export until its `status` is `ready`, then download it from
`download_path`. See
[Create operations activity export](/api/reference/operations-activity-exports/operations-activity-exports-create).

## Pay sellers out

A seller's balance stays in their client account until you move it. To send
it to the seller's own wallet, register the wallet once as a withdrawal
destination for the seller (`withdrawal_destinations.create` with
`scope_ref` set to the seller's `clients/<id>`), then withdraw from the
seller's account:

**Pay a seller out — POST**
```http
POST https://b2b2x-sandbox.youhodler.com/api/withdrawals
Authorization: Bearer <access_token>
Idempotency-Key: payout-pampa-2026-10
Content-Type: application/json
```

```json
{
  "account_ref": "client-accounts/33333333-3333-4333-8333-333333333333",
  "amount": {"value": "40.00", "currency": "USDT"},
  "rail": "crypto",
  "destination_id": "44444444-4444-4444-8444-444444444444"
}
```

The withdrawal answers `202` and is final at `settled`, `failed` or
`cancelled`. Policies can send it to approval first (`pending_approval`).
The full walkthrough, including destinations and statuses, is step 5 of
[Crypto apps and embedded finance](/use-cases/crypto-app-and-embedded-finance);
for fiat payouts see
[Treasury and international payments](/use-cases/treasury-and-international-payments).

## Refunds, invoices and payment links

The platform API has no refund, invoice or payment-link operation of its own.
For a hosted crypto payment page on sandbox, create a checkout for the order
and use its returned URL. See [Crypto checkout (beta)](/beta/crypto-checkout).

## Test it on sandbox

1. Create a seller and their account (step 1), start the seller's
verification session, then approve it with
[Simulate client verification review](/api/reference/sandbox/sandbox-clients-kyc-review)
Sandbox-only. Read the client until `kyb_stage` or
`kyc_stage` is `verified`, usually in a few minutes.
2. Take a test payment for the seller as described under
[Test on sandbox](/beta/crypto-checkout#test-a-payment) in the Crypto
checkout guide.
3. Check the deposit and the seller's balance, then pay part of it out
(above).

## Related

- [Crypto checkout](/beta/crypto-checkout): payment requests, the hosted
page, statuses, webhooks and beta limits.
- [Topology and refs](/concepts/topology-and-refs),
[Accounts](/concepts/accounts), [Operations](/concepts/operations).
- [Crypto apps and embedded finance](/use-cases/crypto-app-and-embedded-finance)
for verification, deposits and withdrawals per connected account.
