M-Pesa (Safaricom Daraja) B2C API

The B2C API from M-Pesa (Safaricom Daraja) — 1 operation(s) for b2c.

OpenAPI Specification

mpesa-b2c-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: M-Pesa Daraja Account Balance B2C API
  description: 'Safaricom Daraja REST APIs for the M-Pesa mobile-money platform in Kenya: authorization, M-Pesa Express (STK Push), C2B, B2C, B2B, B2B Express Checkout, transaction status, account balance, reversal, dynamic QR, tax remittance and standing orders (M-Pesa Ratiba). Modeled from public Daraja documentation.'
  version: '1.0'
  termsOfService: https://developer.safaricom.co.ke/
  contact:
    name: Safaricom Daraja Support
    url: https://developer.safaricom.co.ke/
servers:
- url: https://api.safaricom.co.ke
  description: Production
- url: https://sandbox.safaricom.co.ke
  description: Sandbox
security:
- bearerAuth: []
tags:
- name: B2C
paths:
  /mpesa/b2c/v3/paymentrequest:
    post:
      operationId: b2cPaymentRequest
      tags:
      - B2C
      summary: Disburse funds from a business shortcode to a customer wallet.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/B2CRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncAckResponse'
components:
  schemas:
    AsyncAckResponse:
      type: object
      description: Synchronous acknowledgement; the real result is POSTed to ResultURL.
      properties:
        OriginatorConversationID:
          type: string
        ConversationID:
          type: string
        ResponseCode:
          type: string
        ResponseDescription:
          type: string
    B2CRequest:
      type: object
      required:
      - InitiatorName
      - SecurityCredential
      - CommandID
      - Amount
      - PartyA
      - PartyB
      - QueueTimeOutURL
      - ResultURL
      properties:
        OriginatorConversationID:
          type: string
        InitiatorName:
          type: string
        SecurityCredential:
          type: string
          description: Initiator password encrypted with the M-Pesa public X.509 certificate (RSA).
        CommandID:
          type: string
          enum:
          - SalaryPayment
          - BusinessPayment
          - PromotionPayment
        Amount:
          type: integer
        PartyA:
          type: string
          description: Business shortcode.
        PartyB:
          type: string
          description: Customer MSISDN.
        Remarks:
          type: string
        QueueTimeOutURL:
          type: string
          format: uri
        ResultURL:
          type: string
          format: uri
        Occasion:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: OAuth access token from /oauth/v1/generate
    basicAuth:
      type: http
      scheme: basic