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

# Advanced Sessions

> Prefilled amounts, contract calls, and payment options.

Advanced options for creating sessions via `POST /v1/sessions`. See also: [Create Session](/api-reference/create-session).

## Prefilled Amount (`amountUnits`)

Pass `destination.amountUnits` to lock the deposit to an exact amount. The user skips amount selection and proceeds directly to the payment flow.

```bash theme={null}
curl -X POST https://api.daimo.com/v1/sessions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "destination": {
      "type": "evm",
      "address": "0xYourAddress",
      "chainId": 8453,
      "tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "amountUnits": "25.00"
    },
    "display": {
      "title": "Deposit to Acme",
      "verb": "Deposit"
    }
  }'
```

| Field         | Type             | Description                                                                                            |
| ------------- | ---------------- | ------------------------------------------------------------------------------------------------------ |
| `amountUnits` | string, optional | Fixed amount in token units (e.g. `"25.00"` for \$25 USDC). When omitted, the user chooses the amount. |

If the user pays slightly less or more (due to bridge fees or price changes), the session still completes. Any variance is visible in the session response and webhooks.

## Contract Calls (`calldata`)

Pass `destination.calldata` to execute an arbitrary contract call with deposited funds. When using `calldata`, `destination.address` is the contract being called.

### How it works

1. Daimo delivers the destination token to the contract
2. A token approval of the deposit amount is made to the contract
3. The contract is called with the provided `calldata`
4. If the call succeeds, the session completes normally
5. **If the call reverts, funds are sent to `refundAddress` instead, and the session status becomes `bounced`**

### Contract requirements

Your contract must handle variable input amounts. Specifically, it should:

1. Check the allowance of the destination token from `msg.sender`
2. Use `transferFrom` to pull the full allowance

This is true **even when `amountUnits` is set**. While over- or under-payments are rare with a fixed amount, they cannot be guaranteed to never happen.

```solidity theme={null}
function deposit(address token, uint256 /* amount */, address recipient) external {
    uint256 allowance = IERC20(token).allowance(msg.sender, address(this));
    require(allowance > 0, "no allowance");
    IERC20(token).transferFrom(msg.sender, address(this), allowance);
    _processDeposit(token, allowance, recipient);
}
```

### Example: generating calldata with viem

```typescript theme={null}
import { encodeFunctionData } from "viem";

const calldata = encodeFunctionData({
  abi: [
    {
      name: "deposit",
      type: "function",
      inputs: [
        { name: "token", type: "address" },
        { name: "amount", type: "uint256" },
        { name: "recipient", type: "address" },
      ],
      outputs: [],
      stateMutability: "nonpayable",
    },
  ],
  functionName: "deposit",
  args: [tokenAddress, amount, recipientAddress],
});
```

```bash theme={null}
curl -X POST https://api.daimo.com/v1/sessions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "destination": {
      "type": "evm",
      "address": "0xYourContract",
      "chainId": 8453,
      "tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "amountUnits": "100.00",
      "calldata": "0x..."
    },
    "display": {
      "title": "Stake USDC",
      "verb": "Stake"
    },
    "refundAddress": "0xYourRefundAddress"
  }'
```

### Error handling

If your contract call reverts:

* The session status becomes `bounced`
* Funds are sent to the `refundAddress` you specified

Always provide a `refundAddress` when using calldata to ensure funds are recoverable.

## Payment Options (Legacy)

<Warning>
  `display.paymentOptions` is legacy. New integrations should use
  [`display.paymentMethods`](/guides/payment-methods). The two are mutually
  exclusive. This reference is kept for existing integrators.
</Warning>

Optionally pass `display.paymentOptions` to control which payment methods appear and in what order.
When omitted, all available methods are shown.

### Categories

