Web API

You can use the web api to develop your app.

To get started I will use axios. Feel free to use any http client you want. e.g. fetch

Make Payment Request

pay.js
const axios = require("axios");

const apiUrl = "YOUR_API_URL"; // Get this from your dashboard
const makePayment = async (paymentData) => {
  try {
    const response = await axios.post(apiUrl, paymentData, {
      headers: {
        "Content-Type": "application/json",
      },
    });
    return response.data;
  } catch (error) {
    throw error;
  }
};

Example paymentData

paymentData.js
const paymentData = {
  totalPrice: 200,
  article: [
    {
      sac: 100,
      chaussure: 100,
    },
  ],
  personal_Info: [
    {
      userId: 1,
      orderId: 123,
    },
  ],
  numeroSend: "01010101",
  nomclient: "John Doe",
  return_url: "https://your-domain.com/callback",
  webhook_url: "https://your-domain.com/my-webhook-url", // The webhook must accept POST requests to receive data.
};

Fields

FieldTypeDescriptionExampleRequired
totalPriceNumberTotal amount to be paid200Yes
articleArray<Object>List of items with their prices[{"sac": 100, "chaussure": 100}]Yes
numeroSendStringCustomer phone number"01010101"Yes
nomclientStringCustomer name"John Doe"Yes
personal_InfoArray<Object>Personal information[{"userId": 1, "orderId": 123}]No
return_urlStringurl to be redirected after paymenthttps://your-domain.com/callbackNo
webhook_urlStringurl (POST) from which transaction details will be returnedhttps://your-domain.com/my-webhook-urlNon

Example Response

{
  "statut": true,
  "token": "5d58823b084564",
  "message": "paiement en cours",
  "url": "https://www.pay.moneyfusion.net/pay/6596aded36bd58823b084564"
}

Response Object

FieldTypeDescription
statutBooleanPayment request status
tokenStringUnique payment token for tracking
messageStringStatus message
urlStringPayment page URL

Payment Status Verification

Check Payment Status

checkPaymentStatus.js
const checkPaymentStatus = async (token) => {
  try {
    const response = await axios.get(
      `https://www.pay.moneyfusion.net/paiementNotif/${token}`
    );
    return response.data;
  } catch (error) {
    throw error;
  }
};

Example Response

{
  "statut": true,
  "data": {
    "_id": "65df163b11ab882694573060",
    "tokenPay": "0d1d8bc9b6d2819c",
    "numeroSend": "01010101",
    "nomclient": "John Doe",
    "personal_Info": [
      {
        "userId": 1,
        "orderId": 123
      }
    ],
    "numeroTransaction": "0708889205",
    "Montant": 200,
    "frais": 5,
    "statut": "paid",
    "moyen": "orange",
    "return_url": "https://your-domain.com/callback",
    "createdAt": "2024-02-28T11:17:15.285Z"
  },
  "message": "details paiement"
}

Payment Status Types

StatusDescription
pendingPayment is being processed
failurePayment failed
no paidPayment not completed
paidPayment successful

Status Response data fields

FieldTypeDescription
_idStringTransaction ID
tokenPayStringPayment token
numeroSendStringCustomer phone number
nomclientStringCustomer name
personal_InfoArray<Object>List of items with their prices
MontantNumberTransaction amount
fraisNumberTransaction fees
statutStringPayment status
moyenStringPayment method
createdAtStringTransaction timestamp

Real-Time Transaction Monitoring via Webhook

Structure of Received Data

{
  "event": "payin.session.pending",
  "personal_Info": [
    {
      "userId": 1,
      "orderId": 123
    }
  ],
  "tokenPay": "Le4Cnmm1Ac9yTgZMKQbz",
  "numeroSend": "01010101",
  "nomclient": "Kwameson",
  "numeroTransaction": "01010101",
  "Montant": 194,
  "frais": 6,
  "return_url": " https://your-domain.com/callback ",
  "webhook_url": "https://your-domain.com/my-webhook-url",
  "createdAt": "2025-05-09T12:50:45.412Z"
}

List of Available Webhook Events

EventDescription
payin.session.pendingPayment initiated and pending processing
payin.session.completedPayment successfully completed
payin.session.cancelledPayment failed or was cancelled

Handling Multiple Webhook Notifications

Important to Know

Moneyfusion may send multiple notifications for the same transaction, especially in the following cases:

  • Repeated payin.session.pending events during the processing phase.
  • A payin.session.completed event after the payment is confirmed.
  • A possible payin.session.cancelled event in case of failure or cancellation.

Processing Recommendations

To ensure reliable processing and avoid duplicates :

  1. Identify each transaction uniquely using the tokenPay field.
  2. Check the current transaction status in your database before updating.
  3. Ignore already processed events or those that do not represent a status change.

Example Filtering Logic

if (transactionExists && incomingStatus === currentStatus) {
  // Do nothing: redundant notification
} else {
  // Update the transaction status
}