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

# Prediction markets and trading apps

> Let traders fund their balance from any chain and token. You credit their account in your app once the deposit settles.

![Traders fund their account with USDT0 on Arbitrum, ETH on Base or USDC on Stellar, and the balance grows.](https://mintcdn.com/thirtn/tEtIKPxuXx_PTNHq/images/illustrations/use-case-prediction-light.svg?fit=max\&auto=format\&n=tEtIKPxuXx_PTNHq\&q=85\&s=b43ec8f05546ae9768b2ecd3632bacb5)

Funding intentsQuotesWebhooks

## The idea

The market is open, the question is spicy, and your trader's money is sitting on Arbitrum. Funding
an account should take less effort than placing the trade. They choose an amount, pay with
whatever they hold, and your app credits their balance in USDC.

## How it plays out

**1. The trader chooses an amount**

"Deposit 100 USDC." Your server creates a funding intent for exactly that, tagged with the
trader's account.

**2. They pay from wherever their money is**

USDT0 on Arbitrum, ETH on Base, USDC on Stellar: the checkout prices their token against your
100 USDC and shows one address to pay.

**3. Their balance goes up**

On `funding.credited`, add the amount to the trader's balance in your own database. Show the
deposit as pending from `funding.payment_confirmed` if you like, but only make it spendable
on `funding.credited`.

## The code

```ts Start a deposit theme={null}
const intent = await useroutr.fundingIntents.create(
  {
    amount: "100",
    asset: "asset_usdc_stellar",
    reference: depositId,
    metadata: { account_id: account.id },
  },
  { idempotencyKey: depositId },
);
```

```ts Credit the trader theme={null}
// Inside your webhook handler, after verifying the event
if (event.type === "funding.credited") {
  const deposit = event.data.object;
  await creditBalance({
    accountId: String(deposit.metadata.account_id),
    amount: deposit.requirement.amount, // a decimal string, such as "100.0000000"
    depositId: deposit.reference, // credit each deposit once: deliveries can repeat
  });
}
```

Keep amounts as decimal strings or decimals in your database, never floats.

## Make it your own

* **Quick amounts.** Buttons for 20, 50 and 100 USDC get a trader back to the market fastest.
* **Pending, then spendable.** `funding.payment_confirmed` means the payment is verified;
  `funding.credited` means it is settled and yours. Showing the step in between tells a trader
  their money is on its way.
* **Keep reserves on Base.** Receive `asset_usdc_base` at your own address there instead. See
  [A treasury on any chain](https://docs.useroutr.com/use-cases/treasury.md).

## Good to know

* Each deposit is an exact amount the trader picks first. If they send more, the extra goes back
  to them; if they send less, the intent waits for the rest. See
  [Funding intents](https://docs.useroutr.com/concepts/funding-intents.md#partial-payments-and-overpayments).
* Every deposit gets its own address, made for that intent alone. There is no permanent deposit
  address per trader.
* Your traders' balances live in your app. Useroutr settles to your account and keeps no balance
  for you or for them.
* Cashing winnings out across chains is on the roadmap: see [Payouts](https://docs.useroutr.com/use-cases/payouts.md).


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