Partner-Managed Card Flow

EarnOS Card Payments

One balance. Earn rewards, spend instantly on a card. No transfers, no second wallet.

Why Partner-Managed?

Rain offers two program models. EarnOS uses partner-managed so users see a single spendable balance — no manual funding step.

Rain-Managed

  • Spend power from Rain-controlled collateral
  • Users must fund their card separately
  • Two balances: wallet + card
  • Rain owns the auth decision

Partner-Managed

  • EarnOS ledger is the source of truth
  • Rain asks EarnOS on every transaction
  • One balance: earned = spendable
  • EarnOS owns the auth decision

System Components

User / App
EarnOS Backend
Rain Network
Treasury / Reserve

Earning & Balance

User earns rewards. The ledger credits them. The app shows one number.

User

User earns rewards

Completes missions, referrals, or other verified actions. Rewards are credited to their Turnkey-held payout account.

EarnOS

Credit event → Unified Ledger

The payout account emits a credit event. The EarnOS ledger records it, increasing the user's available balance.

App

One spendable balance shown

The EarnOS app queries the ledger and displays a single number. No "wallet balance" vs "card balance" split.

Card Authorization

User taps their card. Rain asks EarnOS to approve or decline in real time.

User

Tap / swipe Rain card

User presents their Rain-issued card at a merchant terminal. A standard card authorization is initiated.

Rain

Authorization request hits Rain

The card network routes the auth request to Rain. In partner-managed mode, Rain does not decide — it forwards to EarnOS.

EarnOS

transaction.requested webhook

Rain sends a webhook to the EarnOS card handler. The handler now has a short window to respond.

EarnOS

Check balance & place auth hold

The handler queries the unified ledger. If available ≥ amount, it places an auth hold (reducing available balance) and responds approve. Otherwise, decline.

Rain

Auth result returned to card

Rain relays the approve/decline to the card network. The merchant terminal shows the result. The app balance now reflects the hold.

Adjustments

Merchant changes the amount — tips, partial reversals, incremental auths.

Rain

transaction.updated webhook

Rain notifies EarnOS of an amount change. Could be a tip added at a restaurant, a partial reversal, or an incremental authorization.

EarnOS

Adjust the hold on ledger

The handler increases or decreases the existing auth hold to match the new amount. Available balance is recalculated.

Settlement

The transaction settles (typically 1–3 days). The hold becomes a real debit.

Rain

transaction.completed webhook

Rain notifies EarnOS that the transaction has settled on the card network. The final amount may differ slightly from the auth amount.

EarnOS

Release hold & post settled debit

The auth hold is released. A final settled debit for the exact settlement amount is posted to the ledger. Transaction history is updated.

App

Updated balance & history

The app shows the new available balance and the completed transaction in the user's spending history.

Treasury & Program Reserve

Rain still requires a program-level reserve to back settlement on the card network. This runs independently of user actions.

Treasury

EarnOS treasury monitors reserve

The treasury watches the Rain program reserve balance. When it falls below threshold, treasury tops it up.

Rain

Reserve backs card settlement

The Rain program reserve is shared, program-level collateral — not per-user. It ensures Rain can settle card transactions on the network.

Important caveat

This is a shared balance at the product/ledger layer, not a single custody pool inside Rain. Fund collection from Turnkey payout accounts happens after settlement, not at auth time. The ledger tracks the obligation; treasury operations reconcile actual fund movement.

Unified Balance Ledger

The ledger maintains three values per user. The app displays "available" as the single balance.

Available
$42.50
Earned minus holds. What you can spend right now.
Holds
$7.50
Pending card auths. Reserved but not settled.
Settled
$150.00
Completed debits. Final transaction history.

How Turnkey Fits In

User rewards sit in Turnkey-held payout wallets. Here's how EarnOS interacts with those wallets for card settlement without breaking the non-custodial model.

Do we lose non-custodial ability?

No.

Turnkey's Delegated Access model lets EarnOS create a backend-controlled "Delegated Account" inside each user's sub-organization. This account is not a root user — it's constrained by policies that limit it to specific actions (e.g., signing transfers only to a whitelisted EarnOS settlement address).

  • Private keys live in Turnkey's secure enclave — neither EarnOS nor Turnkey ever sees raw key material
  • The user remains the sole root user of their sub-organization and can revoke delegated access at any time
  • Users can still export their keys and leave whenever they want
  • The delegated account can only sign transactions matching its policy — e.g., send to EarnOS settlement address

It's a delegated/hybrid model: non-custodial at the key layer (user owns keys), with policy-scoped signing authority for EarnOS to collect settled funds.

How do we move funds after settlement?

Using Delegated Access + Turnkey policies, EarnOS can programmatically sign transfer transactions from user wallets after Rain confirms settlement — without the user needing to approve each one.

Setup (once per user)

Create sub-org with Delegated Account

When onboarding a user, EarnOS creates their Turnkey sub-organization with two users: the end-user (root, passkey-authenticated) and a Delegated Account (API-key, non-root). A policy is attached restricting the delegated account to signing transfers only to EarnOS's settlement address.

