Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
281 changes: 239 additions & 42 deletions api-features/crypto-to-fiat-payments.mdx
Original file line number Diff line number Diff line change
@@ -1,65 +1,262 @@
---
title: "Crypto-to-fiat Payments"
description: "USDC payments settled directly to bank accounts with automatic conversion"
description: "Pay requests in crypto while payees receive fiat in bank accounts"
---

# Crypto-to-fiat Payments

Crypto-to-fiat payments allow a Payer to pay a Request in cryptocurrency, while the Payee receives fiat currency directly in their bank account. This is achieved by combining the Request Network crypto payment with [Request Tech](https://www.request.finance/tech) offramp infrastructure. This requires prerequisite compliance (KYC/Agreement) and bank account registration (payment detail) flows.

[EasyInvoice](/request-network-api/easyinvoice-api-demo-app) includes a reference implementation for this flow.

<Info>
Crypto-to-fiat payments are only available in version 2 of the Request Network API.
</Info>

## Getting Started with Crypto-to-fiat Payments

### Sandbox Access - Get Started Today

All developers can immediately access the **Crypto-to-fiat Sandbox** to build and test their integration:

1. **Create an account** on the [Request Network API Portal](https://portal.request.network/)
2. **Generate a Sandbox API key** with crypto-to-fiat sandbox access
3. **Start building** with Sepolia testnet USDC, simulated KYC, and mock bank accounts

The sandbox provides a complete testing environment where you can:

* Test the full crypto-to-fiat flow without real funds
* Simulate payer KYC verification using [mock documents](https://docs.sumsub.com/docs/verification-document-templates)
* Work with mock bank account data and fiat payment status

<Warning>
**AI-Generated Content** – This page was generated with AI assistance and may contain inaccuracies. While likely close to accurate, please verify critical details with the [stable documentation](https://docs.request.network) or [contact support](https://github.com/orgs/RequestNetwork/discussions).
I**mportant: Other Payment Types Use Real Funds**
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in formatting - "I**mportant:" should be "**Important:"

Suggested change
I**mportant: Other Payment Types Use Real Funds**
**Important: Other Payment Types Use Real Funds**


The "Crypto-to-fiat Sandbox" setting for API keys only affects crypto-to-fiat payments. Other payment types can process *real* funds with any API key, even Sandbox API keys.
</Warning>

## Overview
### Production Access - Launch When Ready

When you're ready to go live with real transactions:

1. [**Get in touch**](https://2deywy.share-eu1.hsforms.com/2b92phs9LR_eJdeZoxzmoMA?utm_source=request.network\&utm_medium=docs\&utm_campaign=evergreen\&utm_content=get_in_touch) to request production access
2. **Discuss your use case** with our team to ensure the best integration approach
3. **Complete the approval process** - we'll work with you to get everything set up
4. **Generate Production API keys** once approved

Production access includes:

* Real USDC transactions on mainnet
* Actual KYC verification for payers
* Live bank account validation
* Fiat deposits to real bank accounts

### Crypto-to-fiat Supported Chains and Currencies

For Crypto-to-fiat Payments, the Request Network API supports USDC on Ethereum, Polygon, Arbitrum One, and Sepolia.

<Info>
**Crypto-to-fiat Payment with non-USDC currencies:**

While crypto-to-fiat requests must be created in USDC, users can pay in alternative currencies through a four-step process, using [crosschain-payments](/api-features/crosschain-payments):

1. **Create Crosschain Request**: Create a request to swap the payer's currency (e.g., ETH on Ethereum) to USDC on the target chain (e.g., USDC on Polygon). Note: Don't specify a payer address during request creation to allow flexibility in who can pay.
2. **Pay Crosschain Request**: Execute the crosschain payment to fulfill the first request
3. **Create Crypto-to-Fiat Request**: Create a separate request for the USDC offramp to fiat and bank deposit
4. **Pay Crypto-to-Fiat Request**: Execute the crypto-to-fiat payment to complete the flow

This four-step approach is required due to current API limitations - more streamlined flows are not yet implemented.
</Info>

## Understanding `clientUserId`

Many `/payer` endpoints in the Request Network API require a `clientUserId` as a path parameter. This value is an **arbitrary identifier** chosen by your platform to represent a user (the payer) in your own system.

* **You control the format:** The `clientUserId` can be any unique string that makes sense for your application. It can be a UUID, email address, database ID, or anything unique per user on your platform.
* **EasyInvoice Example:** In the EasyInvoice demo app, `clientUserId` is set to the user's email address.
* **Why is this useful?** This approach allows you to integrate the Request Network API without having to change your existing user management logic. You simply pass your own identifier to the API, and all payer-related compliance, agreement, and payment detail records will be associated with that value.

**Example usage:**

```
GET /v2/payer/{clientUserId}
PATCH /v2/payer/{clientUserId}
POST /v2/payer/{clientUserId}/payment-details
GET /v2/payer/{clientUserId}/payment-details
```

In each case, replace `{clientUserId}` with your chosen identifier for the user.

## Compliance & Payer Onboarding

Before a payer can use crypto-to-fiat, they must complete compliance steps:

* **KYC**: The payer must submit a KYC application.
* **Agreement**: The payer must sign a compliance agreement (via an iframe flow).
* **Bank Account**: The payee's bank account must be associated with a payer for compliance reasons, even though the payee owns the account.

### **Compliance Flow Diagram**

```mermaid
sequenceDiagram
participant Payer
participant Platform
participant RequestAPI
participant RequestTech

Payer->>Platform: Submit KYC data via KYC Form
Platform->>RequestAPI: POST /payer (KYC data)
RequestAPI->>RequestTech: Forward KYC
RequestTech-->>RequestAPI: KYC status update (webhook)
Note over Platform: Wait for KYC "approved"
RequestAPI-->>Platform: webhook: compliance.updated (kycStatus: pending/approved/rejected/failed)
Platform->>Payer: Show iframe for agreement signature
Payer->>Platform: Completes signature
Platform->>RequestAPI: PATCH /payer/{payerId} (agreement_status: completed)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inconsistent parameter naming - uses {payerId} but should be {clientUserId} per the "Understanding clientUserId" section

Suggested change
Platform->>RequestAPI: PATCH /payer/{payerId} (agreement_status: completed)
Platform->>RequestAPI: PATCH /payer/{clientUserId} (agreement_status: completed)

RequestAPI-->>Platform: webhook: compliance.updated (agreementStatus: completed)
```

### **Flow Explanation**

1. **Submit KYC**: The platform collects KYC information from the payer and submits it to the API.
2. **KYC Review**: The platform receives webhook updates as the KYC is processed (`compliance.updated` with `kycStatus`).
3. **Agreement Signature**: The platform displays an iframe for the payer to sign the compliance agreement. Once signed, the platform calls the API to update the agreement status.
4. **Agreement Confirmation**: The platform receives a webhook update when the agreement is completed (`compliance.updated` with `agreementStatus`).

### Relevant Endpoints

* `POST /payer`: Submit KYC application.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing version prefix - should be /v2/payer for consistency with line 136

Suggested change
* `POST /payer`: Submit KYC application.
* `POST /v2/payer`: Submit KYC application.

* `GET /payer/{clientUserId}`: Get compliance status for a payer.
* `PATCH /payer/{clientUserId}`: Update agreement status after signature.

## Create compliance data for a user

> Checks compliance status and returns necessary URLs for completing compliance.

Endpoint reference: [POST /v2/payer](https://api.request.network/open-api/#tag/v2payer/POST/v2/payer)

Crypto-to-fiat payments enable seamless conversion from cryptocurrency to traditional bank account deposits, combining the speed of crypto with the familiarity of fiat settlement.
## Get compliance status for a user

## How It Works
> Retrieves the comprehensive compliance status for a specific user, including KYC and agreement status.

Endpoint reference: [GET /v2/payer/{clientUserId}](https://api.request.network/open-api/#tag/v2payer/GET/v2/payer/{clientUserId})

## Update agreement status

> Update the agreement completion status for a user.

Endpoint reference: [PATCH /v2/payer/{clientUserId}](https://api.request.network/open-api/#tag/v2payer/PATCH/v2/payer/{clientUserId})

## Setting Up a Crypto-to-Fiat Request (Payee Flow)

Before a payer can pay in crypto and the payee can receive fiat, the platform must:

* **Submit the payee’s bank account details** (associated with a payer for compliance).
* **Wait for approval** of those payment details (usually less than 60 seconds, confirmed via webhook).
* **Create a new request** with `isCryptoToFiatAllowed = true`.

### **Payment Details Flow Diagram**

```mermaid
graph LR
A[Payer: USDC] --> B[KYC Verification]
B --> C[Compliance Check]
C --> D[Bank Transfer]
D --> E[Payee: USD in Bank]
sequenceDiagram
participant Payee
participant Platform
participant RequestAPI
participant RequestTech

Payee->>Platform: Submit bank info via Bank Account Form
Platform->>RequestAPI: POST /payer/{payerId}/payment-details (bank info)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inconsistent parameter naming - uses {payerId} but should be {clientUserId} per the "Understanding clientUserId" section

Suggested change
Platform->>RequestAPI: POST /payer/{payerId}/payment-details (bank info)
Platform->>RequestAPI: POST /payer/{clientUserId}/payment-details (bank info)

RequestAPI->>RequestTech: Forward payment details
RequestTech-->>RequestAPI: payment_detail_update (webhook)
Note over Platform: Wait for payment detail "approved"
RequestAPI-->>Platform: webhook event: payment_detail.updated (status: approved/failed/pending)
Platform->>RequestAPI: POST /request (isCryptoToFiatAllowed = true)
RequestAPI-->>Platform: Request created
```

**Benefits:**
- **Fiat Settlement:** Receive traditional currency in bank accounts
- **Regulatory Compliance:** Built-in KYC and compliance workflows
- **Global Reach:** Support for multiple countries and currencies
### **Flow Explanation**

## Requirements
1. **Submit Bank Account**: The platform submits the payee’s bank account details, associating them with a payer. The Request Network API forwards these details to the offramp provider (Request Tech).
2. **Approval**: The platform receives a webhook (`payment_detail.updated`) indicating if the payment details are approved, failed, or pending.
3. **Create Request**: Once approved, the platform creates a new request as usual, but with the `isCryptoToFiatAllowed` flag set to `true`. This signals that the request is eligible for crypto-to-fiat payment.

<CardGroup cols={2}>
<Card title="Payer KYC" icon="shield-check">
Identity verification required for compliance
</Card>

<Card title="Bank Account" icon="building-columns">
Valid bank account for settlement
</Card>
</CardGroup>
### **Design Rationale & UX Constraints**

## Supported Networks
While it is technically possible to create a crypto-to-fiat request before the payer has completed KYC, EasyInvoice intentionally requires the payer to complete KYC first. This decision is based on several practical and UX considerations:

- **Production:** USDC on Ethereum, Polygon, Arbitrum
- **Sandbox:** USDC on Sepolia (testing)
* **Bank Account Association:** The payee’s bank account ("payment details") must be linked to a specific payer, which can only be done after the payer completes KYC. This ensures compliance and accurate association of payment details.
* **Validation Complexity:** Although the payee could submit their bank account details in advance, the platform cannot validate or approve these details until the payer’s KYC is complete. This would introduce additional communication steps and potential confusion.
* **UI Simplicity:** EasyInvoice integrates payee bank account registration directly into the Create Invoice form. If the user clicks "Create" before the bank account is approved, a loading indicator appears until approval is granted. This avoids the need for a separate bank account management page and keeps the user experience straightforward.
* **Protocol Fit**: The crypto-to-fiat feature is integrated at the API level, not at the Request Network protocol level. Creating a request on the protocol does not require bank account details, because the protocol itself only handles crypto payments. The additional bank account and offramp logic is layered on top via the API, which transfers crypto to Request Tech, who then executes the offramp and sends fiat to the payee’s bank account. This separation adds some complexity, so the UI is intentionally kept simple.
* **Future Flexibility:** While some clients may want to allow payees to create requests before payer KYC, this is not currently supported in EasyInvoice to avoid increased complexity. We may revisit this if there is sufficient market demand.

## Settlement Time
This approach ensures a smooth, compliant, and user-friendly experience, even if it means some technical possibilities are not exposed in the current UI.

- **Processing:** 1-3 business days
- **Compliance:** Additional time for KYC verification
### Relevant Endpoints

* `POST /payer/{clientUserId}/payment-details`: Create payment details (register bank account) for a payee.
* `GET /payer/{clientUserId}/payment-details`: Get payment details (bank accounts) for a payee.
* `POST /v2/request` with `isCryptoToFiatAllowed = true`: Create a new crypto-to-fiat request

## Create payment details

> Create payment details for a user

Endpoint reference: [POST /v2/payer/{clientUserId}/payment-details](https://api.request.network/open-api/#tag/v2payer/POST/v2/payer/{clientUserId}/payment-details)

## Get payment details for a user

> Retrieves the registered bank account details for a user. Optionally filter by payment details ID.

Endpoint reference: [GET /v2/payer/{clientUserId}/payment-details](https://api.request.network/open-api/#tag/v2payer/GET/v2/payer/{clientUserId}/payment-details)

## Create a new request

> Create a new payment request

Endpoint reference: [POST /v2/request](https://api.request.network/open-api/#tag/v2request/POST/v2/request)

## Paying a Crypto-to-Fiat Request

The payer pays in crypto; Request Tech handles offramping and fiat payout.

### **Payment Flow Diagram**

```mermaid
sequenceDiagram
participant Payer
participant Platform
participant RequestAPI
participant RequestTech
participant Blockchain

Platform->>RequestAPI: GET payment calldata for request/{requestId}/pay
Platform->>Payer: Prompt to sign and send transaction
Payer->>Blockchain: Send crypto to Request Tech
Blockchain-->>RequestTech: Payment received
RequestTech-->>RequestAPI: offramp_update (webhook)
RequestAPI-->>Platform: webhook: payment.processing/payment.failed (subStatus: initiated, ongoing_checks, sending_fiat, fiat_sent, failed, etc.)
RequestTech->>Payee Bank: Offramp and deposit fiat
Comment on lines +225 to +239
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing participant declaration - "Payee Bank" is used on line 239 but not declared in the participant list

Suggested change
```mermaid
sequenceDiagram
participant Payer
participant Platform
participant RequestAPI
participant RequestTech
participant Blockchain
Platform->>RequestAPI: GET payment calldata for request/{requestId}/pay
Platform->>Payer: Prompt to sign and send transaction
Payer->>Blockchain: Send crypto to Request Tech
Blockchain-->>RequestTech: Payment received
RequestTech-->>RequestAPI: offramp_update (webhook)
RequestAPI-->>Platform: webhook: payment.processing/payment.failed (subStatus: initiated, ongoing_checks, sending_fiat, fiat_sent, failed, etc.)
RequestTech->>Payee Bank: Offramp and deposit fiat
sequenceDiagram
participant Payer
participant Platform
participant RequestAPI
participant RequestTech
participant Blockchain
participant Payee Bank
Platform->>RequestAPI: GET payment calldata for request/{requestId}/pay
Platform->>Payer: Prompt to sign and send transaction
Payer->>Blockchain: Send crypto to Request Tech
Blockchain-->>RequestTech: Payment received
RequestTech-->>RequestAPI: offramp_update (webhook)
RequestAPI-->>Platform: webhook: payment.processing/payment.failed (subStatus: initiated, ongoing_checks, sending_fiat, fiat_sent, failed, etc.)
RequestTech->>Payee Bank: Offramp and deposit fiat

RequestTech-->>RequestAPI: offramp_update (fiat sent)
RequestAPI-->>Platform: webhook: payment.processing (subStatus: fiat_sent)
RequestAPI-->>Platform: webhook: payment.confirmed (fiat delivered)
```

## Used In
**Flow Explanation**

<CardGroup cols={2}>
<Card title="Invoicing" href="/use-cases/invoicing">
Traditional business payments
</Card>

<Card title="Payroll" href="/use-cases/payroll">
Employee fiat compensation
</Card>
</CardGroup>
1. **Get Payment Calldata**: The platform fetches payment calldata for the request.
2. **User Pays**: The payer signs and submits the transaction, sending crypto to Request Tech.
3. **Offramp Processing**: Request Tech receives the crypto and begins the offramp process.
4. **Status Updates**: The platform receives webhook events as the offramp progresses (`payment.processing`, `payment.failed`), with `subStatus` indicating the current offramp stage.
5. **Fiat Delivered**: When the offramp is complete, the platform receives a final webhook (`payment.processing` with `subStatus: fiat_sent`), and then a `payment.confirmed` event.

## Implementation Details
## Crypto-to-fiat Webhook Event Reference

See [API Reference - Crypto-to-fiat Payments](/api-reference/crypto-to-fiat-payments) for complete technical documentation.
| | | |
| ------------------------ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Event | Description | subStatus values (if any) |
| `compliance.updated` | KYC/Agreement status updates | `kycStatus`: `initiated`, `pending`, `approved`, `rejected`, `failed`; `agreementStatus`: `not_started`, `pending`, `completed`, `rejected`, `failed` |
| `payment_detail.updated` | Payment detail (bank account) status | `approved`, `failed`, `pending` |
| `payment.processing` | Offramp in progress | `initiated`, `pending_internal_assessment`, `ongoing_checks`, `sending_fiat`, `fiat_sent`, `bounced`, `retry_required` |
| `payment.failed` | Offramp or payment failed | `failed`, `bounced` |
| `payment.confirmed` | Payment fully settled (fiat delivered) | |