{"id":42194535,"url":"https://github.com/escarter/openapimomo","last_synced_at":"2026-01-27T00:01:30.645Z","repository":{"id":56979174,"uuid":"232140659","full_name":"Escarter/openapimomo","owner":"Escarter","description":"Laravel package for  MTN MoMo Open API","archived":false,"fork":false,"pushed_at":"2024-10-17T20:26:15.000Z","size":37,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-02T21:12:49.495Z","etag":null,"topics":["disbursement-api","laravel","momoapi","mtnopenapi","openapi","php","remittance","requesttopay","transaction","transaction-status"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Escarter.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-06T16:29:29.000Z","updated_at":"2024-10-22T11:00:23.000Z","dependencies_parsed_at":"2022-08-21T11:50:31.092Z","dependency_job_id":null,"html_url":"https://github.com/Escarter/openapimomo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Escarter/openapimomo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Escarter%2Fopenapimomo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Escarter%2Fopenapimomo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Escarter%2Fopenapimomo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Escarter%2Fopenapimomo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Escarter","download_url":"https://codeload.github.com/Escarter/openapimomo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Escarter%2Fopenapimomo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28792638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["disbursement-api","laravel","momoapi","mtnopenapi","openapi","php","remittance","requesttopay","transaction","transaction-status"],"created_at":"2026-01-27T00:01:15.097Z","updated_at":"2026-01-27T00:01:30.628Z","avatar_url":"https://github.com/Escarter.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"### OpenapiMoMo Documentation\nThis is a laravel package that helps you easily use the [MTN OpenAPI](https://momodeveloper.mtn.com) in your laravel project.\nThis package simplifies the integration of this API by providing simple methods which you can use when calling the different endpoints provided by this API. \nThis package contains a configuration file that helps you easily manage your settings in a single location and permits you to swap between environments with a single value change.  \n\n#### How to install?\nYou can install this package to your laravel application using composer as below\n\n```php\ncomposer require escarter/openapimomo \n```\n\nAfter installation is complete, you will have to publish the configuration file by running the command below\n\n```php\nphp artisan vendor:publish --provider=\"Escarter\\Openapimomo\\OpenapiMoMoServiceProvider\"\n```\nThis will move the **openapimomo.php** configuration file to your config folder. Open this file and update as required.\n\nBefore you start using this package, you need to update the configuration file appropriately.\n##### General configuration\n\n```php\n  /*\n    |--------------------------------------------------------------------------\n    | General configuration\n    |--------------------------------------------------------------------------\n    | This section contains general configurations parameters\n    |\n    |   environment           - specifies the api environment. -- takes 'sandbox','mtncameroon'\n    |   currency              - specifies the currency you are using. -- takes 'XAF','EUR','UGX'\n    |   party_id_type         - specifies the party id type. -- takes 'MSISDN'\n    |   transaction_id        - specifies the transaction id. \n    | \n    */\n\n    'environment' =\u003e 'sandbox',\n    'currency' =\u003e 'EUR',\n    'party_id_type' =\u003e 'MSISDN',\n    'transaction_id' =\u003e Illuminate\\Support\\Str::uuid(), \n\n```\n\n##### Collection API configuration\nThis section contains configurations for the collection API. Ensure to replace the keys with their appropriate values\n\n```php\n    /*\n    |--------------------------------------------------------------------------\n    |                        COLLECTION API SECTION\n    |--------------------------------------------------------------------------\n    */\n\n    /*\n    |--------------------------------------------------------------------------\n    | collection api user and key for sandbox and production environment\n    |--------------------------------------------------------------------------\n    | This section contains configuration parameters for collection api\n    |\n    |   collection_user_id              - collection user for production environment\n    |   collection_api_key              - collection api key for production environemt\n    |   sandbox_collection_user_id      - collection user for sandbox \n    |   sandbox_collection_api_key      - collection api key for sandbox \n    */\n\n    'collection_user_id' =\u003e 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', //change this to your production collection user -- required\n    'collection_api_key' =\u003e 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', //change this to your production collection api key -- required\n\n    'sandbox_collection_user_id' =\u003e 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', //change this to your sandbox collection user -- required\n    'sandbox_collection_api_key'=\u003e 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', //change this to your sandbox collection api key -- required\n\n    /*\n    |--------------------------------------------------------------------------\n    | collection api token and ocp_apim_subscription_key for sandbox and production \n    |--------------------------------------------------------------------------\n    | This section contains configuration parameters for collection api\n    |\n    |   collection_ocp_apim_sub_key         - collection ocp_apim_subscription_key for production environment\n    |   collection_token_url                - collection token url for production environemt\n    |   sandbox_collection_ocp_apim_sub_key - collection ocp_apim_subscription_key for sandbox \n    |   sandbox_collection_token_url        - collection token url for sandbox \n    */\n\n    'collection_ocp_apim_sub_key'=\u003e 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', //change this to your collection Ocp-Apim-Subscription-Key -- required\n    'collection_token_url'=\u003e 'https://ericssonbasicapi1.azure-api.net/collection/token/',\n    \n    'sandbox_collection_ocp_apim_sub_key'=\u003e'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', //change this to your collection  Ocp-Apim-Subscription-Key -- required \n    'sandbox_collection_token_url'=\u003e'https://sandbox.momodeveloper.mtn.com/collection/token/',\n\n    \n    /*\n    |--------------------------------------------------------------------------\n    | collection api requesttopay endpoint configuration \n    |--------------------------------------------------------------------------\n    | This section contains configuration parameters for collection api\n    |\n    |   collection_transaction_url          - collection requesttopay endpoint for production environment\n    |   collection_call_back_url            - collection requesttopay call_back_url for production environemt\n    |   sandbox_collection_transaction_url  - collection requesttopay endpoint for sandbox \n    |   sandbox_collection_call_back_url    - collection requesttopay call_back_url for sandbox \n    */\n \n    'collection_transaction_url'=\u003e 'https://ericssonbasicapi1.azure-api.net/collection/v1_0/requesttopay',\n    'collection_call_back_url'=\u003e'', // change this to your collection production call back url -- required\n\n    'sandbox_collection_transaction_url' =\u003e'https://sandbox.momodeveloper.mtn.com/collection/v1_0/requesttopay',\n    'sandbox_collection_call_back_url'=\u003e'', // change this to your collection sandbox call back url \n \n\n```\nThe other parts of the collection section stays untouched, only the section shown above should be updated. Same goes for the Disbursement and Remittance sections in the configuration file.\n\n##### Disbursement API configuration\nThis section contains configurations for the disburement API. Ensure to replace the keys with their appropriate values\n\n```php\n    /*\n    |--------------------------------------------------------------------------\n    |                        DISBURSEMENT API SECTION\n    |--------------------------------------------------------------------------\n    */\n\n    /*\n    |--------------------------------------------------------------------------\n    | disbursement api user and key for sandbox and production environment\n    |--------------------------------------------------------------------------\n    | This section contains configuration parameters for disbursement api\n    |\n    |   disbursement_user_id              - disbursement user for production environment\n    |   disbursement_api_key              - disbursement api key for production environemt\n    |   sandbox_disbursement_user_id      - disbursement user for sandbox \n    |   sandbox_disbursement_api_key      - disbursement api key for sandbox \n    */\n\n    'disbursement_user_id' =\u003e 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', //change this to your disbursement user -- required\n    'disbursement_api_key' =\u003e 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', //change this to your disbursement api key -- required\n\n    'sandbox_disbursement_user_id' =\u003e 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', //change this to your sandbox  disbursement user -- required\n    'sandbox_disbursement_api_key'=\u003e 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', //change this to your sandbox disbursement api key -- required\n\n    /*\n    |--------------------------------------------------------------------------\n    | disbursement api token and ocp_apim_subscription_key for sandbox and production \n    |--------------------------------------------------------------------------\n    | This section contains configuration parameters for disbursement api\n    |\n    |   disbursement_ocp_apim_sub_key         - disbursement ocp_apim_subscription_key for production environment\n    |   disbursement_token_url                - disbursement token url for production environemt\n    |   sandbox_disbursement_ocp_apim_sub_key - disbursement ocp_apim_subscription_key for sandbox \n    |   sandbox_disbursement_token_url        - disbursement token url for sandbox \n    */\n\n    'disbursement_ocp_apim_sub_key'=\u003e 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', //change this to your disbursement Ocp-Apim-Subscription-Key  -- required\n    'disbursement_token_url'=\u003e 'https://ericssonbasicapi1.azure-api.net/disbursement/token/',\n\n    'sandbox_disbursement_ocp_apim_sub_key'=\u003e 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', //change this to your disbursement Ocp-Apim-Subscription-Key -- required\n    'sandbox_disbursement_token_url'=\u003e 'https://sandbox.momodeveloper.mtn.com/disbursement/token/',\n\n    /*\n    |--------------------------------------------------------------------------\n    | disbursement api transfer endpoint configuration \n    |--------------------------------------------------------------------------\n    | This section contains configuration parameters for disbursement api\n    |\n    |   disbursement_transaction_url          - disbursement transfer endpoint for production environment\n    |   disbursement_call_back_url            - disbursement transfer call_back_url for production environemt\n    |   sandbox_disbursement_transaction_url  - disbursement transfer endpoint for sandbox \n    |   sandbox_disbursement_call_back_url    - disbursement transfer call_back_url for sandbox \n    */\n\n    'disbursement_transaction_url'=\u003e 'https://ericssonbasicapi1.azure-api.net/disbursement/v1_0/transfer',\n    'disbursement_call_back_url'=\u003e'', // change this to your disbursement production call back url -- required\n\n    'sandbox_disbursement_transaction_url' =\u003e'https://sandbox.momodeveloper.mtn.com/disbursement/v1_0/transfer',\n    'sandbox_disbursement_call_back_url'=\u003e'', // change this to your disbursement sandbox call back url \n\n\n```\nThe Remittance section is similar, so will leave it out from the documentation.\n\n**Note:**\n- Collection API user and Collection API key are different from disbursement and remittance. Each API has it's user and key\n- You can generate sandbox user for these APIs here [Sandbox user provisioning](https://momodeveloper.mtn.com/docs/services/sandbox-provisioning-api/operations/post-v1_0-apiuser) \n- Here is a video showing you how you can provision a sandbox user and api key for each of the APIs how to generate sandbox users and api keys\n  - [Generate a sandbox collection api user and key](https://youtu.be/sUbMLfel3AM)\n  - [Generate a sandbox disbursement api user and key](https://youtu.be/1VYo45V6xaI)\n  - [Generate a sandbox remittance api user and key](https://youtu.be/4B_Z6U29Lgo)\n\n#### How to use this package ?\nBelow are sample codes showing how you can use this package.\n\n##### 1. sample requesttopay and get transaction status (Collection API)\nOnce all your configurations are done, you can peform a requesttopay using the get transaction status method to check the transaction as show below.\nEnsure that you have a correct collection \n- API user\n- API key\n- Ocp-Apim-Subscription-Key \n\nproperly set in the config file\n\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse Escarter\\Openapimomo\\OpenapiMoMo;\n\n\nclass ProcessPaymentController extends Controller\n{\n    public function handlePayment(Request $request){\n        .....\n\n        $momoapi = new OpenapiMoMo();\n\n        $trans_id = $momoapi-\u003erequestPayment('354660098865', '1', 'payer_message', 'payee_notes');\n\n        $init_trans_status = $momoapi-\u003egetCollectionTransactionStatus($trans_id);\n\n        $current_trans_status = $init_trans_status['status'];\n\n        /** Note: when a request is made to the requesttopay endpoint its default status on success is 'PENDING' (waiting for user confirmation)\n         * so you might want to write some logic that waits for user's confirmation before you proceed or peform this in the background depending on your application logic.\n         * below is the sample code i use since i need to confirm payment before proceeding to next step in my application(this has it's drawbacks) :(\n         * \n         *    while($current_trans_status == 'PENDING'){\n         *          $init_trans_status = $momoapi-\u003egetCollectionTransactionStatus($trans_id);\n         *          $current_trans_status = $init_trans_status['status'];\n         *     }\n        */\n\n        if($current_trans_status == \"SUCCESSFUL\") {\n            // persist some data in your application \n            return 'to some view with success message!';\n        }else{\n            // persist some data in your application\n            return 'to some view with error message!';\n        }\n    }\n\n    }\n}\n\n```\n\n\n##### 2.  Check Collection account balance (Collection API)\n\nThe sample code below shows you how to get your collection account balance.\n\n```php\n\n$momoapi = new OpenapiMoMo();\n$coll_acc_balance = $momoapi-\u003egetCollectionAccountBalance();\ndd($coll_acc_balance);\n\n```\n##### 3. Sample transfer request (Disbursement API)\n\nBefore you can perform a transfer request, you should ensure that you have properly updated the disbursement section in the **openapimomo.php** configuration file with the correct\n- API user\n- API key\n- Ocp-Apim-Subscription-Key \n\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse Escarter\\Openapimomo\\OpenapiMoMo;\n\n\nclass ProcessPayoutController extends Controller\n{\n    public function handlePayout(Request $request){\n        .....\n\n        $momoapi = new OpenapiMoMo();\n\n        $trans_id = $momoapi-\u003edisbursementTransfer('354660098865', '1', 'payer_message', 'payee_notes');\n\n        $trans_status = $momoapi-\u003egetDisbursementTransactionStatus($trans_id);\n        \n        if($trans_status == \"SUCCESSFUL\") {\n            // persist some data in your application \n            return 'to some view with success message!';\n        }else{\n            // persist some data in your application\n            return 'to some view with error message!';\n        }\n    }\n\n    }\n}\n\n```\n##### 4.  Check Disbursement account balance (Disbursement API)\n\nThe sample code below shows you how to get your disburement account balance.\n\n```php\n\n$momoapi = new OpenapiMoMo();\n$disburs_acc_balance = $momoapi-\u003egetDisbursementAccountBalance();\ndd($disburs_acc_balance);\n\n```\n\nThanks. \n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fescarter%2Fopenapimomo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fescarter%2Fopenapimomo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fescarter%2Fopenapimomo/lists"}