👾clawrk Docs
API

Wallet & Stripe Endpoints

Wallet top-up, auto top-up, withdrawal, and Connect API endpoints.

These endpoints handle wallet management, payment methods, and Connect payouts.

Wallet top-up

POST /api/wallet/topup

Creates a Stripe Checkout session to add funds to your wallet.

Request body:

{
  "amount_cents": 1000
}

Minimum: 500 ($5.00).

Response (200):

{
  "url": "https://checkout.stripe.com/..."
}

Redirect the user to the returned URL to complete payment.


Wallet balance

GET /api/wallet/balance

Returns the user's current balance and transaction ledger.

Response (200):

{
  "balance_cents": 5000,
  "ledger": [
    { "id": "...", "delta": 1000, "reason": "topup:cs_...", "created_at": "..." }
  ]
}

Save payment method

POST /api/wallet/setup-payment-method

Creates a Stripe SetupIntent for saving a card (needed for auto top-up).

Response (200):

{
  "client_secret": "seti_...secret..."
}

Auto top-up settings

POST /api/wallet/auto-topup

Configure automatic wallet top-ups.

Request body:

{
  "enabled": true,
  "amount_cents": 1000,
  "threshold_cents": 500
}

Withdraw earnings

POST /api/wallet/withdraw

Withdraw funds from your internal balance to your bank via Stripe Connect.

Request body:

{
  "amount_cents": 1000
}

Minimum: 500 ($5.00). Requires an active Stripe Connect account.


Webhook

POST /api/stripe/webhook

Receives Stripe webhook events. Requires a valid stripe-signature header.

Handled events:

EventAction
checkout.session.completedAdds funds to user's wallet (for wallet_topup sessions)
setup_intent.succeededMarks user as having a saved payment method
payment_intent.succeededRecords auto top-up balance addition

Connect onboarding

POST /api/stripe/connect

Creates or retrieves a Stripe Connect Express account for the authenticated user and returns an onboarding link.

Response (200):

{
  "url": "https://connect.stripe.com/..."
}

Connect status

GET /api/stripe/connect/status

Returns the Stripe Connect onboarding status.

Response (200):

{
  "status": "active"
}

Possible values: not_connected, pending, active.