{
  "openapi": "3.1.1",
  "info": {
    "title": "MobileMoney.Api | v1",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "http://footbridge-uat.masloc.gov.gh/mmapi/v1"
    }
  ],
  "paths": {
    "/accounts": {
      "get": {
        "tags": [
          "Accounts"
        ],
        "summary": "Retrieve an account",
        "description": "Retrieves the details of an account.",
        "operationId": "GetAccount",
        "parameters": [
          {
            "name": "msisdn",
            "in": "query",
            "description": "Mobile number in international format (e.g., 233501234567)",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "serviceProvider",
            "in": "query",
            "description": "Code to identity the mobile money service provider (e.g., Mtn, VfCash, AirtelTigo",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-client-id",
            "in": "header",
            "description": "Used to pass pre-shared client's identifier to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "description": "Used to pass pre-shared client's API key to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/deposits": {
      "post": {
        "tags": [
          "Disbursement"
        ],
        "summary": "Make a deposit",
        "description": "The Disbursement Mobile Money APIs allow organisations to disburse funds to mobile money recipients.",
        "parameters": [
          {
            "name": "x-client-id",
            "in": "header",
            "description": "Used to pass pre-shared client's identifier to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "description": "Used to pass pre-shared client's API key to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-callback-url",
            "in": "header",
            "description": "The URL supplied by the client that will be used to return the callback in the form of a HTTP PUT.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepositRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequestResponse"
                }
              }
            }
          }
        }
      }
    },
    "/withdrawal": {
      "post": {
        "tags": [
          "Withdrawal"
        ],
        "summary": "Withdraw cash",
        "description": "Also known as CashOut, is the process of withdrawing funds from a mobile money account.",
        "parameters": [
          {
            "name": "x-client-id",
            "in": "header",
            "description": "Used to pass pre-shared client's identifier to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "description": "Used to pass pre-shared client's API key to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-callback-url",
            "in": "header",
            "description": "The URL supplied by the client that will be used to return the callback in the form of a HTTP PUT.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequestResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/transfer": {
      "post": {
        "tags": [
          "Disbursement"
        ],
        "summary": "Transfer funds",
        "description": "Also known as P2P, transfer is the process of transferring funds from one mobile money account to another.",
        "parameters": [
          {
            "name": "x-client-id",
            "in": "header",
            "description": "Used to pass pre-shared client's identifier to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "description": "Used to pass pre-shared client's API key to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-callback-url",
            "in": "header",
            "description": "The URL supplied by the client that will be used to return the callback in the form of a HTTP PUT.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransferRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequestResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/payments": {
      "post": {
        "tags": [
          "Merchant Payment"
        ],
        "summary": "Request a payment",
        "description": "The Merchant Payment Mobile Money APIs allow merchants to accept payments from mobile money customers. Supported payment mechanisms include Payee-initiated merchant payment where the merchant initiates the payment and the payer is requested to authenticate to confirm acceptance by the mobile money",
        "parameters": [
          {
            "name": "x-client-id",
            "in": "header",
            "description": "Used to pass pre-shared client's identifier to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "description": "Used to pass pre-shared client's API key to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-callback-url",
            "in": "header",
            "description": "The URL supplied by the client that will be used to return the callback in the form of a HTTP PUT.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequestResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/payments/{transactionType}/{transactionReference}/status": {
      "get": {
        "tags": [
          "Status"
        ],
        "summary": "Get transaction status",
        "description": "Get the status of a successful transaction (i.e. Deposit, Withdrawal, Transfer, Payment, or Refund).",
        "operationId": "GetTransactionStatus",
        "parameters": [
          {
            "name": "transactionType",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transactionReference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-client-id",
            "in": "header",
            "description": "Used to pass pre-shared client's identifier to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "description": "Used to pass pre-shared client's API key to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/payments/{transactionType}/{originalTransactionReference}/refund": {
      "put": {
        "tags": [
          "Refunds"
        ],
        "summary": "Create a refund",
        "description": "Refund a successful transaction.",
        "parameters": [
          {
            "name": "transactionType",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "originalTransactionReference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-client-id",
            "in": "header",
            "description": "Used to pass pre-shared client's identifier to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "description": "Used to pass pre-shared client's API key to the server.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-callback-url",
            "in": "header",
            "description": "The URL supplied by the client that will be used to return the callback in the form of a HTTP PUT.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReverseTransactionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequestResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AccountResponse": {
        "type": "object",
        "properties": {
          "accountName": {
            "type": "string"
          },
          "accountNumberType": {
            "type": "string"
          },
          "accountNumber": {
            "type": "string"
          }
        }
      },
      "DepositRequest": {
        "type": "object",
        "properties": {
          "transactionReference": {
            "type": "string",
            "description": "A unique reference provided by the requesting organisation that is to be associated with the transaction."
          },
          "description": {
            "type": "string",
            "description": "Free format text description of the transaction provided by the client. This can be provided as a reference for the receiver on a notification SMS and on an account statement."
          },
          "debitParty": {
            "description": "A collection of key/value pairs that enable the party to be identified. Keys include MSISDN and Wallet Identifier.",
            "$ref": "#/components/schemas/Wallet"
          },
          "amount": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "description": "Transaction amount",
            "format": "double"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "HttpValidationProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": [
              "null",
              "string"
            ]
          },
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "detail": {
            "type": [
              "null",
              "string"
            ]
          },
          "instance": {
            "type": [
              "null",
              "string"
            ]
          },
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      },
      "PaymentRequest": {
        "type": "object",
        "properties": {
          "transactionReference": {
            "type": "string",
            "description": "A unique reference provided by the requesting organisation that is to be associated with the transaction."
          },
          "description": {
            "type": "string",
            "description": "Free format text description of the transaction provided by the client. This can be provided as a reference for the receiver on a notification SMS and on an account statement."
          },
          "debitParty": {
            "description": "A collection of key/value pairs that enable the party to be identified. Keys include MSISDN and Wallet Identifier.",
            "$ref": "#/components/schemas/Wallet"
          },
          "amount": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "description": "Transaction amount",
            "format": "double"
          }
        }
      },
      "PaymentRequestResponse": {
        "type": "object",
        "properties": {
          "transactionReference": {
            "type": "string",
            "description": "A unique reference provided by the requesting organisation that is to be associated with the transaction."
          },
          "transactionType": {
            "type": "string",
            "description": "Identifies the type of transaction created. Available values : billpay, deposit, disbursement, transfer, merchantpay, adjustment, reversal, withdrawal"
          },
          "description": {
            "type": [
              "null",
              "string"
            ],
            "description": "Free format text description of the transaction provided by the client. This can be provided as a reference for the receiver on a notification SMS and on an account statement."
          },
          "amount": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "description": "Transaction amount",
            "format": "double"
          },
          "wallet": {
            "description": "A collection of key/value pairs that enable the party to be identified. Keys include MSISDN and Wallet Identifier.",
            "$ref": "#/components/schemas/Wallet"
          },
          "status": {
            "type": "string",
            "description": "Status of the transaction e.g. [PENDING,SUCCESSFUL,FAILED]"
          },
          "statusMessage": {
            "type": [
              "null",
              "string"
            ],
            "description": "Description of status code"
          }
        },
        "description": "Represents a Transaction response"
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": [
              "null",
              "string"
            ]
          },
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "detail": {
            "type": [
              "null",
              "string"
            ]
          },
          "instance": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "ReverseTransactionRequest": {
        "type": "object",
        "properties": {
          "transactionReference": {
            "type": "string"
          },
          "amount": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "double"
          },
          "wallet": {
            "$ref": "#/components/schemas/Wallet"
          },
          "reason": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "TransactionStatusResponse": {
        "type": "object",
        "properties": {
          "transactionReference": {
            "type": "string",
            "description": "A unique reference provided by the requesting organisation that is to be associated with the transaction."
          },
          "transactionType": {
            "type": "string",
            "description": "Harmonised transaction type"
          },
          "description": {
            "type": "string",
            "description": "Free format text description of the transaction provided by the client. This can be provided as a reference for the receiver on a notification SMS and on an account statement."
          },
          "amount": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "description": "The transaction amount.",
            "format": "double"
          },
          "wallet": {
            "$ref": "#/components/schemas/Wallet"
          },
          "status": {
            "type": "string"
          },
          "statusMessage": {
            "type": [
              "null",
              "string"
            ],
            "description": "Indicates the status of the transaction as stored by the API provider."
          },
          "transactionId": {
            "type": "string",
            "description": "Unique reference for the transaction. This is returned in the response by API provider."
          }
        }
      },
      "TransferRequest": {
        "type": "object",
        "properties": {
          "transactionReference": {
            "type": "string",
            "description": "A unique reference provided by the requesting organisation that is to be associated with the transaction."
          },
          "description": {
            "type": "string",
            "description": "Free format text description of the transaction provided by the client. This can be provided as a reference for the receiver on a notification SMS and on an account statement."
          },
          "creditParty": {
            "description": "A collection of key/value pairs that enable the party to be identified. Keys include MSISDN and Wallet Identifier.",
            "$ref": "#/components/schemas/Wallet"
          },
          "amount": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "description": "Transaction amount",
            "format": "double"
          }
        }
      },
      "Wallet": {
        "type": "object",
        "properties": {
          "msisdn": {
            "type": "string",
            "description": "Mobile number in international format (e.g., 233501234567)"
          },
          "serviceProvider": {
            "type": "string",
            "description": "Code to identity the mobile money service provider (e.g., Mtn, VfCash, AirtelTigo"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Accounts"
    },
    {
      "name": "Disbursement"
    },
    {
      "name": "Withdrawal"
    },
    {
      "name": "Merchant Payment"
    },
    {
      "name": "Status"
    },
    {
      "name": "Refunds"
    }
  ]
}