| Option           | Description                                                                                                                  |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `"AllFiat"`      | All eligible fiat methods configured for the org                                                                             |
| `"AllBank"`      | All eligible bank fiat methods configured for the org                                                                        |
| `"AllAddresses"` | Deposit address options for all supported EVM chains                                                                         |
| `"AllExchanges"` | All exchange options (Coinbase, Binance USDC, Lemon). Excludes opt-in options like `BinanceUSDT`, `CashApp`, and `MtPelerin` |
| `"AllWallets"`   | All supported wallet deeplinks (MetaMask, Trust, Phantom, etc.)                                                              |

### Fiat

| Option       | Description                |
| ------------ | -------------------------- |
| `"Interac"`  | Interac hosted fiat flow   |
| `"ApplePay"` | Apple Pay hosted fiat flow |
| `"ACH"`      | ACH hosted fiat flow       |
| `"SEPA"`     | SEPA hosted fiat flow      |
| `"JPYC"`     | JPYC hosted fiat flow      |
| `"ARS"`      | ARS hosted fiat flow       |

### Deposit Addresses

| Option       | Description                                                                                            |
| ------------ | ------------------------------------------------------------------------------------------------------ |
| `"Tron"`     | Tron USDT deposit address; payment-method responses can include an optional Trust Wallet send deeplink |
| `"Arbitrum"` | Arbitrum deposit address                                                                               |
| `"Base"`     | Base deposit address                                                                                   |
| `"Optimism"` | Optimism deposit address                                                                               |
| `"Polygon"`  | Polygon deposit address                                                                                |
| `"Ethereum"` | Ethereum deposit address                                                                               |
| `"BSC"`      | BSC (BNB Chain) deposit address                                                                        |

### Exchanges

| Option          | Description                               |
| --------------- | ----------------------------------------- |
| `"Coinbase"`    | Coinbase onramp                           |
| `"BinanceUSDC"` | Binance Connect (USDC withdrawal)         |
| `"BinanceUSDT"` | Binance Connect (USDT withdrawal, opt-in) |
| `"Lemon"`       | Lemon cash-out                            |

### Cash App

| Option      | Description                    |
| ----------- | ------------------------------ |
| `"CashApp"` | Cash App payment via Lightning |

### Wallets

| Option                         | Description                                                      |
| ------------------------------ | ---------------------------------------------------------------- |
| `"MetaMask"`                   | MetaMask wallet                                                  |
| `"Trust"`                      | Trust Wallet with `USDT on Tron` and `Ethereum` choices          |
| `"Phantom"`                    | Phantom wallet                                                   |
| `"Rainbow"`                    | Rainbow wallet                                                   |
| `"BaseApp"`                    | Base (Coinbase Wallet)                                           |
| `"Bitget"`                     | Bitget wallet                                                    |
| `"OKX"`                        | OKX wallet                                                       |
| `"Zerion"`                     | Zerion wallet                                                    |
| `"ConnectedWallet"`            | Use already-connected browser wallet (no prompt, errors if none) |
| `"AutoconnectInjectedWallets"` | Auto-connect injected browser wallet                             |

When `paymentOptions` is omitted, the default is `["AllWallets", "AllExchanges", "AllAddresses"]`. CashApp, Tron, AllFiat, AllBank, and individual chain addresses must be explicitly included.

**Array order** defines display order. A **single option** skips the selection screen (e.g. `["Lemon"]` goes straight to Lemon).

**Nested arrays** control wallet ordering within a group:

```json theme={null}
{
  "paymentOptions": ["AllExchanges", ["MetaMask", "Trust", "Phantom"]]
}
```

This shows exchanges first, then a wallet group with MetaMask, Trust, and Phantom in that order. Nested arrays only support wallets.

```bash theme={null}
curl -X POST https://api.daimo.com/v1/sessions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "destination": {
      "type": "evm",
      "address": "0xYourAddress",
      "chainId": 8453,
      "tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "amountUnits": "10.00"
    },
    "display": {
      "title": "Deposit USDC",
      "verb": "Deposit",
      "paymentOptions": ["Coinbase", "BinanceUSDC"]
    }
  }'
```
