Skip to content

Evc-Plus is an npm package that provides functions for formatting phone numbers and processing payments using WaafiPay.

Notifications You must be signed in to change notification settings

Dhaqane-00/Evc-Plus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

Evc-Plus

Logo

Evc-Plus is a robust Node.js package that simplifies mobile payment processing through WaafiPay and provides utilities for Somali phone number formatting. Perfect for e-commerce applications and payment integrations in Somalia.

MIT License npm version

Features

  • 📱 Smart Phone Number Formatting: Automatically handles Somali phone number formats
  • 💳 WaafiPay Integration: Seamless payment processing with WaafiPay
  • Promise-based API: Modern async/await support
  • 🔒 Secure: Built with security best practices
  • 🛠️ Easy Configuration: Simple setup with your WaafiPay credentials

Installation

Install via npm:

npm install evc-plus

Usage

Phone Number Formatting

Use the formatMerchantPhone function to format Somali phone numbers to the standard format.

Processing Payments

Use the payByWaafiPay function to process payments through WaafiPay.

Environment Variables

Create a .env file in your project root with:

  • MERCHANT_UID
  • API_USER_ID
  • API_KEY

API Reference

formatMerchantPhone(phone: string)

Formats Somali phone numbers to the standard format.

Parameters:

  • phone (string): Phone number in any format

Returns:

  • Formatted phone number string

payByWaafiPay(options: PaymentOptions)

Processes a payment through WaafiPay.

Parameters:

  • options (object):
    • phone (string): Customer's phone number
    • amount (number): Payment amount
    • merchantUid (string): Your merchant UID
    • apiUserId (string): Your API user ID
    • apiKey (string): Your API key
    • description? (string): Payment description
    • invoiceId? (string): Invoice ID
    • referenceId? (string): Reference ID
    • currency? (string): Currency code (default: "USD")

Returns:

  • Promise resolving to { status: boolean, message?: string, error?: string }

Error Handling

The package includes comprehensive error handling:

  • Invalid phone numbers
  • API authentication errors
  • Payment rejection scenarios
  • Network issues

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

MIT

Support

For support or inquiries:

Author

Abdilaahi Dhaqane

About

Evc-Plus is an npm package that provides functions for formatting phone numbers and processing payments using WaafiPay.

Resources

Stars

Watchers

Forks

Packages

No packages published