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

# Prepare Payin

> Open a deposit intent and return receive instructions (bank details,
crypto address, momo prompt, or Interac). Requires `Idempotency-Key`.
Modes: `bank_details`, `crypto_address`, `momo`, `interac`.




## OpenAPI

````yaml /openapi.yaml post /payins/prepare
openapi: 3.1.0
info:
  title: Keette API
  version: 1.0.0
  description: |
    Public HTTP API for Keette workspaces. One base URL — live vs sandbox is
    selected by your API key (`sk_live_…` / `sk_test_…`).

    Endpoints are added as each implementation phase ships.
  contact:
    name: Keette Support
    email: talk@keette.com
servers:
  - url: https://20b9-41-90-209-232.ngrok-free.app/v1
    description: Local (ngrok)
  - url: https://api.keette.com/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Account
    description: Identity for the authenticating API key
  - name: Balances
    description: Wallet books
  - name: Beneficiaries
    description: Payout recipients
  - name: Transactions
    description: Unified transaction index
  - name: FX
    description: Indicative rates and firm quotes
  - name: Catalog
    description: Payout corridors and relationships
  - name: Payouts
    description: Send money to a beneficiary
  - name: Payins
    description: Collect money into your books
  - name: Swaps
    description: FX between your own books
  - name: Events
    description: Durable event log for webhook polling
paths:
  /payins/prepare:
    post:
      tags:
        - Payins
      summary: Prepare Payin
      description: |
        Open a deposit intent and return receive instructions (bank details,
        crypto address, momo prompt, or Interac). Requires `Idempotency-Key`.
        Modes: `bank_details`, `crypto_address`, `momo`, `interac`.
      operationId: preparePayin
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          description: Client-generated key so retries return the same intent.
          schema:
            type: string
            minLength: 1
            maxLength: 64
          example: payin-prep-2026-10-27-001
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreparePayinRequest'
            examples:
              bank_details:
                summary: NGN bank deposit instructions
                value:
                  target_currency: NGN
                  mode: bank_details
                  amount: 5000000
              crypto:
                summary: USDC on Base
                value:
                  target_currency: USDC
                  source_currency: USDC
                  mode: crypto_address
                  amount: 10000000
                  network: base
      responses:
        '200':
          description: Deposit intent with instructions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Payin'
              examples:
                bank:
                  value:
                    object: payin
                    id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                    status: pending
                    method: bank_transfer
                    target_currency: NGN
                    amount: 5000000
                    collection_mode: bank_details
                    stan: IN-2610-ABCDEF12
                    instructions:
                      account_name: Keette Collections
                      account_number: '0123456789'
                      bank_name: Guaranty Trust Bank
                      bank_code: '058'
                    created_at: '2026-10-27T13:00:00Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    PreparePayinRequest:
      type: object
      required:
        - target_currency
        - mode
        - amount
      properties:
        target_currency:
          type: string
          description: Book currency to credit.
          example: NGN
        source_currency:
          type: string
          description: |
            Currency of the receive rail. Defaults to `target_currency`. For
            Interac defaults to CAD; momo may infer KES/TZS from `channel`.
        mode:
          type: string
          enum:
            - bank_details
            - crypto_address
            - momo
            - interac
          description: How funds will arrive.
          example: bank_details
        amount:
          type: integer
          description: Amount the payer sends in `source_currency` minor units.
          example: 5000000
        target_amount:
          type: integer
          description: >-
            Required when `source_currency` differs from `target_currency` —
            expected credit in target minor units.
        network:
          type: string
          description: >-
            Crypto network (`base`, `ethereum`, …). Defaults to `base` for
            crypto.
        narration:
          type: string
          description: Optional payment reference / memo.
        redirect_url:
          type: string
          format: uri
          description: Required for Interac — where the payer returns after approval.
        country_code:
          type: string
          description: ISO country hint for some rails.
        msisdn:
          type: string
          description: Mobile number for momo (E.164 or local as required by channel).
        channel:
          type: string
          description: Momo channel id (e.g. `KE-MPESA`).
        payer_name:
          type: string
          description: Optional payer display name.
        payer_email:
          type: string
          format: email
          description: Optional payer email.
    Payin:
      type: object
      properties:
        object:
          type: string
          enum:
            - payin
          description: Object type discriminator.
        id:
          type: string
          format: uuid
          description: Payin attempt id.
        stan:
          type: string
          description: System trace / reference.
        method:
          type: string
          description: Funding method.
        target_currency:
          type: string
          description: Book currency to credit.
        rail_currency:
          type: string
          description: Currency on the payment rail when different.
        amount:
          type: integer
          description: Requested amount in target (or primary) minor units.
        rail_amount:
          type: integer
          description: Amount on the rail in rail minor units.
        target_amount:
          type: integer
          description: Expected credit to the target book in minor units.
        scale:
          type: integer
          description: Decimal places for `target_currency`.
        status:
          type: string
          description: >-
            Lifecycle status (`pending`, `processing`, `completed`, `failed`,
            …).
        checkout_url:
          type: string
          format: uri
          description: Hosted checkout URL when the method requires a redirect.
        redirect_url:
          type: string
          format: uri
          description: Return URL you supplied.
        source_kind:
          type: string
          description: Origin kind from prepare.
        collection_mode:
          type: string
          description: Prepare mode (`bank_details`, `crypto_address`, …).
        network:
          type: string
          description: Crypto network when applicable.
        instructions:
          type: object
          additionalProperties: true
          description: |
            Receive instructions for the payer (account number, bank name,
            wallet address, etc.). Shape depends on `collection_mode`.
        failure_reason:
          type: string
          description: Failure message when status is failed.
        created_at:
          type: string
          format: date-time
          description: Creation time (UTC).
        updated_at:
          type: string
          format: date-time
          description: Last status change (UTC).
        completed_at:
          type: string
          format: date-time
          description: When the deposit completed, if successful.
        livemode:
          type: boolean
          description: '`true` when created with a live key.'
        environment:
          type: string
          enum:
            - live
            - sandbox
          description: Environment of the creating API key.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - code
            - message
          properties:
            type:
              type: string
              description: Broad error class for client handling.
              enum:
                - invalid_request
                - authentication_error
                - permission_error
                - rate_limit
                - api_error
            code:
              type: string
              description: Stable machine-readable code (e.g. `parameter_invalid`).
            message:
              type: string
              description: Human-readable explanation safe to show developers.
            param:
              type: string
              description: Request field that failed validation, when applicable.
            doc_url:
              type: string
              format: uri
              description: Optional link to docs for this error.
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              type: authentication_error
              code: invalid_api_key
              message: Invalid API key provided.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: |
        Secret API key from **Settings → Developers → API keys**.
        Example: `Authorization: Bearer sk_test_…`

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.