{"id":18383534,"url":"https://github.com/devscast/flexpay","last_synced_at":"2025-04-06T23:32:24.871Z","repository":{"id":238365898,"uuid":"796341904","full_name":"devscast/flexpay","owner":"devscast","description":"Flexpay provides a convenient way to handle payments using various mobile money platforms such as Airtel Money, Orange Money, Afrimoney, and M-Pesa. It works with , A mobile money payment aggregator in the Republic Democratic of Congo.","archived":false,"fork":false,"pushed_at":"2024-11-24T11:49:48.000Z","size":87,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-22T09:24:28.596Z","etag":null,"topics":["api","mobile-money","payment-gateway"],"latest_commit_sha":null,"homepage":"https://flexpaie.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devscast.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-05T16:54:53.000Z","updated_at":"2024-11-24T11:49:45.000Z","dependencies_parsed_at":"2024-10-18T19:18:24.813Z","dependency_job_id":"7d542b77-b8a7-49c9-a190-540ab9a509c4","html_url":"https://github.com/devscast/flexpay","commit_stats":null,"previous_names":["devscast/flexpay"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devscast%2Fflexpay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devscast%2Fflexpay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devscast%2Fflexpay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devscast%2Fflexpay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devscast","download_url":"https://codeload.github.com/devscast/flexpay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247569127,"owners_count":20959758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["api","mobile-money","payment-gateway"],"created_at":"2024-11-06T01:11:47.968Z","updated_at":"2025-04-06T23:32:23.320Z","avatar_url":"https://github.com/devscast.png","language":"PHP","readme":"# Flexpay PHP\n\n![Lint](https://github.com/devscast/flexpay/actions/workflows/lint.yaml/badge.svg)\n![Test](https://github.com/devscast/flexpay/actions/workflows/test.yaml/badge.svg)\n[![Latest Stable Version](https://poser.pugx.org/devscast/flexpay/version)](https://packagist.org/packages/devscast/flexpay)\n[![Total Downloads](https://poser.pugx.org/devscast/flexpay/downloads)](https://packagist.org/packages/devscast/flexpay)\n[![License](https://poser.pugx.org/devscast/flexpay/license)](https://packagist.org/packages/devscast/flexpay)\n\nFor privacy reasons, Flexpay original documentation cannot be shared without written permission, for more information about credentials\nand implementation details, please reach them at flexpay.cd\n\n## Installation\nYou can use the PHP client by installing the Composer package and adding it to your application’s dependencies:\n\n```bash\ncomposer require devscast/flexpay\n```\n## Usage \n\n### Authentication\n* **Step 1**. Contact Flexpay to get a Merchant Account\nYou will receive a Merchant Form to complete in order to provide your business details and preferred Cash out Wallet or Banking Details.\n* **Step 2**. Once the paperwork is completed, you will be issued with Live and Sandbox Accounts (Merchant Code and Authorization token)\n\nThen use these credentials to authenticate your client\n\n```php\nuse Devscast\\Flexpay\\Client as Flexpay;\nuse Devscast\\Flexpay\\Credential;\nuse Devscast\\Flexpay\\Environment;\n\n$flexpay = new Flexpay(\n    new Credential('token', 'merchant_code'),\n    Environment::SANDBOX // use Environment::LIVE for production\n);\n```\n\n### Create a Payment Request\n\n```php\nuse Devscast\\Flexpay\\Data\\Currency;\nuse Devscast\\Flexpay\\Request\\CardRequest;\nuse Devscast\\Flexpay\\Request\\MobileRequest;\n\n$mobile = new MobileRequest(\n    amount: 10, // 10 USD\n    currency: Currency::USD,\n    phone: \"243999999999\",\n    reference: \"your_unique_transaction_reference\",\n    description: \"your_transaction_description\",\n    callbackUrl: \"your_website_webhook_url\",\n);\n\n$card = new CardRequest(\n    amount: 10, // 10 USD\n    currency: Currency::USD,\n    reference: \"your_unique_transaction_reference\",\n    description: \"your_transaction_description\",\n    callbackUrl: \"your_website_webhook_url\",\n    homeUrl: \"your_website_home_url\",\n)\n```\n\n\u003e **Note**: we highly recommend your `callbacks` urls to be unique for each transaction. \n\n### Mobile Payment\nOnce called, Flexpay will send a payment request to the user's mobile money account, and the user will have to confirm the payment on their phone.\nafter that the payment will be processed and the callback url will be called with the transaction details.\n\n```php\n$response = $flexpay-\u003epay($mobile);\n```\n\n### Virtual POS Payment\nYou can set up card payment via VPOS features, which is typically used for online payments.\nit's a gateway that allows you to accept payments from your customers using their credit cards.\n\n```php\n$response = $flexpay-\u003epay($card);\n// redirect to $response-\u003eurl to complete the payment\n```\n\n#### **handling callback (callbackUrl, approveUrl, cancelUrl, declineUrl)**\nFlexpay will send a POST request to the defined callbackUrl and the response will contain the transaction details.\nyou can use the following code to handle the callback by providing incoming data as array.\n\n```php\n$state = $flexpay-\u003ehandleCallback($_POST);\n$state-\u003eisSuccessful(); // true or false\n````\n\n### Check Transaction state\nYou don't trust webhook ? you can always check the transaction state by providing the order number.\n\n```php\n$state = $flexpay-\u003echeck($payment-\u003eorderNumber);\n$state-\u003eisSuccessful(); // true or false\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevscast%2Fflexpay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevscast%2Fflexpay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevscast%2Fflexpay/lists"}