---
openapi: 3.0.3
info:
  title: Saapay Business Merchant API
  version: 1.0.0
  description: |
    Merchant API for customers, KYC, quotes, payins, payouts, transfers, and webhooks.
    All merchant resources are scoped to the merchant attached to the API key.
  license:
    name: Proprietary
    url: https://business.saapay.cm
servers:
- url: https://api.business.saapay.cm
  description: Production
security:
- ApiKeyAuth: []
  ApiSecretAuth: []
tags:
- name: Customers
  description: Create and retrieve merchant-scoped customer records.
- name: Customer KYC
  description: Submit and retrieve customer identity document status.
- name: Quotes
  description: Create and retrieve pricing and routing quotes.
- name: Payins
  description: Create and retrieve payment collection resources.
- name: Payouts
  description: Create and retrieve disbursement resources.
- name: Transfers
  description: Create, retrieve, and relaunch two-leg transfer resources.
paths:
  "/customers":
    post:
      tags:
      - Customers
      summary: Create customer
      description: Create an individual, retail, or business customer.
      operationId: createCustomer
      parameters:
      - "$ref": "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/CreateCustomerRequest"
            examples:
              individual:
                value:
                  external_ref: your-internal-id-123
                  customer_type: individual
                  first_name: Awa
                  last_name: Ngu
                  id_number: ID123456
                  id_type: national_id
                  email: awa@example.com
                  phone: "+237670000000"
                  country_code: CM
                  nationality_code: CM
                  date_of_birth: '1990-05-15'
                  address_line1: 123 Main Street
                  city: Douala
                  occupation: Engineer
                  source_of_funds: salary
              business:
                value:
                  external_ref: biz-456
                  customer_type: business
                  business_name: Acme SARL
                  email: billing@acme.com
                  phone: "+237670000001"
                  country_code: CM
                  nationality_code: CM
                  address_line1: 45 Avenue Kennedy
                  city: Douala
      responses:
        '201':
          description: Customer created.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Customer"
        '400':
          "$ref": "#/components/responses/BadRequest"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '409':
          "$ref": "#/components/responses/Conflict"
  "/customers/{customer_id}":
    get:
      tags:
      - Customers
      summary: Get customer
      operationId: getCustomer
      parameters:
      - "$ref": "#/components/parameters/CustomerId"
      responses:
        '200':
          description: Customer object.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Customer"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '404':
          "$ref": "#/components/responses/NotFound"
  "/customers/{customer_id}/kyc":
    post:
      tags:
      - Customer KYC
      summary: Submit KYC documents
      description: Submit identity documents for a customer. Document file URLs must be public HTTP or HTTPS URLs that Saapay can fetch.
      operationId: submitCustomerKyc
      parameters:
      - "$ref": "#/components/parameters/CustomerId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/SubmitKycRequest"
            example:
              documents:
                - document_type: national_id
                  document_number: ID123456
                  issue_country_code: CM
                  issue_date: '2020-01-15'
                  expiry_date: '2030-01-15'
                  front_file_url: https://cdn.example.com/kyc/front.jpg
                  back_file_url: https://cdn.example.com/kyc/back.jpg
                  selfie_file_url: https://cdn.example.com/kyc/selfie.jpg
      responses:
        '201':
          description: KYC documents accepted.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/KycStatus"
        '400':
          "$ref": "#/components/responses/BadRequest"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '404':
          "$ref": "#/components/responses/NotFound"
    get:
      tags:
      - Customer KYC
      summary: Get customer KYC status
      operationId: getCustomerKyc
      parameters:
      - "$ref": "#/components/parameters/CustomerId"
      responses:
        '200':
          description: Customer KYC status and documents.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/KycStatus"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '404':
          "$ref": "#/components/responses/NotFound"
  "/quotes/payin":
    post:
      tags:
      - Quotes
      summary: Create payin quote
      description: Create a quote to collect money from a customer into the merchant wallet in XAF or XOF.
      operationId: createPayinQuote
      parameters:
      - "$ref": "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/CreatePayinQuoteRequest"
      responses:
        '201':
          description: Payin quote created.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Quote"
        '400':
          "$ref": "#/components/responses/BadRequest"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '409':
          "$ref": "#/components/responses/Conflict"
  "/quotes/payout":
    post:
      tags:
      - Quotes
      summary: Create payout quote
      description: Create a quote to send money from the merchant wallet in XAF or XOF to a recipient in local currency.
      operationId: createPayoutQuote
      parameters:
      - "$ref": "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/CreatePayoutQuoteRequest"
      responses:
        '201':
          description: Payout quote created.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Quote"
        '400':
          "$ref": "#/components/responses/BadRequest"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '409':
          "$ref": "#/components/responses/Conflict"
  "/quotes/transfer":
    post:
      tags:
      - Quotes
      summary: Create transfer quote
      description: Create a quote for a two-leg flow that collects from a payer and disburses to a recipient.
      operationId: createTransferQuote
      parameters:
      - "$ref": "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/CreateTransferQuoteRequest"
      responses:
        '201':
          description: Transfer quote created.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Quote"
        '400':
          "$ref": "#/components/responses/BadRequest"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '409':
          "$ref": "#/components/responses/Conflict"
  "/quotes/{quote_id}":
    get:
      tags:
      - Quotes
      summary: Get quote
      operationId: getQuote
      parameters:
      - "$ref": "#/components/parameters/QuoteId"
      responses:
        '200':
          description: Quote object.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Quote"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '404':
          "$ref": "#/components/responses/NotFound"
  "/payins":
    post:
      tags:
      - Payins
      summary: Create payin
      description: Create a quote-backed payin. The API returns pending and processes the provider submission asynchronously.
      operationId: createPayin
      parameters:
      - "$ref": "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/CreatePayinRequest"
      responses:
        '201':
          description: Payin created.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Payin"
        '400':
          "$ref": "#/components/responses/BadRequest"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '409':
          "$ref": "#/components/responses/Conflict"
  "/payins/{payin_id}":
    get:
      tags:
      - Payins
      summary: Get payin
      operationId: getPayin
      parameters:
      - "$ref": "#/components/parameters/PayinId"
      responses:
        '200':
          description: Payin object.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Payin"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '404':
          "$ref": "#/components/responses/NotFound"
  "/payouts":
    post:
      tags:
      - Payouts
      summary: Create payout
      description: Create a quote-backed payout. Payout processing is asynchronous.
      operationId: createPayout
      parameters:
      - "$ref": "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/CreatePayoutRequest"
      responses:
        '201':
          description: Payout created.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Payout"
        '400':
          "$ref": "#/components/responses/BadRequest"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '409':
          "$ref": "#/components/responses/Conflict"
  "/payouts/{payout_id}":
    get:
      tags:
      - Payouts
      summary: Get payout
      operationId: getPayout
      parameters:
      - "$ref": "#/components/parameters/PayoutId"
      responses:
        '200':
          description: Payout object.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Payout"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '404':
          "$ref": "#/components/responses/NotFound"
  "/transfers":
    post:
      tags:
      - Transfers
      summary: Create transfer
      description: Create a quote-backed transfer that collects from a payer and disburses to a recipient.
      operationId: createTransfer
      parameters:
      - "$ref": "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/CreateTransferRequest"
      responses:
        '201':
          description: Transfer created.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Transfer"
        '400':
          "$ref": "#/components/responses/BadRequest"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '409':
          "$ref": "#/components/responses/Conflict"
  "/transfers/{transfer_id}":
    get:
      tags:
      - Transfers
      summary: Get transfer
      operationId: getTransfer
      parameters:
      - "$ref": "#/components/parameters/TransferId"
      responses:
        '200':
          description: Transfer object.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Transfer"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '404':
          "$ref": "#/components/responses/NotFound"
  "/transfers/{transfer_id}/relaunch-payout":
    post:
      tags:
      - Transfers
      summary: Relaunch transfer payout
      description: Retry a failed disbursement leg without re-collecting from the payer.
      operationId: relaunchTransferPayout
      parameters:
      - "$ref": "#/components/parameters/TransferId"
      - "$ref": "#/components/parameters/IdempotencyKey"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/RelaunchPayoutRequest"
      responses:
        '202':
          description: Payout leg relaunched.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Transfer"
        '400':
          "$ref": "#/components/responses/BadRequest"
        '401':
          "$ref": "#/components/responses/Unauthorized"
        '404':
          "$ref": "#/components/responses/NotFound"
        '409':
          "$ref": "#/components/responses/Conflict"
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: Public API key from the merchant dashboard.
    ApiSecretAuth:
      type: apiKey
      in: header
      name: X-Api-Secret
      description: Secret shown once when the API key is created.
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      description: Unique key for this business intent. Reuse only when retrying the same request body.
      schema:
        type: string
      example: payin_2026_06_08_0001
    CustomerId:
      name: customer_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    QuoteId:
      name: quote_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    PayinId:
      name: payin_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    PayoutId:
      name: payout_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    TransferId:
      name: transfer_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
  responses:
    BadRequest:
      description: Invalid body, missing field, expired quote, quote mismatch, or insufficient balance.
      content:
        application/json:
          schema:
            "$ref": "#/components/schemas/ErrorResponse"
    Unauthorized:
      description: Missing, invalid, expired, or inactive API credentials.
      content:
        application/json:
          schema:
            "$ref": "#/components/schemas/ErrorResponse"
    NotFound:
      description: Resource not found for the authenticated merchant.
      content:
        application/json:
          schema:
            "$ref": "#/components/schemas/ErrorResponse"
    Conflict:
      description: Idempotency conflict or request with same key still processing.
      content:
        application/json:
          schema:
            "$ref": "#/components/schemas/ErrorResponse"
  schemas:
    ErrorResponse:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - code
          - message
          properties:
            code:
              type: string
              example: bad_request
            message:
              type: string
              example: quote_id is required
    CreateCustomerRequest:
      type: object
      properties:
        external_ref:
          type: string
          description: Merchant reference, unique per merchant.
        customer_type:
          type: string
          enum:
          - individual
          - retail
          - business
          default: individual
        first_name:
          type: string
        last_name:
          type: string
        business_name:
          type: string
        id_number:
          type: string
        id_type:
          type: string
          enum:
          - national_id
          - passport
          - driver_license
        email:
          type: string
          format: email
        phone:
          type: string
          example: "+237670000000"
        country_code:
          "$ref": "#/components/schemas/CountryCode"
        nationality_code:
          "$ref": "#/components/schemas/CountryCode"
        date_of_birth:
          type: string
          format: date
        address_line1:
          type: string
        city:
          type: string
        occupation:
          type: string
        source_of_funds:
          type: string
    Customer:
      allOf:
      - "$ref": "#/components/schemas/CreateCustomerRequest"
      - type: object
        required:
        - id
        - merchant_id
        - customer_type
        - kyc_status
        - status
        - created_at
        - updated_at
        properties:
          id:
            type: string
            format: uuid
          merchant_id:
            type: string
            format: uuid
          kyc_status:
            type: string
            enum:
            - not_started
            - pending
            - approved
            - rejected
          status:
            type: string
            example: active
          created_at:
            type: string
            format: date-time
          updated_at:
            type: string
            format: date-time
          _meta:
            "$ref": "#/components/schemas/IdempotencyMeta"
    SubmitKycRequest:
      type: object
      required:
      - documents
      properties:
        documents:
          type: array
          minItems: 1
          items:
            "$ref": "#/components/schemas/KycDocumentInput"
    KycDocumentInput:
      type: object
      required:
      - document_type
      properties:
        document_type:
          type: string
          example: national_id
        document_number:
          type: string
        issue_country_code:
          "$ref": "#/components/schemas/CountryCode"
        issue_date:
          type: string
          format: date
        expiry_date:
          type: string
          format: date
        front_file_url:
          type: string
          format: uri
        back_file_url:
          type: string
          format: uri
        selfie_file_url:
          type: string
          format: uri
    KycStatus:
      type: object
      required:
      - customer_id
      - kyc_status
      - documents
      properties:
        customer_id:
          type: string
          format: uuid
        kyc_status:
          type: string
          enum:
          - not_started
          - pending
          - approved
          - rejected
        documents:
          type: array
          items:
            allOf:
            - "$ref": "#/components/schemas/KycDocumentInput"
            - type: object
              properties:
                id:
                  type: string
                  format: uuid
                status:
                  type: string
                  example: uploaded
                created_at:
                  type: string
                  format: date-time
    CreatePayinQuoteRequest:
      type: object
      required:
      - country_code
      - operator_code
      - rail_type
      - send_amount
      - send_currency
      properties:
        customer_id:
          type: string
          format: uuid
        country_code:
          "$ref": "#/components/schemas/CountryCode"
        operator_code:
          type: string
          example: CM_MTN_MOMO
        rail_type:
          "$ref": "#/components/schemas/RailType"
        send_amount:
          "$ref": "#/components/schemas/DecimalString"
        send_currency:
          "$ref": "#/components/schemas/CurrencyCode"
      example:
        customer_id: 22222222-2222-2222-2222-222222222222
        country_code: CM
        operator_code: CM_MTN_MOMO
        rail_type: mobile_money
        send_amount: '10000'
        send_currency: XAF
    CreatePayoutQuoteRequest:
      allOf:
      - "$ref": "#/components/schemas/CreatePayinQuoteRequest"
      example:
        customer_id: 22222222-2222-2222-2222-222222222222
        country_code: CM
        operator_code: CM_MTN_MOMO
        rail_type: mobile_money
        send_amount: '15000'
        send_currency: XAF
    CreateTransferQuoteRequest:
      type: object
      required:
      - corridor_code
      - payer_operator_code
      - recipient_operator_code
      - payout_currency
      properties:
        customer_id:
          type: string
          format: uuid
        corridor_code:
          type: string
          example: CM-CI-XAF-XOF
        payer_operator_code:
          type: string
          example: CM_MTN_MOMO
        recipient_operator_code:
          type: string
          example: CI_ORANGE_MOMO
        payin_amount:
          "$ref": "#/components/schemas/DecimalString"
        payin_currency:
          "$ref": "#/components/schemas/CurrencyCode"
        payout_amount:
          "$ref": "#/components/schemas/DecimalString"
        payout_currency:
          "$ref": "#/components/schemas/CurrencyCode"
        send_amount:
          "$ref": "#/components/schemas/DecimalString"
        send_currency:
          "$ref": "#/components/schemas/CurrencyCode"
      example:
        customer_id: 22222222-2222-2222-2222-222222222222
        corridor_code: CM-CI-XAF-XOF
        payer_operator_code: CM_MTN_MOMO
        recipient_operator_code: CI_ORANGE_MOMO
        payin_amount: '100000'
        payin_currency: XAF
        payout_amount: '98500'
        payout_currency: XOF
        send_amount: '100000'
        send_currency: XAF
    Quote:
      type: object
      properties:
        id:
          type: string
          format: uuid
        customer_id:
          type: string
          format: uuid
        flow_type:
          type: string
          enum:
          - payin
          - payout
          - transfer
        status:
          type: string
          enum:
          - active
          - expired
          - consumed
        expires_at:
          type: string
          format: date-time
        send_amount:
          "$ref": "#/components/schemas/DecimalString"
        send_currency:
          "$ref": "#/components/schemas/CurrencyCode"
        receive_amount:
          "$ref": "#/components/schemas/DecimalString"
        receive_currency:
          "$ref": "#/components/schemas/CurrencyCode"
        country_code:
          "$ref": "#/components/schemas/CountryCode"
        operator_code:
          type: string
        rail_type:
          "$ref": "#/components/schemas/RailType"
        corridor_code:
          type: string
        corridor_type:
          type: string
        payer_operator_code:
          type: string
        recipient_operator_code:
          type: string
        total_fee:
          "$ref": "#/components/schemas/DecimalString"
        wallet_impact:
          type: object
          additionalProperties: true
        created_at:
          type: string
          format: date-time
        _meta:
          "$ref": "#/components/schemas/IdempotencyMeta"
    CreatePayinRequest:
      type: object
      required:
      - quote_id
      - customer_id
      - source
      properties:
        quote_id:
          type: string
          format: uuid
        customer_id:
          type: string
          format: uuid
        source:
          "$ref": "#/components/schemas/PayinSourceRequest"
      example:
        quote_id: 33333333-3333-3333-3333-333333333333
        customer_id: 22222222-2222-2222-2222-222222222222
        source:
          phone: "+237670000000"
    CreatePayoutRequest:
      type: object
      required:
      - quote_id
      - customer_id
      - recipient
      properties:
        quote_id:
          type: string
          format: uuid
        customer_id:
          type: string
          format: uuid
        payment_reason_code:
          type: string
          example: OTHER
        payment_reason_text:
          type: string
          example: Merchant payout
        recipient:
          "$ref": "#/components/schemas/PayoutRecipientRequest"
      example:
        quote_id: 33333333-3333-3333-3333-333333333333
        customer_id: 22222222-2222-2222-2222-222222222222
        payment_reason_code: OTHER
        payment_reason_text: Merchant payout
        recipient:
          recipient_type: individual
          first_name: Awa
          last_name: Ngu
          phone: "+237670000000"
          email: awa@example.com
          recipient_nationality_code: CM
    CreateTransferRequest:
      type: object
      required:
      - quote_id
      - customer_id
      - payer
      - recipient
      properties:
        quote_id:
          type: string
          format: uuid
        customer_id:
          type: string
          format: uuid
        payment_reason_code:
          type: string
          example: OTHER
        sender_source_of_funds:
          type: string
          example: salary
        sender_occupation:
          type: string
          example: Engineer
        payer:
          "$ref": "#/components/schemas/RailParty"
        recipient:
          "$ref": "#/components/schemas/Recipient"
      example:
        quote_id: 33333333-3333-3333-3333-333333333333
        customer_id: 22222222-2222-2222-2222-222222222222
        payment_reason_code: OTHER
        sender_source_of_funds: salary
        sender_occupation: Engineer
        payer:
          country_code: CM
          rail_type: mobile_money
          phone: "+237670000000"
          operator_code: CM_MTN_MOMO
        recipient:
          recipient_type: individual
          first_name: Mariam
          last_name: Traore
          country_code: CI
          rail_type: mobile_money
          phone: "+2250700112233"
          operator_code: CI_ORANGE_MOMO
          email: mariam.traore@example.com
          recipient_nationality_code: CI
          address_line1: Rue du Commerce
          city: Abidjan
    RelaunchPayoutRequest:
      type: object
      properties:
        payout_amount:
          "$ref": "#/components/schemas/DecimalString"
        recipient:
          "$ref": "#/components/schemas/Recipient"
      example:
        payout_amount: '98500'
        recipient:
          recipient_type: individual
          first_name: Mariam
          last_name: Traore
          country_code: CI
          rail_type: mobile_money
          phone: "+2250700112233"
          operator_code: CI_ORANGE_MOMO
          email: mariam.traore@example.com
          recipient_nationality_code: CI
          address_line1: Rue du Commerce
          city: Abidjan
    Payin:
      allOf:
      - "$ref": "#/components/schemas/PaymentBase"
      - type: object
        properties:
          status:
            type: string
            enum:
            - created
            - pending
            - completed
            - failed
          source:
            "$ref": "#/components/schemas/RailParty"
    Payout:
      allOf:
      - "$ref": "#/components/schemas/PaymentBase"
      - type: object
        properties:
          status:
            type: string
            enum:
            - created
            - pending
            - completed
            - failed
          recipient:
            "$ref": "#/components/schemas/Recipient"
    Transfer:
      type: object
      properties:
        id:
          type: string
          format: uuid
        merchant_id:
          type: string
          format: uuid
        customer_id:
          type: string
          format: uuid
        quote_id:
          type: string
          format: uuid
        status:
          type: string
          enum:
          - pending
          - collecting
          - disbursing
          - completed
          - failed
        payin_status:
          type: string
        payout_status:
          type: string
        send_amount:
          "$ref": "#/components/schemas/DecimalString"
        send_currency:
          "$ref": "#/components/schemas/CurrencyCode"
        receive_amount:
          "$ref": "#/components/schemas/DecimalString"
        receive_currency:
          "$ref": "#/components/schemas/CurrencyCode"
        payin_amount:
          "$ref": "#/components/schemas/DecimalString"
        payin_currency:
          "$ref": "#/components/schemas/CurrencyCode"
        payout_amount:
          "$ref": "#/components/schemas/DecimalString"
        payout_currency:
          "$ref": "#/components/schemas/CurrencyCode"
        corridor_code:
          type: string
        corridor_type:
          type: string
        execution:
          type: object
          additionalProperties: true
        payer:
          "$ref": "#/components/schemas/RailParty"
        recipient:
          "$ref": "#/components/schemas/Recipient"
        pricing:
          type: object
          additionalProperties: true
        history:
          type: array
          items:
            "$ref": "#/components/schemas/StatusHistory"
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    PaymentBase:
      type: object
      properties:
        id:
          type: string
          format: uuid
        merchant_id:
          type: string
          format: uuid
        customer_id:
          type: string
          format: uuid
        quote_id:
          type: string
          format: uuid
        send_amount:
          "$ref": "#/components/schemas/DecimalString"
        send_currency:
          "$ref": "#/components/schemas/CurrencyCode"
        receive_amount:
          "$ref": "#/components/schemas/DecimalString"
        receive_currency:
          "$ref": "#/components/schemas/CurrencyCode"
        country_code:
          "$ref": "#/components/schemas/CountryCode"
        rail_type:
          "$ref": "#/components/schemas/RailType"
        operator_code:
          type: string
        provider_reference:
          type: string
          nullable: true
        wallet_impact:
          type: object
          additionalProperties: true
        pricing:
          type: object
          additionalProperties: true
        history:
          type: array
          items:
            "$ref": "#/components/schemas/StatusHistory"
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    PayinSourceRequest:
      type: object
      description: |
        Payer details for a payin. Routing (country, rail and operator) is taken
        from the quote, so it is not repeated here. Send the fields for the
        quote's rail: `phone` for `mobile_money`, or the four bank fields for
        `bank_transfer`. Fields belonging to the other rail are rejected.
      properties:
        phone:
          type: string
          example: "+237670000000"
        bank_name:
          type: string
        bank_code:
          type: string
        account_name:
          type: string
        account_number:
          type: string
    PayoutRecipientRequest:
      type: object
      description: |
        Recipient details for a payout. Routing (country, rail and operator) is
        taken from the quote, so it is not repeated here. Send the fields for the
        quote's rail: `phone` for `mobile_money`, or the four bank fields for
        `bank_transfer`. Fields belonging to the other rail are rejected.
      required:
      - recipient_type
      properties:
        recipient_type:
          type: string
          enum:
          - individual
          - business
        first_name:
          type: string
        last_name:
          type: string
        business_name:
          type: string
        phone:
          type: string
          example: "+237670000000"
        email:
          type: string
          format: email
        recipient_nationality_code:
          "$ref": "#/components/schemas/CountryCode"
        bank_name:
          type: string
        bank_code:
          type: string
        account_name:
          type: string
        account_number:
          type: string
    RailParty:
      type: object
      required:
      - country_code
      - rail_type
      properties:
        country_code:
          "$ref": "#/components/schemas/CountryCode"
        rail_type:
          "$ref": "#/components/schemas/RailType"
        phone:
          type: string
          example: "+237670000000"
        operator_code:
          type: string
          example: CM_MTN_MOMO
        bank_name:
          type: string
        bank_code:
          type: string
        account_name:
          type: string
        account_number:
          type: string
    Recipient:
      allOf:
      - "$ref": "#/components/schemas/RailParty"
      - type: object
        required:
        - recipient_type
        properties:
          recipient_type:
            type: string
            enum:
            - individual
            - business
          first_name:
            type: string
          last_name:
            type: string
          business_name:
            type: string
          email:
            type: string
            format: email
          recipient_nationality_code:
            "$ref": "#/components/schemas/CountryCode"
          address_line1:
            type: string
          city:
            type: string
    StatusHistory:
      type: object
      properties:
        status:
          type: string
        reason:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
    IdempotencyMeta:
      type: object
      properties:
        idempotency_key:
          type: string
        idempotency_replayed:
          type: boolean
    CountryCode:
      type: string
      minLength: 2
      maxLength: 2
      example: CM
    CurrencyCode:
      type: string
      enum:
      - XAF
      - XOF
      example: XAF
      description: Supported currencies for payins, payouts, and transfers.
    DecimalString:
      type: string
      pattern: "^[0-9]+(\\.[0-9]+)?$"
      example: '10000'
    RailType:
      type: string
      enum:
      - mobile_money
      - bank_transfer