Trigger

Rain sends transaction.completed

A card transaction settles on the network. Rain notifies EarnOS with the final settled amount. The ledger releases the hold and posts the settled debit.

Collect

Sign transfer via Delegated Access

EarnOS backend uses the delegated API key to sign a transaction moving the settled amount from the user's Turnkey wallet to the EarnOS omnibus wallet. Turnkey's policy engine verifies the destination matches the whitelisted settlement address before signing.

On-chain

Transaction broadcast & confirmed

The signed transaction is broadcast on-chain. Funds move from the user's wallet to EarnOS's omnibus wallet. The user can verify every collection on the blockchain.

Turnkey Policy Example
{
  "effect": "EFFECT_ALLOW",
  "consensus": "approvers.any(user,
    user.id == '<DELEGATED_ACCOUNT_ID>')",
  "condition": "activity.action == 'SIGN'
    && wallet.id == '<USER_WALLET_ID>'
    && eth.tx.to == '<EARNOS_SETTLEMENT_ADDR>'"
}

The delegated account can only sign transactions sending to EarnOS's settlement address. Any other destination is rejected by the enclave.

Does EarnOS need a shared pool of funds?

Rain requires a program-level reserve to settle card transactions. The question is where the capital comes from. There are two viable models.

Model A: Treasury Float

EarnOS fronts its own capital into the Rain reserve. User funds stay in individual Turnkey wallets until after settlement, then are collected to replenish treasury.

1
User earns $10 Funds land in user's Turnkey wallet. Balance stays there.
2
User swipes $10 Rain settles against the EarnOS-funded reserve
3
1-3 days later: settlement Rain sends transaction.completed
4
Collect from Turnkey wallet Delegated Access sweeps $10 to omnibus wallet
5
Treasury replenished Omnibus funds top up Rain reserve
! Requires EarnOS treasury capital to float the reserve
! Capital requirement scales with active spend volume
+ User funds stay in their own Turnkey wallets longer
+ Most "non-custodial" feeling for users

Model B: Sweep on Earn (Recommended)

When a user earns rewards, funds are immediately swept from their Turnkey wallet to the EarnOS omnibus wallet via Delegated Access. The omnibus wallet funds the Rain reserve. Zero separate treasury capital needed.

1
User earns $10 Funds land in user's Turnkey wallet
2
Immediate sweep to omnibus Delegated Access moves $10 to EarnOS omnibus wallet. Ledger credits $10.
3
User swipes $10 Funds already in omnibus → Rain reserve. No float needed.
4
Settlement Rain settles. Omnibus already has the funds. No collection step.
+ Zero treasury capital required — user funds ARE the reserve
+ Scales automatically with user growth
+ Simpler settlement — no post-settlement collection step
+ Reserve always ≥ total user balances (massively over-collateralized)
· User's Turnkey wallet is a pass-through (balance = $0 at rest)
· Delegated Access policy still scoped to omnibus address only
· Standard fintech pattern (how Venmo, Cash App, etc. work)

Why this works

The Turnkey wallet is still non-custodial at the key layer — the user owns their keys and can export/revoke at any time. But practically, funds flow through it into the omnibus pool as soon as they're earned. The EarnOS ledger is the source of truth for each user's balance, and the omnibus wallet is the source of truth for actual funds. This is the same model every major fintech card program uses.

Model A: Treasury Float

  • User funds sit in individual Turnkey wallets
  • EarnOS fronts reserve from treasury
  • Collected post-settlement via Delegated Access
  • Treasury capital scales with spend volume
  • More complex reconciliation

Model B: Sweep on Earn

  • Funds swept to omnibus at earn-time
  • Omnibus funds the Rain reserve directly
  • No post-settlement collection needed
  • $0 treasury capital required
  • Simpler ops, standard fintech model

Treasury Reserve Calculator

How much capital does EarnOS need to float in the Rain reserve? Drag the sliders to model different scenarios.

100,000
1K10K100K250K500K1M10M
$25
$5$200
15%
1%50%
$8
$1$50
2 days
1 day2345 days
1.5x
1.0x3.0x
Model A: Treasury Float Required
$360,000
EarnOS must front this from treasury
Active card spenders 15,000
Daily spend volume $120,000
Unsettled float (raw) $240,000
+ Safety buffer +$120,000
Model B: Sweep on Earn
$0
treasury capital needed
Total user balances (omnibus pool) $2,500,000
Spend float needed $240,000
Excess coverage in omnibus $2,260,000
Coverage ratio 10.4x
Model B saves $360,000 in treasury capital

Default scenarios

$25 avg balance, 15% active, $8/day spend, 2-day settlement, 1.5x buffer

Users Total Balances Daily Volume A: Treasury Float B: Sweep (Treasury) B: Coverage

The bottom line

The user earns into Turnkey, spends via Rain, and sees one number in the app. EarnOS's ledger and webhook handler are the glue — approving transactions against earned balance in real time, then collecting funds post-settlement through Turnkey's Delegated Access, all without the user ever moving money between accounts or giving up custody of their keys.