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

# Flow of Funds

> How Rain embedded wallets support card funding across Rain managed and partner managed programs.

Your program's flow of funds determines how embedded wallets interact with the collateral backing card spend.

In Rain managed programs, the user's wallet owns the collateral contract used to fund their card. In partner managed programs, the partner generally maintains a program reserve that backs card spending, independently of the user's wallet.

Wallet creation, authentication, recovery, and standard wallet transactions work the same way under both models. The differences are in card funding, transaction authorization, and settlement.

## What doesn't change

Wallet functionality is identical across both program models. The following guides apply to both:

* [Wallet creation](/docs/embedded-wallets/wallet-creation) and [authentication](/docs/embedded-wallets/authentication)
* [Backup and recovery](/docs/embedded-wallets/backup-and-recovery) and [key export](/docs/embedded-wallets/key-export)
* [Balances and history](/docs/embedded-wallets/balances-and-history)
* [Receiving funds](/docs/embedded-wallets/receiving-funds)
* [Sending funds](/docs/embedded-wallets/sending-funds) and [gas sponsorship](/docs/embedded-wallets/gas-sponsorship)

Under both models, wallets remain non-custodial. Users retain control of their funds, and all outgoing transactions require their authorization.

## Comparing program models

The table below summarizes how card funding, authorization, and settlement differ between Rain managed and partner managed programs.

| | Rain-managed | Partner-managed |
| - | - | - |
| Collateral structure | Rain deploys a collateral contract for each user or company. | You maintain and fund a program reserve. In the US model, cardholders have individual contracts backed by a partner funded insurance fund. |
| Wallet ownership | The wallet owns the collateral contract and authorizes withdrawals. | Under the standard model, the wallet does not own or directly control the program reserve. |
| Funding card spend | Users deposit funds into their collateral contract or enable real time funding where supported. | You fund and replenish the reserve. Transfers from user wallets are managed by your application. |
| Transaction authorization | Rain authorizes transactions against available spending power. | You authorize transactions through the `transaction.requested` webhook. |
| Settlement | Rain liquidates user collateral to settle with the card network. | Rain liquidates your reserve to settle with the card network. You settle separately with your users. |
| Ledger of record | Rain | You |
| Real time funding | Available to eligible programs with the feature enabled. | Not supported. |
| Delegated signing | Rain uses a signer restricted to card settlement, which is automatically revoked when the card closes or the account is offboarded. | Not applicable. |
| Webhooks | Standard wallet and transaction events. | Standard wallet and transaction events, plus `transaction.requested` for authorization. |

For more detail on each program model, see [Managing collateral](https://docs.rain.xyz/docs/managing-collateral), [Rain managed programs](https://docs.rain.xyz/docs/rain-managed-programs), [Partner managed programs](https://docs.rain.xyz/docs/partner-managed-programs), and [Transaction lifecycle](https://docs.rain.xyz/docs/transaction-lifecycle).

## Rain managed programs

In Rain managed programs, the user's wallet owns the collateral contract that backs their card spending.

1. **Register the wallet.** Include the wallet address in the user or company application. Once approved, Rain deploys a collateral contract with the registered wallet as its owner.
2. **Fund the contract.** Users deposit funds into their collateral contract from their Rain wallet or another source.
3. **Authorize and settle transactions.** Rain authorizes card transactions against available spending power, manages settlement, and maintains the ledger of record. Your application receives transaction webhooks.
4. **Withdraw collateral.** Users can withdraw available collateral by signing with their wallet. Your backend retrieves the required admin signature from Rain.
5. **Enable real-time funding.** For eligible programs, users can authorize their collateral contract to spend from their wallet, allowing funds to be transferred when card transactions are authorized instead of depositing collateral in advance.

For implementation details, see [Card funding and settlement](/docs/embedded-wallets/card-funding-and-settlement).

## Partner managed programs

In standard partner managed programs outside the US, embedded wallets allow users to hold and transfer stablecoins but do not directly fund card spending. Instead, your program maintains the collateral reserve that backs card transactions.

* **Manage collateral.** You fund and replenish your program's reserve, which Rain uses to settle card transactions.
* **Authorize transactions.** You approve or decline transactions through the `transaction.requested` webhook and maintain your own records of user balances and activity.
* **Fund accounts from wallets.** If users fund their card accounts from their wallets, your application facilitates a user authorized transfer to an address you control. You are responsible for reconciling those transfers and crediting users in your ledger. Rain does not orchestrate these transfers, and delegated signing and real time funding are not available.

**US partner managed programs**

In the US model, each cardholder funds an individual collateral contract and settles directly with Rain. Partners contribute to an insurance fund that covers losses rather than funding a shared reserve.

## Identify your program model

Your program is configured as either Rain managed or partner managed. Confirm your program model with your Rain account manager.

## What's next

<Columns cols={2}>
  <Card title="Card funding and settlement" icon="credit-card" href="/docs/embedded-wallets/card-funding-and-settlement">
    The Rain-managed flow end to end.
  </Card>

  <Card title="Transaction lifecycle" icon="arrows-rotate" href="/docs/transaction-lifecycle">
    Authorization, settlement, and the webhooks along the way.
  </Card>
</Columns>
