{"_id":"@adsesugh/monnify-sdk","_rev":"33-bd32a069df97753e32fa4a5a0e81a27f","name":"@adsesugh/monnify-sdk","dist-tags":{"latest":"1.1.2"},"versions":{"1.0.0":{"name":"@adsesugh/monnify-sdk","version":"1.0.0","keywords":["Monnify","Payment","Gateway","Nodejs"],"author":{"name":"Sesugh Agbadu"},"license":"ISC","_id":"@adsesugh/monnify-sdk@1.0.0","maintainers":[{"name":"adsesugh","email":"sesughagbadu@yahoo.com"}],"dist":{"shasum":"b5946a0827e3d1043f1d4470935d037114cfbc9c","tarball":"https://registry.npmjs.org/@adsesugh/monnify-sdk/-/monnify-sdk-1.0.0.tgz","fileCount":7,"integrity":"sha512-oPOHP/4sZDLi+/PV3F/y52sCksM7rxiQlZ1H2dhH92g3Cj/INM5dceXEHFJg6kFy+4Z5djeug8sWYd3IUeQnaQ==","signatures":[{"sig":"MEUCICPB8OMWrXzRR7m6vk0xVia7+iIqOFkzMkEAeEGvi1jZAiEArqpnwE38eS8xHPF2hx9M8ESXuYcg8szpFzingAq9dFk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18474},"main":"dist/monnify.js","scripts":{"test":"jest","start":"npx tsc"},"_npmUser":{"name":"adsesugh","email":"sesughagbadu@yahoo.com"},"deprecated":"This version is deprecated, please use version 1.1.1 instead. Thank you","_npmVersion":"10.7.0","description":"The Monnify Payment Gateway for nodejs","directories":{},"_nodeVersion":"20.14.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","typescript":"^5.5.4","@types/jest":"^29.5.12","@types/node":"^22.5.0","@babel/preset-env":"^7.25.4","@babel/preset-typescript":"^7.24.7"},"_npmOperationalInternal":{"tmp":"tmp/monnify-sdk_1.0.0_1724360286944_0.5660398761317034","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@adsesugh/monnify-sdk","version":"1.0.1","keywords":["Monnify","Payment","Gateway","Nodejs"],"author":{"name":"Sesugh Agbadu"},"license":"ISC","_id":"@adsesugh/monnify-sdk@1.0.1","maintainers":[{"name":"adsesugh","email":"sesughagbadu@yahoo.com"}],"dist":{"shasum":"81672e7d0c1ac94e840b585fc40bf129aaf1b8a0","tarball":"https://registry.npmjs.org/@adsesugh/monnify-sdk/-/monnify-sdk-1.0.1.tgz","fileCount":8,"integrity":"sha512-ej1BY/5V7rvXfoOXb+hUe3opuZBmtYcdRH4zgf8FADLer02lGC6hRcAnitJoEzcORaVQLbE5tYBlDMFvMu+x8g==","signatures":[{"sig":"MEQCIGN9bpFf8txpMYDwg0da54pqzPvjF2I9O2HkRIXU2GuoAiBhA9IQRycVLgYeCkEuQ3WBatFeFs1yJ01bVNpz4UH5uw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19379},"main":"dist/monnify.js","scripts":{"test":"jest","start":"npx tsc"},"_npmUser":{"name":"adsesugh","email":"sesughagbadu@yahoo.com"},"deprecated":"This version is deprecated, please use version 1.1.1 instead. Thank you","_npmVersion":"10.7.0","description":"The Monnify Payment Gateway for nodejs","directories":{},"_nodeVersion":"20.14.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","typescript":"^5.5.4","@types/jest":"^29.5.12","@types/node":"^22.5.0","@babel/preset-env":"^7.25.4","@babel/preset-typescript":"^7.24.7"},"_npmOperationalInternal":{"tmp":"tmp/monnify-sdk_1.0.1_1724360579306_0.7627318821911402","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@adsesugh/monnify-sdk","version":"1.0.2","keywords":["Monnify","Payment","Gateway","Nodejs"],"author":{"name":"Sesugh Agbadu"},"license":"ISC","_id":"@adsesugh/monnify-sdk@1.0.2","maintainers":[{"name":"adsesugh","email":"sesughagbadu@yahoo.com"}],"dist":{"shasum":"45a60af1e72664b4439265e1b433e45aa0f652af","tarball":"https://registry.npmjs.org/@adsesugh/monnify-sdk/-/monnify-sdk-1.0.2.tgz","fileCount":8,"integrity":"sha512-yZD2QOqkjuBdrAXitr6SOBivaapyW5B5uMDKfqWzPlFIxKHblHpT3yVQot7/P5Ef0EQ/3b/cbkr9WusT8upVVw==","signatures":[{"sig":"MEQCIQDXj7M+D1qUSyG3f3YHhyQlOaz1z85hDJg8npwLctYPBQIfePIXObqpzSQBJ93LwNw7Ff7tHAymfRK4h5x6NyyTTA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19410},"main":"dist/monnify.js","types":"src/monnify-sdk.d.ts","scripts":{"test":"jest","build":"tsc"},"_npmUser":{"name":"adsesugh","email":"sesughagbadu@yahoo.com"},"deprecated":"This version is deprecated, please use version 1.1.1 instead. Thank you","_npmVersion":"10.7.0","description":"The Monnify Payment Gateway for nodejs","directories":{},"_nodeVersion":"20.14.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","typescript":"^5.5.4","@types/jest":"^29.5.12","@types/node":"^22.5.0","@babel/preset-env":"^7.25.4","@babel/preset-typescript":"^7.24.7"},"_npmOperationalInternal":{"tmp":"tmp/monnify-sdk_1.0.2_1724361295022_0.8503190489001888","host":"s3://npm-registry-packages"}},"1.0.3":{"name":"@adsesugh/monnify-sdk","version":"1.0.3","keywords":["Monnify","Payment","Gateway","Nodejs"],"author":{"name":"Sesugh Agbadu"},"license":"ISC","_id":"@adsesugh/monnify-sdk@1.0.3","maintainers":[{"name":"adsesugh","email":"sesughagbadu@yahoo.com"}],"dist":{"shasum":"062cdc68ce3378070e9e110bcb0ad0971938b562","tarball":"https://registry.npmjs.org/@adsesugh/monnify-sdk/-/monnify-sdk-1.0.3.tgz","fileCount":8,"integrity":"sha512-3G3fSkwo7GiyOmt6+j3VGVPMSeikUV4yOWoTDY5GHnrdUN2FOVUxS7NvrocFO/D+UbX1kHyYo1KqMywmQwYMPg==","signatures":[{"sig":"MEUCIQCo8XPiU1x8jnJ5k59WndLelqf6BIoSnQdlY5EdFaHlmwIgEo2mNAuhf5CIG6n8Ye8W82eHSNYt8dLix/C7+6E1vIs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19404},"main":"dist/monnify.js","types":"src/monnify-sdk.d.ts","scripts":{"test":"jest","build":"tsc"},"_npmUser":{"name":"adsesugh","email":"sesughagbadu@yahoo.com"},"deprecated":"This version is deprecated, please use version 1.1.1 instead. Thank you","_npmVersion":"10.7.0","description":"The Monnify Payment Gateway for nodejs","directories":{},"_nodeVersion":"20.14.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","typescript":"^5.5.4","@types/jest":"^29.5.12","@types/node":"^22.5.0","@babel/preset-env":"^7.25.4","@babel/preset-typescript":"^7.24.7"},"_npmOperationalInternal":{"tmp":"tmp/monnify-sdk_1.0.3_1724362547149_0.35774302150009674","host":"s3://npm-registry-packages"}},"1.0.4":{"name":"@adsesugh/monnify-sdk","version":"1.0.4","keywords":["Monnify","Payment","Gateway","Nodejs"],"author":{"name":"Sesugh Agbadu"},"license":"ISC","_id":"@adsesugh/monnify-sdk@1.0.4","maintainers":[{"name":"adsesugh","email":"sesughagbadu@yahoo.com"}],"dist":{"shasum":"89da15fc05fcf734a89003222dcd6e58f48e8365","tarball":"https://registry.npmjs.org/@adsesugh/monnify-sdk/-/monnify-sdk-1.0.4.tgz","fileCount":8,"integrity":"sha512-qNpxmLx8rZH7xgeHwYCEfkM4SEKmsLojeO/Gw6sC1dRHKssOS0jvMxY+vzco5cCuTmKXbfO6B97JzSjQZMhTOg==","signatures":[{"sig":"MEQCIBIT7BaW7H4viwoID0/xgS+XsrGTqjjJAz9Pt9g2kXO0AiBdeoQywZiZ0zqqPZ1WFb2d7ZptO+RC57CgooUJ2k3KOQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19822},"main":"dist/monnify.js","types":"src/monnify-sdk.d.ts","scripts":{"test":"jest","build":"tsc"},"_npmUser":{"name":"adsesugh","email":"sesughagbadu@yahoo.com"},"deprecated":"This version is deprecated, please use version 1.1.1 instead. Thank you","_npmVersion":"10.7.0","description":"The Monnify Payment Gateway for nodejs","directories":{},"_nodeVersion":"20.14.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","typescript":"^5.5.4","@types/jest":"^29.5.12","@types/node":"^22.5.0","@babel/preset-env":"^7.25.4","@babel/preset-typescript":"^7.24.7"},"_npmOperationalInternal":{"tmp":"tmp/monnify-sdk_1.0.4_1724363307325_0.7923467125417276","host":"s3://npm-registry-packages"}},"1.0.5":{"name":"@adsesugh/monnify-sdk","version":"1.0.5","keywords":["Monnify","Payment","Gateway","Nodejs","Nextjs"],"author":{"name":"Sesugh Agbadu"},"license":"ISC","_id":"@adsesugh/monnify-sdk@1.0.5","maintainers":[{"name":"adsesugh","email":"sesughagbadu@yahoo.com"}],"dist":{"shasum":"059d87f2003f00a396c45024e04d878b29608d3e","tarball":"https://registry.npmjs.org/@adsesugh/monnify-sdk/-/monnify-sdk-1.0.5.tgz","fileCount":8,"integrity":"sha512-52+eDiuxhjNECUDCq5xvwtwY/luPcnrm7VgC0jTvyrqP82H68FulkEi80QM9ny3y/tW2sEiEMr2NdmWLB2poWw==","signatures":[{"sig":"MEYCIQCUfCNEEnUq6Ue7MkZQOkbajD+9p6EM4EISZxMWCxEpygIhALbY5NGDt1N3hDdl3/w8R11Ck5MihWA4WMmrmJE/FtqR","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26536},"main":"dist/monnify.js","types":"src/monnify-sdk.d.ts","gitHead":"2270b1f1ff304e5497d312c6998d951e2fffe3aa","scripts":{"test":"jest","build":"tsc"},"_npmUser":{"name":"adsesugh","email":"sesughagbadu@yahoo.com"},"deprecated":"This version is deprecated, please use version 1.1.1 instead. Thank you","_npmVersion":"10.7.0","description":"The Monnify Payment Gateway for nodejs","directories":{},"_nodeVersion":"20.14.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","typescript":"^5.5.4","@types/jest":"^29.5.12","@types/node":"^22.5.0","@babel/preset-env":"^7.25.4","@babel/preset-typescript":"^7.24.7"},"_npmOperationalInternal":{"tmp":"tmp/monnify-sdk_1.0.5_1724440975169_0.8827258093396921","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"@adsesugh/monnify-sdk","version":"1.1.1","keywords":["Monnify","Payment","Gateway","Nodejs","Nextjs","Vue.js"],"author":{"name":"Sesugh Agbadu"},"license":"ISC","_id":"@adsesugh/monnify-sdk@1.1.1","maintainers":[{"name":"adsesugh","email":"sesughagbadu@yahoo.com"}],"dist":{"shasum":"242b708371aac1474bd1960df72f0fd9b17d12f2","tarball":"https://registry.npmjs.org/@adsesugh/monnify-sdk/-/monnify-sdk-1.1.1.tgz","fileCount":10,"integrity":"sha512-JXOeqxiiSKOl1C1+CIVoVmpTkCANnJBLqEmC6NBF/651lTO46OK1v9yOdnaNJ1I7D/UDyvcUZQnHcmqP1YGeTg==","signatures":[{"sig":"MEQCIBrhAseBA2Tzv984zWmyTtrgrBxrUNmIAtdtTXPyYk/EAiBhzc7nqaIQ99kUOU8ybKMlB+poVhKCauIwvZTQgcmpGA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16329},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"572979bd5660929537a71a20df62dc5069b1d8f5","scripts":{"test":"jest","build":"rm -rf dist && tsc"},"_npmUser":{"name":"adsesugh","email":"sesughagbadu@yahoo.com"},"_npmVersion":"10.8.2","description":"The Monnify Web SDK is now available as a Node.js package, offering an easy and efficient way to integrate payment gateway solutions into your web applications","directories":{},"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","typescript":"^5.5.4","@types/jest":"^29.5.12","@types/node":"^22.5.0","@babel/preset-env":"^7.25.4","@babel/preset-typescript":"^7.24.7"},"_npmOperationalInternal":{"tmp":"tmp/monnify-sdk_1.1.1_1724599373768_0.11875294030180195","host":"s3://npm-registry-packages"}},"1.1.2":{"name":"@adsesugh/monnify-sdk","version":"1.1.2","description":"The Monnify Web SDK is now available as a Node.js package, offering an easy and efficient way to integrate payment gateway solutions into your web applications","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"rm -rf dist && tsc","test":"jest"},"keywords":["Monnify","Payment","Gateway","Nodejs","Nextjs","Vue.js"],"author":{"name":"Sesugh Agbadu"},"license":"ISC","devDependencies":{"@babel/preset-env":"^7.25.4","@babel/preset-typescript":"^7.24.7","@types/jest":"^29.5.12","@types/node":"^22.5.0","jest":"^29.7.0","typescript":"^5.5.4"},"_id":"@adsesugh/monnify-sdk@1.1.2","gitHead":"eefb7b632704dd8f14b2e4d6093ad8d88dc2cfa3","_nodeVersion":"20.17.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-KhTqJT2bInsq6MToYJDFfE3MTV7Sx6b9jtxjZ3efBIK4iQqJGJLa8ErPzkQ9oLIsfeq6II/DSQy0yfd+boBAng==","shasum":"c1e7415fba2204455df64a0f17f3570d7e0d3fe9","tarball":"https://registry.npmjs.org/@adsesugh/monnify-sdk/-/monnify-sdk-1.1.2.tgz","fileCount":10,"unpackedSize":15691,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICcuHW9AzzARuhSStS3OBxkkgSrlT5rUMBu0Qp6cfqnKAiBgk5GjPl1oSKj4sFuC/vAYfB5qazgDSWiQaA21+tOJ3g=="}]},"_npmUser":{"name":"adsesugh","email":"sesughagbadu@yahoo.com"},"directories":{},"maintainers":[{"name":"adsesugh","email":"sesughagbadu@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/monnify-sdk_1.1.2_1724614799829_0.905961562621922"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-22T20:58:06.812Z","modified":"2024-08-25T19:40:00.133Z","1.0.0":"2024-08-22T20:58:07.105Z","1.0.1":"2024-08-22T21:02:59.531Z","1.0.2":"2024-08-22T21:14:55.226Z","1.0.3":"2024-08-22T21:35:47.351Z","1.0.4":"2024-08-22T21:48:27.555Z","1.0.5":"2024-08-23T19:22:55.452Z","1.0.5-beta.1":"2024-08-25T12:45:09.192Z","1.0.5-beta.1a":"2024-08-25T13:00:03.601Z","1.0.5-beta.2":"2024-08-25T13:00:44.406Z","1.0.5-beta.1b":"2024-08-25T13:06:36.047Z","1.0.5-beta.1c":"2024-08-25T13:13:07.510Z","1.0.5-beta.1d":"2024-08-25T13:16:36.273Z","1.0.5-beta.1f":"2024-08-25T13:19:10.217Z","1.0.5-beta.1e":"2024-08-25T13:55:20.496Z","1.0.5-beta.1g":"2024-08-25T14:00:07.299Z","1.1.0":"2024-08-25T14:20:49.360Z","1.1.1":"2024-08-25T15:22:53.912Z","1.1.2":"2024-08-25T19:39:59.955Z"},"author":{"name":"Sesugh Agbadu"},"license":"ISC","keywords":["Monnify","Payment","Gateway","Nodejs","Nextjs","Vue.js"],"description":"The Monnify Web SDK is now available as a Node.js package, offering an easy and efficient way to integrate payment gateway solutions into your web applications","maintainers":[{"name":"adsesugh","email":"sesughagbadu@yahoo.com"}],"readme":"# Monnify SDK Node.js Package\n\nThe Monnify Web SDK is now available as a Node.js package, offering an easy and efficient way to integrate payment gateway solutions into your web applications. Specifically designed for developers using React, Vue.js, Next.js and and any modern JavaScript framework for web, this package simplifies the process of accepting payments online. It allows you to quickly implement secure and reliable payment functionalities, ensuring a seamless experience for your users. With the Monnify Node.js package, you can effortlessly integrate various payment channels into your web projects, making payment management both scalable and straightforward.\n\nTo integrate the Monnify Web SDK Node.js package into your React or Next.js project using TypeScript, follow the installation and setup process outlined below. This will enable you to effortlessly accept payments on the web with a secure and seamless experience.\n\n### Prerequisites\n\n1. **Node.js and npm/yarn Installed**: Ensure you have Node.js and either npm or yarn installed on your development machine.\n   React or Next.js Project with TypeScript: Have an existing React or Next.js project configured with TypeScript.\n   Monnify Account and API Credentials: [Sign up for a Monnify account and obtain your API credentials (API Key, Secret, and Contract Code) from the Monnify dashboard](https://monnify.com).\n\n2. Install the Monnify SDK\n   Use npm or yarn to install the Monnify Web SDK package into your project.\n\n**Using npm**:\n\n```bash\nnpm install @adsesugh/monnify-sdk --save\n```\n**Using yarn**:\n\n```bash\nyarn add @adsesugh/monnify-sdk\n```\n\n3. Configure Environment Variables\n   For security reasons, it's best to store sensitive information like API credentials in environment variables.\n\nCreate a .env File: In the root directory of your project, create a .env file (or .env.local for Next.js projects).\nAdd Your Credentials:\n```env\nMONNIFY_API_KEY=your_monnify_api_key\nMONNIFY_API_SECRET=your_monnify_api_secret\nMONNIFY_CONTRACT_CODE=your_monnify_contract_code\nMONNIFY_ENVIRONMENT=TEST # Use 'LIVE' for production\n```\nNote for Next.js Users: Prefix environment variables with NEXT_PUBLIC_ to make them accessible on the client side. For React projects, ensure your build setup supports environment variables appropriately.\n\n4. Initialize and Use the Monnify SDK in Your Code\n   Integrate the Monnify SDK into your React or Next.js components where you want to handle payments.\n\n### Usage\n\n 1. Example: Payment Button Component in TypeScript for React/Next.js Application\n   - *One time payment without amount splitting to subaccount*\n\n```typescript\n// For React/Next.js Application\n\nimport React from 'react';\nimport { Monnify } from '@adsesugh/monnify-sdk';\n\nconst monnify = new Monnify({\n   publicKey: process.env.MONNIFY_API_KEY!,\n   contractCode: process.env.MONNIFY_CONTRACT_CODE!,\n   mode: process.env.MONNIFY_ENVIRONMENT === 'LIVE' ? 'LIVE' : 'TEST',\n})\n\nconst PaymentButton: React.FC = () => {\n\n    const handlePayment = async () => {\n      try {\n         const res = await monnify.initializePayment({\n            amount: 500,\n            currency: 'NGN',\n            reference: `${new String(new Date().getTime())}`,\n            customerName: 'Sesugh Daniel',\n            customerEmail: 'admin@gmail.com',\n            paymentDescription: 'Test Payment',\n            redirectUrl: 'https://example.com/payment-success'\n         });\n         console.log('Payment successful:', res);\n      } catch (error) {\n         console.error('Payment failed:', error);\n      }\n    };\n\n   return (\n        <button onClick={handlePayment}>\n            Pay with Monnify\n        </button>\n   );\n};\n\nexport default PaymentButton;\n```\n\n- *One time payment with split amount to subaccount*\n\n```typescript\n// For React/Next.js Application\n\nimport React from 'react';\nimport { Monnify } from '@adsesugh/monnify-sdk';\n\nconst monnify = new Monnify({\n   publicKey: process.env.MONNIFY_API_KEY!,\n   contractCode: process.env.MONNIFY_CONTRACT_CODE!,\n   mode: process.env.MONNIFY_ENVIRONMENT === 'LIVE' ? 'LIVE' : 'TEST',\n})\n\nconst PaymentButton: React.FC = () => {\n\n    const handlePayment = async () => {\n      try {\n         const res = await monnify.initializePayment({\n            amount: 500,\n            currency: 'NGN',\n            reference: `${new String(new Date().getTime())}`,\n            customerName: 'Sesugh Daniel',\n            customerEmail: 'admin@gmail.com',\n            paymentDescription: 'Test Payment',\n            redirectUrl: 'https://example.com/payment-success',\n            incomeSplitConfig: [\n                {\n                  feeBearer: true,\n                  subAccountCode: 'the subaccount',\n                  feePercentage: 0.5,\n                  splitAmount: 5000\n               },{\n                //more subaccount\n               }\n            ]\n         });\n         console.log('Payment successful:', res);\n      } catch (error) {\n         console.error('Payment failed:', error);\n      }\n    };\n\n   return (\n        <button onClick={handlePayment}>\n            Pay with Monnify\n        </button>\n   );\n};\n\nexport default PaymentButton;\n```\n\n*Example: Payment Button Component in TypeScript for Vue.js 3 Application*\n- *One time payment without amount splitting to subaccount*\n```vue\n<template>\n   <button @click=\"handlePayment\">Pay Now</button>\n</template>\n<script setup lang='ts'>\n   import { Monnify } from '@adsesugh/monnify-sdk';\n\n  const monnify = new Monnify({\n      publicKey: process.env.MONNIFY_API_KEY!,\n      contractCode: process.env.MONNIFY_CONTRACT_CODE!,\n      mode: process.env.MONNIFY_ENVIRONMENT === 'LIVE' ? 'LIVE' : 'TEST',\n  })\n  \n  async function handlePayment() {\n    try {\n      const res = await monnify.initializePayment({\n        amount: 500,\n        currency: 'NGN',\n        reference: `${new String(new Date().getTime())}`,\n        customerName: 'Sesugh Daniel',\n        customerEmail: 'admin@gmail.com',\n        paymentDescription: 'Test Payment',\n        redirectUrl: 'https://example.com/payment-success'\n      });\n      console.log('Payment successful:', res);\n    } catch (error) {\n      console.error('Payment failed:', error);\n    }\n  }\n</script>\n```\n\n- *One time payment with split amount to subaccount*\n```vue\n<template>\n   <button @click=\"handlePayment\">Pay Now</button>\n</template>\n<script setup lang='ts'>\n   import { Monnify } from '@adsesugh/monnify-sdk';\n\n  const monnify = new Monnify({\n      publicKey: process.env.MONNIFY_API_KEY!,\n      contractCode: process.env.MONNIFY_CONTRACT_CODE!,\n      mode: process.env.MONNIFY_ENVIRONMENT === 'LIVE' ? 'LIVE' : 'TEST',\n  })\n  \n  async function handlePayment() {\n    try {\n      const res = await monnify.initializePayment({\n        amount: 500,\n        currency: 'NGN',\n        reference: `${new String(new Date().getTime())}`,\n        customerName: 'Sesugh Daniel',\n        customerEmail: 'admin@gmail.com',\n        paymentDescription: 'Test Payment',\n        redirectUrl: 'https://example.com/payment-success', \n         incomeSplitConfig: [\n            {\n               feeBearer: true,\n               subAccountCode: 'the subaccount',\n               feePercentage: 0.5,\n               splitAmount: 5000\n            },{\n               //more subaccount\n            }\n         ]\n      });\n      console.log('Payment successful:', res);\n    } catch (error) {\n      console.error('Payment failed:', error);\n    }\n  }\n</script>\n```\n\nExplanation of the Code:\n\n- **Importing Monnify**: The Monnify SDK is imported to access its functionalities.\n\n- **Initializing Monnify**: The **Monnify.initializePayment** method is called with a configuration object containing:\n- **amount**: The payment amount in the smallest currency unit.\n- **currency**: The currency code (e.g., 'NGN' for Nigerian Naira).\n- **reference**: A unique transaction reference. It's essential to ensure uniqueness to track payments accurately.\n- **customerName & customerEmail**: Details of the customer making the payment.\n- **apiKey & contractCode**: Your Monnify API credentials sourced from environment variables.\n- **environment**: Specifies whether to use the 'TEST' or 'LIVE' environment.\n###### Callbacks:\n- **onComplete**: Triggered when the payment is successful.\n- **onClose**: Triggered when the payment window is closed without completing the payment.\n- **onError**: Triggered when there's an error during the payment process.\n- **Button Element**: A simple button that, when clicked, initiates the payment process by calling handlePayment.\n\n6. Run and Test Your Application\n   Start your development server and test the payment integration.\n\nUsing npm:\n\n```bash\nnpm run dev\n```\nUsing yarn:\n\n```bash\nyarn dev\n```\nNavigate to the component/page containing the payment button, and attempt a test payment to ensure everything functions as expected.\n\n6. Handle Server-Side Verification (Optional but Recommended)\n   For enhanced security and to confirm payments reliably, set up server-side verification using Monnify's webhook system. This involves:\n\nSetting Up a Server Endpoint: Create an API route in Next.js or an endpoint in your backend to receive webhook notifications from Monnify.\nVerifying Payment Data: Upon receiving a webhook, verify the payment details, update order statuses, and perform necessary business logic.\nRefer to Monnify's official documentation for detailed guidance on setting up and securing webhooks.\n\n7. Additional Customizations and Configurations\n   Depending on your project's requirements, you might want to customize the payment flow further. Consider:\n\nStyling the Payment Widget: Customize the appearance of the Monnify payment window to match your application's theme.\nHandling Different Payment Channels: Configure and handle various payment channels supported by Monnify, such as cards, bank transfers, mobile money, etc.\nError Handling and Notifications: Implement comprehensive error handling and user notifications to improve the user experience during payment processes.\n\n#### Summary\nBy following the steps above, you can seamlessly install and integrate the Monnify Web SDK Node.js package into your React or Next.js project using TypeScript. This setup facilitates easy and secure payment gateway integration, allowing you to accept payments on the web with minimal effort.\n\nThank you.","readmeFilename":"readme.md"}