@spreeloop/orange_money

中文文档
1.1.0发布于 2026/11/02MITTypeScriptCommonJS

A orange money api integration package

原始使用文档
文档目录13 节
  1. Features
  2. Installation
  3. Configuration
  4. Run tests
  5. Table content
  6. Merchant payment
  7. Generate access-token
  8. Generate pay-token
  9. Initiate Payment
  10. Get Orange Money Payment Status
  11. Author
  12. 🤝 Contributing
  13. Show your support

Welcome to @spreeloop/orange_money 👋

Version License: MIT

The Y-note Orange Money Node.js Integration Module is a powerful toolkit designed to simplify the integration of Orange Money's payment capabilities into Node.js applications. This module provides developers with a convenient interface to interact with Orange Money APIs, enabling seamless payment processing and transaction management.

Features

  • Easy Integration: Simplifies the integration of Orange Money payment functionality into Node.js applications.
  • Flexible Configuration: Allows developers to customize payment configurations based on specific requirements.
  • Comprehensive Documentation: Provides comprehensive documentation and examples for easy integration and usage.
  • Supports Multiple Environments: Supports multiple target environments, including production and testing environments.

Installation

To install the Orange Money Node.js Integration Module, simply add it to your Node.js project using npm:

npm install @spreeloop/orange_money

Configuration

Provide endpoint URLs in the configuration object. For payments, set baseURL to the Orange Money API base URL without an API path; the package adds payment paths automatically. For disbursements, set baseURL to the disbursement API base URL and baseURLToken to the full access-token endpoint URL. Your application can source these values from its own configuration and change them without updating this package.

Run tests

npm run test

Table content

import {OrangeMoneyPayment} from  @spreeloop/orange_money;

// Creates payment configuration
const config = {
  /** In test mode use the TargetEnvironment.fake that return static data since
    the y-note payment don't have the sandbox environment.
  */
  targetEnvironment: TargetEnvironment.prod,
  baseURL: 'https://api-s1.orange.cm',
  apiUserName: 'your_api_username',
  apiPassword: 'your_api_password',
  xAuthToken: 'your_x_auth_token',

// By default we use the 'console' to display the log but you can decide to 
// use your own custom log.
  logger: console,
};

const payment = OrangeMoneyPayment.createPayment(config);

For disbursements, include the configurable API URLs as well:

const disbursementConfig = {
  // Other required disbursement credentials and configuration...
  baseURL: 'https://omapi.ynote.africa',
  baseURLToken: 'https://omapi-token.ynote.africa/oauth2/token',
};
  • Generate access-token

const accessTokenResponse = await payment.getAccessToken();
  • Generate pay-token

const payTokenResponse = await payment.getPayToken('your_access_token');
  • Initiate Payment

The payment initialization depends on the platform on which the application runs. This package only support USSD payment.

// Initialize Orange Money Payment
const initializationResponse = await payment.initializeOrangeMoneyPayment({
  description: 'Payment for goods',
  subscriberNumber: '696600011',
  channelUserNumber: '696600011',
  transactionId: '1234567890',
  amount: '1000',
  pinCode: '1234',
  notifUrl: 'https://yourdomain.com/payment/notify',
  payToken: 'your_pay_token',
  accessToken: 'your_access_token',
});

If you want to receive an answer immediately, always set a correct notifUrl endpoint link. The service notifies the url immediately or 1 minutes after receiving the client validation.
The response received is of the form:

{
    "payToken": "payToken",
    "status" : "status",
    "message" : "message"
}

Note: After initiating the payment, the request goes to status EXPIRED if the user doesn't validate or cancel the payment within 7 minutes.

Express is one of the most popular npm package to manage your endpoint.

Example:

import * as express from 'express';

const app = express();
const expressRouter = express.Router;
const router = expressRouter();

appV1.use('/', router);

router.post('/orange_money/payment/:paymentId', (req, res) => {
  const body = req.body;
  ...
  /** 
   * Your code.......
    Before updating the payment in your system, retrieve the payment status
    by using getOrangeMoneyPaymentStatus function and compare the status 
    received with that sent to your endpoint. This is to ensure the consistency
    of your system.
  */
  ...

  return res.sendStatus(HttpStatusCode.Ok);
});

Get Orange Money Payment Status

// Get Orange Money Payment Status
const paymentStatusResponse = await payment.getOrangeMoneyPaymentStatus({
  payToken: 'your_pay_token',
  accessToken: 'your_access_token',
});

Sometimes Orange Money API will not notify your endpoint url, so we recommend to set up a system that will run getOrangeMoneyPaymentStatus every 2 min depending on your choice.


For more information and detailed API documentation, please refer to the official Y-Note Merchant payment documentation


Author

👤 Spreeloop

🤝 Contributing

Contributions to the Orange Money Node.js Integration Module are welcome! Please feel free to open issues or submit pull requests to contribute to the development of this module.

Show your support

Give a ⭐️ if this project helped you!

版本与发布记录

@spreeloop/orange_money 共发布 22 个版本,首次发布于 2024/02/22;过去 12 个月发布了 5 个版本。

版本发布日期距今
1.1.0latest2026/11/021 天前
1.0.212026/10/286 天前
1.0.202026/04/166 个月前
1.0.192026/04/096 个月前
1.0.182025/12/2510 个月前
1.0.172025/09/251.1 年前

关于 @spreeloop/orange_money 的常见问题

@spreeloop/orange_money 是什么?

一个橙钱api集成包

如何安装 @spreeloop/orange_money?

在项目目录运行 npm install @spreeloop/orange_money,或使用 pnpm add / yarn add / bun add。

@spreeloop/orange_money 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@spreeloop/orange_money 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@spreeloop/orange_money 可以商用吗?

@spreeloop/orange_money 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@spreeloop/orange_money 还在维护吗?

最新版本 1.1.0 发布于 2026/11/02(1 天前);至今共发布 22 个版本,其中过去 12 个月发布了 5 个;首次发布于 2024/02/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。