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

# On-Chain Collection Pipeline

**Source**: `api/routes/check-balance.ts` — `collectCreationFee()`

1. **Atomic lock**: `FOR UPDATE SKIP LOCKED` → prevents double-collection
2. **Platform-direct cheques** → waived
3. **Merchant fee wallet check** → waived if not set up
4. `checkMerchantLimits()` → log error if exceeded, leave pending
5. **SPL transferChecked**: `merchant_fee_wallet → platform_wallet`
6. Success → `collected` + `tx_hash`\
   Failure → `pending` + `collection_error` (cheque unaffected)

**Critical property**: Fee collection is **non-blocking**. Failure records the fee without interrupting the cheque lifecycle.


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