Accept Admin
Package for managing integration with the accept payment service provided by paymobsolutions for lack of an offical one.
Getting Started
npm install accept-admin
Include your paymob accept credentials in a gitingnored .env
or configuration file
// config.jsmoduleexports = credentials: username: processenvACCEPT_USERNAME password: processenvACCEPT_PASSWORD expiration: 36000 hmac_secret: processenvACCEPT_HMAC_SECRET integration_id: processenvACCEPT_INTEGRATION_ID host: "https://example.com/api" notification_callback_url: "/accept/notification" response_callback_url: "/accept/response"
Import the accept admin instance and configure it
// or in node < 10 you can// const { Accept } = require("accept-admin")// const AcceptAdmin = require("accept-admin").default AcceptAdmin //... later in your code await AcceptAdmin
Package includes a router and middelware functions to deal with Hmac validation
one possible workflow with express
// app.jsconst express = const AcceptRouter = // or// const { AcceptRouter } = require("accept-admin/lib/express_router") const app = app
and when starting your server
// server.jsconst app = const Accept = const ACCEPT_CONFIG = Accept async { // get auth_token and assign it ot the instance // and set integration callback hooks to // integration.host + integration.response_callback_url as configured await Accept // then start app app}
See tests for the rest of the available functions, like tokenization, refunding and voiding transactions
This package has partial coverage of the accept admin API but is mainly meant for manging payment and an tokanization of credit cards.
The package is maintianed by DREIDEV and is not an offical paymobsolutions/accept package
Licence MIT