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

# Deposit On-Chain (Receive Crypto)

> Crypto deposits are where a customer's mobile money wallet account is deducted a specific fiat amount which is then converted to a specified stablecoin amount and sent to the integrator's specified public wallet address.

<Warning>
  This endpoint is marked as **deprecated** but is fully functional. It will be replaced with a clearer naming convention in the future.
</Warning>

## Use Case

This endpoint is for **e-commerce platforms and businesses that want to accept mobile money payments and receive the equivalent in cryptocurrency**.

**Perfect for:**

* E-commerce platforms accepting crypto payments
* Merchants wanting to receive payments in stablecoins
* Platforms converting fiat payments to crypto automatically

**NOT for:**

* Selling crypto to customers (use `/onramp` instead)
* Running a crypto exchange

## How It Works

1. Your customer pays via mobile money (STK push)
2. We collect the mobile money payment
3. We convert the fiat to crypto at current rates
4. **Your crypto wallet receives the USDT/crypto**
5. You fulfill the customer's order

## Flow

```mermaid theme={null}
sequenceDiagram
    participant Customer
    participant KotaniPay
    participant MobileMoney
    participant Blockchain
    participant Merchant

    Customer->>KotaniPay: Initiate deposit
    KotaniPay->>MobileMoney: Send STK push
    MobileMoney->>Customer: Request PIN
    Customer->>MobileMoney: Enter PIN
    MobileMoney->>KotaniPay: Payment successful
    KotaniPay->>Blockchain: Convert & send crypto
    Blockchain->>Merchant: Receive USDT/crypto
    KotaniPay->>Merchant: Webhook notification
```

## Key Differences

| Aspect                   | This Endpoint (Deposit On-Chain) | Onramp Endpoint                  |
| ------------------------ | -------------------------------- | -------------------------------- |
| Who receives crypto?     | ✅ **You** (the merchant)         | Customer                         |
| Who receives fiat?       | Payment processor                | ✅ **You** (the merchant)         |
| Crypto inventory needed? | ❌ No                             | ✅ Yes (must have crypto to sell) |
| Use case                 | Accept payments in crypto        | Sell crypto to customers         |

## Examples

### Receive crypto to your wallet

When you DON'T provide `public_address`, crypto goes to your wallet:

```json theme={null}
{
  "customer_key": "cus_abc123",
  "wallet_id": "wallet_polygon_usdt_xyz",
  "amount": 1450,
  "chain": "POLYGON",
  "token": "USDT",
  "callback_url": "https://yourdomain.com/webhook",
  "reference_id": "order_12345"
}
```

**Result:** You receive \~0.65 USDT in your POLYGON wallet

### Send crypto to customer's address

When you provide `public_address`, crypto goes directly to that address:

```json theme={null}
{
  "customer_key": "cus_abc123",
  "wallet_id": "wallet_polygon_usdt_xyz",
  "amount": 1450,
  "chain": "POLYGON",
  "token": "USDT",
  "public_address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
  "callback_url": "https://yourdomain.com/webhook",
  "reference_id": "order_12345"
}
```

**Result:** Customer receives \~0.65 USDT at their address

## Supported Chains & Tokens

Get supported chains and tokens:

```bash theme={null}
GET /api/v3/deposit/on-chain/supported-chains
```

Response:

```json theme={null}
{
  "data": {
    "POLYGON": ["USDT", "USDC"],
    "ETHEREUM": ["USDT", "USDC"],
    "CELO": ["CUSD"],
    "STELLAR": ["USDC"],
    "SOLANA": ["USDT", "USDC"]
  }
}
```

## Status Tracking

Track your deposit status:

```bash theme={null}
GET /api/v3/deposit/on-chain/status/{reference_id}
```

See [Get Deposit On-Chain Status](/v3/api-reference/deposits/deposit-on-chain-status) for details.


## OpenAPI

````yaml POST /api/v3/deposit/on-chain
openapi: 3.0.0
info:
  title: KOTANI PAY API PLATFORM
  description: ''
  version: '3.0'
  contact: {}
servers:
  - url: https://preview.kotanipay.com
security: []
tags: []
paths:
  /api/v3/deposit/on-chain:
    post:
      tags:
        - DEPOSIT
      summary: Deposit onChain
      description: >-
        Crypto deposits are where a customer's mobile money wallet account is
        deducted a specific fiat amount which is then converted to a specified
        stablecoin amount and sent to the integrator's specified public wallet
        address.
      operationId: DepositOnchainController_onchain_api/v3
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDepositMobileMoneyOnChainDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Deposit has been successfully created.
                  data:
                    $ref: '#/components/schemas/DepositResponseDto'
                    type: object
        '400':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Bad Request
                  data:
                    type: object
                    example: {}
        '401':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Unauthorized
                  data:
                    type: object
                    example: {}
        '404':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Not Found
                  data:
                    type: object
                    example: {}
        '409':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Duplicate Transaction
                  data:
                    type: object
                    example: {}
        '429':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Too Many Requests
                  data:
                    type: object
                    example: {}
      deprecated: true
      security:
        - JWT: []
components:
  schemas:
    CreateDepositMobileMoneyOnChainDto:
      type: object
      properties:
        public_address:
          type: string
          description: The transaction public address
        chain:
          description: supported chain
          allOf:
            - $ref: '#/components/schemas/Chain'
        token:
          description: supported token
          allOf:
            - $ref: '#/components/schemas/StableCoin'
        wallet_id:
          type: string
          description: The wallet id
        amount:
          type: number
          description: The amount to deposit
        customer_key:
          type: string
          description: The customer key
        callback_url:
          type: string
          description: The callback url
        reference_id:
          type: string
          description: Optional reference id
      required:
        - chain
        - token
        - wallet_id
        - amount
        - customer_key
    DepositResponseDto:
      type: object
      properties:
        id:
          type: string
        message:
          type: string
        reference_id:
          type: string
        reference_number:
          type: number
        customer_key:
          type: string
        redirect_url:
          type: string
      required:
        - id
        - message
        - reference_id
        - reference_number
    Chain:
      type: string
      enum:
        - ETHEREUM
        - CELO
        - AVALANCHE
        - POLYGON
        - ARBITRUM
        - OPTIMISM
        - STELLAR
        - TRON
        - FUSE
        - LIGHTNING
        - SOLANA
        - PROVENANCE
        - CARDANO
        - HEDERA
        - BASE
        - LISK
        - VICTION
        - SCROLL
      description: The chain of the wallet.Its required if the wallet is a crypto wallet
    StableCoin:
      type: string
      enum:
        - CUSD
        - USDC
        - USDT
        - USDT0
        - SAT
        - BTC
        - HASH
        - FUSE
        - HBAR
        - USDGLO
        - CKES
        - CGHS
        - MSAT
        - XLM
        - ADA
      description: The currency of the wallet
  securitySchemes:
    JWT:
      scheme: bearer
      bearerFormat: JWT
      type: http

````