1.0.1 • Published 7 months ago

monnify-node v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

🚀 MonnifySDK Documentation 📖

Integrate the Monnify payment gateway seamlessly with Node.js applications using the MonnifySDK.

version npm monnify

📌 Table of Contents


📦 Installation

npm install monnify-sdk

⚙️ Initialization

After installation, initialize the SDK with your Monnify credentials.

const MonnifySDK = require('monnify-sdk');
const sdk = new MonnifySDK(apiKey, secretKey, contractCode, baseUrl);

Parameters:

  • apiKey: The Monnify API key assigned to your account.
  • secretKey: Your confidential Monnify secret.
  • contractCode: Your business's unique Monnify code.
  • baseUrl: Base endpoint for Monnify's API.

🛠️ Core Methods

1. initializeTransaction()

Begin a payment transaction:

const result = await sdk.initializeTransaction(amount, customerName, customerEmail, paymentDescription, merchantUrl, currencyCode);

Parameters:

Successful Response:

{
    status: 'success',
    checkoutUrl: [URL to redirect the user for completing the payment]
}

Error Response:

{
    status: 'error',
    message: [Error message explaining the issue]
}

... (Detail out the parameters, successful response, and error response for all the other methods, similar to the above format) ...

Error Handling

While the SDK is built to handle many scenarios, some unexpected situations can still arise. It's important to handle errors gracefully:

try {
    const response = await sdk.initializeTransaction(...params);
    if(response.status === "success") {
        // Successful handling code here
    } else {
        // Handle potential errors or issues
    }
} catch (error) {
    console.error("Encountered an error:", error.message);
}

🔚 Conclusion

With MonnifySDK, integrating Monnify's payment solutions into your Node.js projects becomes a breeze. Whenever in doubt, lean on this documentation, and always check Monnify's official resources for the latest updates.

1.0.1

7 months ago

1.0.0

8 months ago