Giter Club home page Giter Club logo

fusionpay's Introduction

FusionPay

FusionPay is a JavaScript library for handling payment operations, providing a simple and intuitive API to facilitate online payments for moneyfusion.net.

Installation

You can install FusionPay via npm or yarn.:

npm install fusionpay
yarn add fusionpay

Usage

Initializing FusionPay To start using FusionPay, you need to initialize a new instance with your API URL:

const { FusionPay } = require("fusionpay");
//OR import { FusionPay } from "fusionpay";

const fusionPay = new FusionPay("https://your-api-url.com");

Setting Payment Data

You can set the payment data using the various methods provided by FusionPay:

fusionPay
  .totalPrice(200)
  .addArticle("Sac", 100)
  .addArticle("Veste", 200)
  .addInfo({ userId: "1245d858sf8f95f9ff", token: "dffqsyyyysfs56556sjsjh" })
  .clientName("M. Yaya")
  .clientNumber("0574801791")
  .returnUrl("https://my_call_back_link.com");

Making a Payment

To make a payment, use the makePayment() method:

fusionPay
  .makePayment()
  .then((response) => {
    console.log("Payment successful:", response);
  })
  .catch((error) => {
    console.error("Payment failed:", error);
  });

Checking Payment Status

To check the payment status, use the checkPaymentStatus() method:

const paymentToken = "your_payment_token_here";

fusionPay
  .checkPaymentStatus(paymentToken)
  .then((status) => {
    console.log("Payment status:", status);
  })
  .catch((error) => {
    console.error("Failed to check payment status:", error);
  });

API

FusionPay(apiUrl: string)

  • apiUrl: The API URL for payment.

Methods

  • totalPrice(amount: number): FusionPay
  • addArticle(name: string, value: number): FusionPay
  • addInfo(info: Record<string, string>): FusionPay
  • clientName(name: string): FusionPay
  • clientNumber(number: string): FusionPay
  • returnUrl(url: string): FusionPay
  • makePayment(): Promise<AxiosResponse>
  • checkPaymentStatus(token: string): Promise<AxiosResponse>

License

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

fusionpay's People

Contributors

yaya12085 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.