# Withdrawals

### Fiat Payout

{% hint style="info" %}
This flow also applies to UR Peer Transfers - fiat transfers between 2 `live` UR accounts.
{% endhint %}

This flow enables a fully verified (`Live`) user to send funds from their UR account to an external bank account. This is a high-security action that requires the user to authenticate and sign the transaction.

<table><thead><tr><th width="213.1640625">Flow</th><th width="431.45703125">Details</th><th>Responsibility of</th></tr></thead><tbody><tr><td>1. Prerequisite</td><td>The user's status must be <code>Live</code>.</td><td>Partner</td></tr><tr><td>2. Initiate Payout</td><td>The user clicks "Withdraw" or "Send to Bank" from within your app.</td><td>Partner</td></tr><tr><td>3. Request Payout URL</td><td>Your backend calls <code>GET /v1/payouts/url</code> to get a one-time URL for the Payout webview.</td><td>Partner</td></tr><tr><td>4. Open Payout Webview</td><td>Your app opens a secure webview with the URL provided by UR.</td><td>Partner</td></tr><tr><td>5. User Authenticates</td><td>Inside the webview, the user <em>must</em> re-authenticate (via Email/Google SSO) to securely access their private key.</td><td>UR</td></tr><tr><td>6. Complete &#x26; Confirm</td><td>The user fills in the payout details (amount, destination IBAN, reference) and confirms the transaction.</td><td>UR</td></tr><tr><td>7. Authorize &#x26; Process</td><td>The user's confirmation, combined with their authentication, authorizes UR's backend to execute the on-chain payout.</td><td>UR</td></tr><tr><td>8. Notify Partner</td><td>UR's backend executes the on-chain payout, and the funds are sent. UR sends a <code>payment.sent</code> webhook to your backend.</td><td>UR -> Partner</td></tr><tr><td>9. Update User</td><td>Your backend receives the webhook and updates the user's balance and transaction history in your app.</td><td>Partner</td></tr></tbody></table>

{% @mermaid/diagram content="sequenceDiagram
participant User (on Partner App)
participant Partner (Frontend)
participant Partner (Backend)
participant UR (Webview - Payout)
participant UR (Backend)
participant UR (Wallet/Turnkey)
participant UR (Banking Core)

```
Note over User (on Partner App), UR (Banking Core): Prerequisite: User status is "Live"

User (on Partner App)->>Partner (Frontend): 1. Clicks "Withdraw"
Partner (Frontend)->>Partner (Backend): 2. Request Payout URL
Partner (Backend)->>UR (Backend): 3. GET /v1/payouts/url
UR (Backend)-->>Partner (Backend): 4. Return one-time Payout URL
Partner (Backend)-->>Partner (Frontend): 5. Send URL
Partner (Frontend)->>User (on Partner App): 6. Open UR Payout Webview

User (on Partner App)->>UR (Webview - Payout): 7. Authenticate (Email/Google SSO)
UR (Webview - Payout)->>UR (Wallet/Turnkey): 8. Securely unlock private key

User (on Partner App)->>UR (Webview - Payout): 9. Enters Payout Details (Amount, IBAN)
UR (Webview - Payout)->>User (on Partner App): 10. Show Confirmation Screen
User (on Partner App)->>UR (Webview - Payout): 11. Clicks "Confirm & Send"

UR (Webview - Payout)->>UR (Backend): 12. Submit Payout Request

note right of UR (Backend): 13. User's auth (Step 7) authorizes this
UR (Backend)->>UR (Wallet/Turnkey): 14. Generate Signed Transaction
UR (Wallet/Turnkey)-->>UR (Backend): 15. Return Signed Tx

UR (Backend)->>UR (Banking Core): 16. Execute SEPA/SWIFT Transfer (submits tx)

UR (Banking Core)-->>UR (Backend): 17. Payout Successful
UR (Backend)->>Partner (Backend): 18. Webhook: payment.sent (user_id, amount)

Partner (Backend)-->>Partner (Frontend): 19. Update UI (e.g., via WebSocket)
Partner (Frontend)->>User (on Partner App): 20. Show "Withdrawal Sent" & Updated Balance" %}
```

### Fiat-to-Crypto Conversion (Onramp)

{% hint style="info" %}
This flow allows a user to instantly purchase crypto from your platform using the fiat balance held in their UR bank account.
{% endhint %}

**Scenario:** A user has $1,000 in their embedded UR account and wants to on-ramp $500 to buy USDC.

<table><thead><tr><th width="164.703125">Flow</th><th width="420.93359375">Details</th><th>Responsibility of</th></tr></thead><tbody><tr><td>1. Initiate On-Ramp</td><td>The user goes to the "Buy Crypto" section and chooses to pay using their available fiat balance in the embedded UR account.</td><td>Partner</td></tr><tr><td>2. Confirm Transaction</td><td>Partner's trading engine provides a real-time quote for the crypto purchase. The user confirms the amount.</td><td>Partner</td></tr><tr><td>3. Instant Fiat Settlement</td><td>Partner execute an internal transfer of $500 from the user's individual UR account to Partner's corporate UR account, enabled by <a data-mention href="/pages/IiUTnzUlJBIKVdGO1BCe">/pages/IiUTnzUlJBIKVdGO1BCe</a>. The settlement is instant.</td><td>Partner -> UR</td></tr><tr><td>4. Crypto Delivery</td><td>Upon confirmation of the instant fiat settlement, Partner's trading engine is triggered to purchase the crypto and deliver it to the user's connected wallet.</td><td>Partner</td></tr></tbody></table>

{% @mermaid/diagram content="sequenceDiagram
participant User
participant Partner
participant UR

```
User->>Partner: 1. Initiate On-Ramp (e.g., $500 to USDC)
Note over User, Partner: User selects their existing fiat balance as the payment source.
Partner ->>Partner : 2. Get Crypto Quote & User Confirms
Partner ->>UR: 3. Call `Payments API` (Debit $500 from User, Credit OSL Omnibus)
UR ->>UR: 4. Settle Fiat Instantly (Internal Transfer)
UR -->>Partner: 5. Fiat Settlement Confirmed
Partner ->>Partner: 6. Execute Crypto Purchase
Partner -->>User: 7. Deliver Crypto to User's Wallet" %}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ur.app/concepts/withdrawals.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
