Gathering detailed insights and metrics for @momofy/sdk
Gathering detailed insights and metrics for @momofy/sdk
Gathering detailed insights and metrics for @momofy/sdk
Gathering detailed insights and metrics for @momofy/sdk
npm install @momofy/sdk
Typescript
Module System
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
3 Stars
21 Commits
1 Forks
1 Branches
1 Contributors
Updated on Apr 01, 2024
Latest Version
1.1.0
Package Id
@momofy/sdk@1.1.0
Unpacked Size
35.73 kB
Size
7.26 kB
File Count
26
Published on
Mar 01, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
3
Officially supported momofy package for node Js applications.
Some useful resources
Visit the Documentation
Goto the Dashboard
To install this package run
1 npm install @momofy/sdk
1 yarn add @momofy/sdk
To be able to perform transactions using this SDK you need to get your API Secret Key from your Momofy Dashboard.
eg. secret_test_01HPH70VG02DAYJ1N70NP4QWKV
Example | Description | |
---|---|---|
Test | secret_test_01HPH70VG02DAYJ1N70NP4QWKV | Use test enviroment during project development |
Production | secret_prod_01HPH70VG02DAYJ1N70NP4QWKV | Use production enviroment for live application |
Request a checkout url to received payment from customers
1import { Momofy } from "@momofy/sdk" 2 3const momofy = new Momofy("secret_test_01HPH70VG02DAYJ1N70NP4QWKV"); 4 5let response = await momofy.transaction.checkout({ 6 amount: 30, 7 redirectUrl: "https://example.com/verify-transaction", 8 referenceCode: "", 9 transactionNote: "Payment of bills", 10 }); 11
1 { 2 success: true, 3 message: 'Checkout created successful', 4 result: { 5 transaction_ref: '00d67012-90b9-45c1-be9f-06ec8d813ddb', 6 checkout_url: 'https://app.momofy.com/checkout/c4e1a0e0-80bd-4925-b7bd-c36e48979f13' 7 }, 8 meta: {} 9 } 10
Params | Example values | Description |
---|---|---|
amount | 20 or "30" | Amount to be requested from customer |
redirectUrl | https://example.com/verify-transaction | A url to be redirected to after successful / failed transaction |
reference_code | unique uuidv4 string | Reference code ( will be auto generated when not provided ) |
transaction_note | Message for transaction | Note to display to user when requesting for payment. |
Request payment from your customers
1import { Momofy } from "@momofy/sdk"
2
3const momofy = new Momofy("secret_test_01HPH70VG02DAYJ1N70NP4QWKV");
4
5let response = await momofy.transaction.requestPayment({
6 amount: 30,
7 channel: "mobile_money",
8 currency: "GHS",
9 customer: {
10 email: "example@gmail.com",
11 name: "Test User",
12 phone_number: "024777777",
13 },
14 provider: "MTN",
15 reference_code: "",
16 transaction_note: "Payment for DSTV Bill",
17 });
18
1 { 2 success: true, 3 message: 'Transaction has been initiated', 4 result: { reference_code: 'dee67adb-bcfc-416b-b08b-b7dbb211a210' }, 5 meta: {} 6 } 7
Params | Example values | Description |
---|---|---|
amount | 20 or "30" | Amount to be requested from customer |
channel | mobile_money | Only mobile money channel is currently being supported |
currency | GHS | The supported currency from the provider |
customer | Customer Object | The customer information |
provider | MTN or VODAFONE | Network Provider code ( get this from the docs ) |
reference_code | unique uuidv4 string | Reference code ( will be auto generated when not provided ) |
transaction_note | Message for transaction | Note to display to user when requesting for payment. |
Params | Required | Description |
---|---|---|
name | Yes | Name of the customer |
phone_number | Yes | Momo number of customer to be charged. |
email | Yes | Email of the customer (if not available provide organisation email) |
Verify your transaction by providing the transaction ref ID.
1import { Momofy } from "@momofy/sdk" 2 3const momofy = new Momofy("secret_test_01HPH70VG02DAYJ1N70NP4QWKV"); 4 5let response = await momofy.transaction.verify("dee67adb-bcfc-416b-b08b-b7dbb211a210");
1{ 2 success: true, 3 message: 'Transaction retrieved', 4 result: { 5 id: 17, 6 channel: 'mobile_money', 7 message: 'Payment for DSTV Bill', 8 currency: 'GHS', 9 payment_phone: '024777777', 10 reference_code: 'a8735819-dbdd-4bf8-a075-8236660ba9d7', 11 gateway_status: 'waiting', 12 meta_data: null, 13 amount: 30, 14 status: 'initiated', 15 environment: 'test', 16 }, 17 meta: {} 18} 19
Status | Description |
---|---|
initiated | Transaction has been initiated |
pending | Transaction has been successfully sent to the provider |
success | Transaction was process successfully |
failed | Transaction has failed means (may be the user declined the payment request or something bad has happened ) |
If you have any feedback, please feel free to submit an issue.
No vulnerabilities found.
No security vulnerabilities found.