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

# Collect for a sub-merchant

> Aggregator accounts only. Collects for a sub-merchant linked to your account. The body is the same as [Create a payment](/api-reference/payments/create-a-payment), and the agreed fee always applies.

Guide: [collecting for a sub-merchant](/api-reference/payments-overview#collecting-for-a-sub-merchant-aggregators) and [payment errors](/api-reference/payments-overview#payment-errors).




## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/sub-merchants/{subMerchantCode}/payments/mobile-money
openapi: 3.1.0
info:
  title: PrimePay API
  version: '1.0'
  description: >-
    Collect mobile money payments, send transfers and make payouts with the
    PrimePay API.
servers:
  - url: https://api.primepay.mw
    description: Live API (live keys, `sk_live_…`)
  - url: https://sandbox-api.primepay.mw
    description: Sandbox API (test keys, `sk_test_…`)
security:
  - bearerAuth: []
tags:
  - name: Operators
  - name: Payments
  - name: Refunds
  - name: Transfers
  - name: Payouts
  - name: Payment links
  - name: Checkout sessions
paths:
  /v1/sub-merchants/{subMerchantCode}/payments/mobile-money:
    post:
      tags:
        - Payments
      summary: Collect for a sub-merchant
      description: >
        Aggregator accounts only. Collects for a sub-merchant linked to your
        account. The body is the same as [Create a
        payment](/api-reference/payments/create-a-payment), and the agreed fee
        always applies.


        Guide: [collecting for a
        sub-merchant](/api-reference/payments-overview#collecting-for-a-sub-merchant-aggregators)
        and [payment errors](/api-reference/payments-overview#payment-errors).
      operationId: createSubMerchantPayment
      parameters:
        - $ref: '#/components/parameters/SubMerchantCode'
        - $ref: '#/components/parameters/PaymentIdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentRequest'
      responses:
        '202':
          description: >-
            Accepted while the customer approves the payment. The response
            includes whose payment it is.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Payment'
              example:
                reference: TXN-K3P9Q2X7MZAB
                status: processing
                amount: 50000
                currency: MWK
                merchantOrderId: INV-2041
                failureCode: null
                createdAt: '2026-11-09T10:20:44Z'
                subMerchantAccountCode: '12345678'
                subMerchantName: Chikondi's Store
                aggregatorFee: 500
        '400':
          $ref: '#/components/responses/Error'
        '402':
          description: The operator refused the request straight away.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Payment'
        '403':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '409':
          $ref: '#/components/responses/Error'
components:
  parameters:
    SubMerchantCode:
      name: subMerchantCode
      in: path
      required: true
      schema:
        type: string
        pattern: ^[0-9]{8}$
        example: '12345678'
      description: The sub-merchant's 8-digit account code.
    PaymentIdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        type: string
        minLength: 8
        maxLength: 255
        example: 6f1c2b9e8a6d4c1f9b0e3a7d5c2f8e10
      description: >
        A new value for every new payment (a UUID is ideal), 8 to 255
        characters. If your request times out, send it again with the same key
        to get the first result back instead of a second payment. The same key
        with a different body is refused.
  schemas:
    PaymentRequest:
      type: object
      required:
        - amount
        - currency
        - customerPhone
        - provider
        - merchantOrderId
      properties:
        amount:
          type: number
          description: >-
            What your customer owes. Depending on your fee setting, the customer
            may pay PrimePay's fee on top.
          example: 25000
        currency:
          type: string
          enum:
            - MWK
        customerPhone:
          type: string
          description: >-
            International format, `+265` and 9 digits. Must belong to the
            operator.
          example: '+265991234567'
        provider:
          type: string
          description: >-
            An operator `refId` from [List mobile money
            operators](/api-reference/operators/list-mobile-money-operators).
          example: 7d51b653-3c6d-46eb-b3d9-7852dfee5b26
        merchantOrderId:
          type: string
          maxLength: 64
          description: >-
            Your order or invoice number (letters, digits, `- _ . /`). One
            active or paid payment per order.
          example: ORDER-5531
        description:
          type: string
          maxLength: 140
          example: 2 x School shoes
        email:
          type: string
          description: The customer's email, for receipts and your records.
          example: customer@example.com
        firstName:
          type: string
          example: Chikondi
        lastName:
          type: string
          example: Banda
        callbackUrl:
          type: string
          description: >-
            Sends this payment's webhooks here as well as to your endpoints.
            Must be HTTPS, on one of your webhook or allowed callback hosts.
            Required if you have no webhook endpoint.
          example: https://api.yourshop.mw/webhooks/primepay
        metadata:
          type: object
          additionalProperties:
            type: string
          description: Your own key/value pairs, echoed back in webhooks.
          example:
            cart: '88412'
    Payment:
      type: object
      properties:
        reference:
          type: string
          example: TXN-WRYF6S2W3DQW
        status:
          type: string
          enum:
            - pending
            - processing
            - success
            - failed
            - expired
            - cancelled
            - reversed
        amount:
          type: number
        fee:
          type: number
        currency:
          type: string
          example: MWK
        merchantOrderId:
          type: string
        failureCode:
          type:
            - string
            - 'null'
        createdAt:
          type: string
          format: date-time
        completedAt:
          type:
            - string
            - 'null'
          format: date-time
        subMerchantAccountCode:
          type:
            - string
            - 'null'
          description: Set when the payment was collected for a sub-merchant.
        subMerchantName:
          type:
            - string
            - 'null'
        aggregatorFee:
          type:
            - number
            - 'null'
          description: The fee you keep as the aggregator.
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: insufficient_funds
            message:
              type: string
              example: Not enough available balance for MWK 25,000.00.
            field:
              type: string
              description: >-
                Payment links only. The field that is missing or wrong, for
                example `items[1].unitAmount`.
  responses:
    Error:
      description: An error. Use `code` in your code; show `message` to people.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Your API key: `sk_live_…` / `sk_test_…` (secret), `pk_live_…` /
        `pk_test_…` (publishable, read-only reference data) or `rk_live_…` /
        `rk_test_…` (payments only).

````

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