{
  "openapi": "3.1.0",
  "info": {
    "title": "Hubtel Direct Receive Money API",
    "version": "1.0.0",
    "summary": "Charge a customer's mobile money wallet from your server. The customer approves on their phone.",
    "description": "Charge a customer's mobile money wallet from your server. The customer approves on their phone.\n\nThis reference describes the production **v1** API.",
    "x-hubtel-service": {
      "slug": "receive-money",
      "group": "Collections",
      "availability": [
        "business"
      ],
      "allowlist": true,
      "thirdParty": null
    },
    "x-hubtel-response-codes": [
      {
        "source": "business/api_documentation/payment_apis/3.direct_receive_money.md",
        "columns": [
          "Response Code",
          "Description",
          "Required Action"
        ],
        "rows": [
          [
            "0000",
            "The transaction has been processed successfully.",
            "None"
          ],
          [
            "0001",
            "Request has been accepted. A callback will be sent on final state",
            "None"
          ],
          [
            "2001",
            "The MTN Mobile Money user has reached counter or balance limits, has insufficient funds or is missing permissions. The Vodafone Cash failed You entered the wrong PIN. Please try again Dear Customer, you have insufficient funds. Avail. Balance:#### 5 successive invalid transfers will lock your account. Thank you. MTN Exception: Account Holder with FRI Not Found Transaction id is invalid",
            "Customer either entered no or invalid PIN ; Mobile network not able to parse your request ; USSD session timeout ; Having strange characters (&\\*!%@) in your description ; Ensure that the number provided matches the channel"
          ],
          [
            "4000",
            "Validation errors",
            "Validation errors. Something is not quite right with this request. Please check again."
          ],
          [
            "4070",
            "We're unable to complete this payment at the moment. Please try again later. Fees not set for given conditions.",
            "Ensure you are passing the required minimum amount or contact your Hubtel relationship manager to setup fees for your account if error persists."
          ],
          [
            "4101",
            "The business you're trying to pay isn't fully set up to receive payments at the moment. Please try again later Supplied API keys does not have \\\"mobilemoney-receive-direct\\\" in scopes. Client request keys do not match API keys on business",
            "Contact your Retail Systems Engineer to enable Receive Money Scopes Ensure that you're providing the correct Basic Auth key for the Authorization header and ensure you’re passing your Collection Account Number in the endpoint."
          ],
          [
            "4103",
            "Permission denied. Sorry, your account is not allowed to transact on this channel",
            "Contact your Retail Systems Engineer"
          ]
        ]
      }
    ]
  },
  "servers": [
    {
      "url": "https://rmp.hubtel.com",
      "description": "Production"
    },
    {
      "url": "https://developers.hubtel.com/sandbox/v1/rmp",
      "description": "Hubtel Sandbox (test keys)"
    }
  ],
  "security": [
    {
      "basicAuth": []
    }
  ],
  "tags": [
    {
      "name": "Direct Receive Money",
      "description": "Charge a customer's mobile money wallet from your server. The customer approves on their phone."
    }
  ],
  "paths": {
    "/merchantaccount/merchants/{accountNumber}/receive/mobilemoney": {
      "post": {
        "operationId": "receiveMobileMoney",
        "summary": "Charge a mobile money wallet",
        "description": "Sends a payment prompt to the customer's phone. The response is `0001` (pending) while the customer decides. The final result is POSTed to `PrimaryCallbackUrl`, after the customer responds or the request expires. If no callback arrives within 5 minutes, call **Check a collection's status**. Prevent unsolicited prompts by charging only registered customers whose number cannot change at payment time, or verify unregistered numbers with an OTP first.",
        "tags": [
          "Direct Receive Money"
        ],
        "parameters": [
          {
            "name": "accountNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Your **collection account number** (POS sales), where customer payments land. Find it in your Hubtel merchant account under [Programmable keys → Account ID](/dashboard/account-ids). In the sandbox, use the collection account in Workbench."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "CustomerName": {
                    "type": "string",
                    "description": "The name on the customer’s mobile money wallet."
                  },
                  "CustomerMsisdn": {
                    "type": "string",
                    "description": "The customer’s mobile money number. This should be in the international format. E.g.: \"233249111411\""
                  },
                  "CustomerEmail": {
                    "type": "string",
                    "description": "Email of customer."
                  },
                  "Channel": {
                    "type": "string",
                    "description": "The mobile money channel provider. Available channels are: mtn-gh, vodafone-gh, tigo-gh."
                  },
                  "Amount": {
                    "type": "number",
                    "description": "The amount to debit, with at most 2 decimal places, for example 0.50."
                  },
                  "PrimaryCallbackUrl": {
                    "type": "string",
                    "description": "URL used to receive callback payload of Receive Money transactions from Hubtel."
                  },
                  "Description": {
                    "type": "string",
                    "description": "A brief description of the transaction."
                  },
                  "ClientReference": {
                    "type": "string",
                    "description": "The reference provided by the API user and must be unique for every transaction and preferably be alphanumeric characters. Maximum length is 36 characters."
                  }
                },
                "required": [
                  "CustomerMsisdn",
                  "Channel",
                  "Amount",
                  "PrimaryCallbackUrl",
                  "Description",
                  "ClientReference"
                ]
              },
              "example": {
                "CustomerName": "Joe Doe",
                "CustomerMsisdn": "233200000000",
                "CustomerEmail": "username@example.com",
                "Channel": "vodafone-gh",
                "Amount": 0.8,
                "PrimaryCallbackUrl": "https://webhook.site/b503d1a9-e726-f315254a6ede",
                "Description": "Union Dues",
                "ClientReference": "3jL2KlUy3vt21"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Business result in ResponseCode: `0001`, `2001`, `4000`, `4070`, `4101`, `4103`. See the response code table.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "Message": {
                      "type": "string",
                      "description": "The description of response received from the Receive Money API that is related to the ResponseCode."
                    },
                    "ResponseCode": {
                      "type": "string",
                      "description": "The unique response code on the status of the transaction."
                    },
                    "Data": {
                      "type": "object",
                      "properties": {
                        "TransactionId": {
                          "type": "string",
                          "description": "The unique ID used to identify a Hubtel transaction (from Hubtel)."
                        },
                        "Description": {
                          "type": "string",
                          "description": "The description initially provided by API user in the request payload."
                        },
                        "ClientReference": {
                          "type": "string",
                          "description": "The reference ID that is initially provided by the client/API user in the request payload (from merchant)."
                        },
                        "Amount": {
                          "type": "number",
                          "description": "The transaction amount."
                        },
                        "Charges": {
                          "type": "number",
                          "description": "The charge/fee for the transaction."
                        },
                        "AmountAfterCharges": {
                          "type": "number",
                          "description": "The transaction amount after charges/fees deduction."
                        },
                        "AmountCharged": {
                          "type": "number",
                          "description": "The amount debited from the customer’s mobile money wallet."
                        },
                        "DeliveryFee": {
                          "type": "number",
                          "description": "The delivery fee of the transaction is normally zero (0.0)."
                        }
                      },
                      "description": "An object containing the required data response from the API."
                    },
                    "ExternalTransactionId": {
                      "type": "string",
                      "description": "The transaction reference from the mobile money provider (from Telco)."
                    },
                    "OrderID": {
                      "type": "string",
                      "description": "The unique ID used to identify a transaction order."
                    }
                  }
                },
                "examples": {
                  "example1": {
                    "summary": "SAMPLE RESPONSE",
                    "value": {
                      "Message": "Transaction pending. Expect callback request for final state",
                      "ResponseCode": "0001",
                      "Data": {
                        "TransactionId": "09f84e20a283942e807128e8c21d08d6",
                        "Description": "Union Dues",
                        "ClientReference": "3jL2KlUy3vt21",
                        "Amount": 0.8,
                        "Charges": 0.05,
                        "AmountAfterCharges": 0.8,
                        "AmountCharged": 0.85,
                        "DeliveryFee": 0
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        },
        "callbacks": {
          "finalStatus": {
            "{$request.body#/PrimaryCallbackUrl}": {
              "post": {
                "summary": "Final status callback",
                "description": "Hubtel sends the final result to this URL in a POST request. Callbacks aren't signed: accept them only from Hubtel's callback address and confirm with a status check. See /docs/callbacks.",
                "requestBody": {
                  "content": {
                    "application/json": {
                      "schema": {
                        "type": "object",
                        "properties": {
                          "ResponseCode": {
                            "type": "string"
                          },
                          "Message": {
                            "type": "string"
                          },
                          "Data": {
                            "type": "object",
                            "properties": {
                              "Amount": {
                                "type": "number"
                              },
                              "Charges": {
                                "type": "number"
                              },
                              "AmountAfterCharges": {
                                "type": "number"
                              },
                              "Description": {
                                "type": "string"
                              },
                              "ClientReference": {
                                "type": "string"
                              },
                              "TransactionId": {
                                "type": "string"
                              },
                              "ExternalTransactionId": {
                                "type": "string"
                              },
                              "AmountCharged": {
                                "type": "number"
                              },
                              "OrderId": {
                                "type": "string"
                              },
                              "PaymentDate": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          }
                        }
                      },
                      "examples": {
                        "successful": {
                          "summary": "SAMPLE CALLBACK (Successful)",
                          "value": {
                            "ResponseCode": "0000",
                            "Message": "success",
                            "Data": {
                              "Amount": 0.8,
                              "Charges": 0.05,
                              "AmountAfterCharges": 0.8,
                              "Description": " The Vodafone Cash payment has been approved and processed successfully",
                              "ClientReference": "3jL2KlUy3vt21",
                              "TransactionId": "09f84e20a283942e807128e8c21d08d6",
                              "ExternalTransactionId": "2116938399",
                              "AmountCharged": 0.85,
                              "OrderId": "09f84e20a283942e807128e8c21d08d6",
                              "PaymentDate": "2024-05-14T00:44:57.5142719Z"
                            }
                          }
                        },
                        "failed": {
                          "summary": "SAMPLE CALLBACK (Failed)",
                          "value": {
                            "ResponseCode": "2001",
                            "Message": "failed",
                            "Data": {
                              "Amount": 0.8,
                              "Charges": 0.05,
                              "AmountAfterCharges": 0.8,
                              "Description": "FAILED",
                              "ClientReference": "3jL2KlUy3vt21",
                              "TransactionId": "09f84e20a283942e807128e8c21d08d6",
                              "ExternalTransactionId": "2116938399",
                              "AmountCharged": 0.85,
                              "OrderId": "09f84e20a283942e807128e8c21d08d6",
                              "PaymentDate": "2024-05-14T00:44:57.5142719Z"
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "responses": {
                  "200": {
                    "description": "Acknowledged."
                  }
                }
              }
            }
          }
        },
        "servers": [
          {
            "url": "https://rmp.hubtel.com",
            "description": "Production"
          },
          {
            "url": "https://developers.hubtel.com/sandbox/v1/rmp",
            "description": "Hubtel Sandbox (test keys)"
          }
        ],
        "x-hubtel": {
          "host": "rmp.hubtel.com",
          "alias": "rmp",
          "service": "receive-money",
          "review": "curated",
          "simulated": true,
          "allowlist": true,
          "responseCodes": [
            "0001",
            "2001",
            "4000",
            "4070",
            "4101",
            "4103"
          ],
          "idempotency": "ClientReference must be unique per transaction (maximum 36 characters) and never reused.",
          "legacySources": [
            "business/api_documentation/payment_apis/3.direct_receive_money.md",
            "business/api_documentation/payment_apis/6.direct_debit_money.md",
            "business/api_documentation/lending_apis/6.direct_debit_money.md",
            "business/api_documentation/lending_apis/7.direct_receive_money.md"
          ]
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic",
        "description": "Base64 of `API ID:API Key`."
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Missing or invalid credentials.",
        "content": {
          "application/json": {
            "example": {
              "Message": "Client request keys do not match API keys on business",
              "ResponseCode": "4101",
              "Data": ""
            }
          }
        }
      },
      "Forbidden": {
        "description": "The caller's IP is not allowlisted for this service (production may time out instead), or a sandbox key lacks the scope.",
        "content": {
          "application/json": {
            "example": {
              "ResponseCode": "4030",
              "Message": "Requests from <your-ip> are not allowed for this service. Add the IP in Workbench → IP allowlist.",
              "code": "ip_not_allowlisted",
              "your_ip": "<your-ip>"
            }
          }
        }
      }
    }
  }
}