{"id":30882321,"url":"https://github.com/devscast/flexpay-ts","last_synced_at":"2025-09-08T08:45:35.110Z","repository":{"id":312981307,"uuid":"1047550987","full_name":"devscast/flexpay-ts","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":"2025-09-03T06:32:01.000Z","size":102,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-03T08:15:18.037Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-30T17:10:01.000Z","updated_at":"2025-09-03T06:32:04.000Z","dependencies_parsed_at":"2025-09-03T08:15:25.514Z","dependency_job_id":"861b1210-2f94-4403-816a-21f55cb6a1e1","html_url":"https://github.com/devscast/flexpay-ts","commit_stats":null,"previous_names":["devscast/flexpay-ts"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/devscast/flexpay-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devscast%2Fflexpay-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devscast%2Fflexpay-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devscast%2Fflexpay-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devscast%2Fflexpay-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devscast","download_url":"https://codeload.github.com/devscast/flexpay-ts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devscast%2Fflexpay-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274159573,"owners_count":25232636,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-09-08T08:45:29.045Z","updated_at":"2025-09-08T08:45:35.046Z","avatar_url":"https://github.com/devscast.png","language":"TypeScript","readme":"# Flexpay Typescript\n\n![npm](https://img.shields.io/npm/v/@devscast/flexpay?style=flat-square)\n![npm](https://img.shields.io/npm/dt/@devscast/flexpay?style=flat-square)\n[![Lint](https://github.com/devscast/flexpay-ts/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/devscast/flexpay-ts/actions/workflows/lint.yml)\n[![Tests](https://github.com/devscast/flexpay-ts/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/devscast/flexpay-ts/actions/workflows/test.yml)\n![GitHub](https://img.shields.io/github/license/devscast/flexpay-ts?style=flat-square)\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 Typescript client by installing the npm package and adding it to your application’s dependencies:\n\n```bash\nnpm install @devscast/flexpay\n```\n## Usage\n\n### Authentication\n* **Step 1**. Contact Flexpay to get a Merchant Account\n  You 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```ts\nimport { Client as Flexpay } from \"@devscast/flexpay\";\n\nconst flexpay = new Flexpay(\"merchant_code\", \"token\", \"dev\") // use \"prod\" for production\n```\n\n### Create a Payment Request\n\n```typescript\nimport { CardRequest, MobileRequest } from \"@devscast/flexpay\";\n\nconst mobile = {\n    amount: 10, // 10 USD\n    currency: \"USD\",\n    phone: \"243999999999\",\n    reference: \"your_unique_transaction_reference\",\n    description: \"your_transaction_description\",\n    callbackUrl: \"your_website_webhook_url\",\n} as MobileRequest;\n\nconst card = {\n    amount: 10, // 10 USD\n    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} as CardRequest\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```typescript\nconst response = await  flexpay.pay(mobile);\n```\n\n### Visa Card 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```typescript\nconst response = await flexpay.pay(card);\n// redirect to response.url 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```typescript\nconst webhook = flexpay.handleCallback(req.body);\nflexpay.isSuccessful(webhook) // 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```typescript\nconst tx = flexpay.check(mobile.orderNumber);\nflexpay.isSuccessful(tx) // true or false\n```\n\n## Contributors\n\n\u003ca href=\"https://github.com/devscast/flexpay-tz/graphs/contributors\" title=\"show all contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=devscast/flexpay-ts\" alt=\"contributors\"/\u003e\n\u003c/a\u003e\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevscast%2Fflexpay-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevscast%2Fflexpay-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevscast%2Fflexpay-ts/lists"}