0.0.7 • Published 11 months ago

edfapay v0.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

Edfapay

Edfapay SDK

npm version License: MIT

Edfapay SDK is a Node.js library that simplifies the integration with the Edfapay payment gateway. It provides a straightforward API for initiating payments, processing refunds, and checking the status of transactions.

Table of Contents

Features

  • Initiate Payment: Start a payment transaction with ease.
  • Refund Payment: Refund a transaction that has been completed.
  • Check Payment Status: Verify the status of any payment transaction.

Installation

Install the package via npm:

npm install edfapay

Getting Started

Initialization

To get started, you need to initialize the Edfapay SDK with your API key and secret. You can obtain these credentials by signing up for an account on the Edfapay website.

import { Edfapay } from 'edfapay';

const edfapay = new Edfapay(
    EDFAPAY_API_KEY,
    EDFAPAY_SECRET_KEY,
    EDFAPAY_RETURN_URL
);

Initiate a Payment

import { OrderPayload, PayerPayload } from 'edfapay/Types';

const orderPayload: OrderPayload = {
    order_id: 'order_id_example',
    order_amount: '100.00',
    order_currency: 'USD',
    order_description: 'Product Description',
};

const payerPayload: PayerPayload = {
    payer_first_name: 'Kareem',
    payer_last_name: 'Adel',
    payer_email: 'kareem.adel.zayed@gmail.com',
    payer_ip: '192.168.1.1',
    payer_phone: '1234567890',
    payer_address: '123 Main St',
    payer_country: 'US',
    payer_city: 'New York',
    payer_zip: '10001',
};

edfapay.initiatePayment(orderPayload, payerPayload)
    .then(response => console.log('Payment initiated successfully:', response))
    .catch(error => console.error('Error initiating payment:', error.message));

Sponsor

TarmeezTech

License

This project is licensed under the MIT License - see the LICENSE file for details.