API-SDK-Nodejs
This is an Nodejs/Typescript SDK that maps some of the RESTful methods of Open API that are documented at doc.revenuemonster.my.
Installation
# using npm npm i rm-api-sdk# using yarn yarn add rm-api-sdk
Supported APIs
- Client Credentials (Authentication)
- Mechant related API
- Store related API
- User related API
- Payment (Transaction QRCode/URL)
- Payment (Quick Pay)
- Loyalty
- Voucher
Prerequisites
- Get Client ID and Client Secret from portal.
- Generate private key and publci key from portal.
- Store private key for own use and public key at portal.
SDK API
Import the RMSDK via require
var RMSDK = RMSDK
Or ES5
var RMSDK =
Or Import/Export convention
Initialise a RMSDK instance by using
const SDK =
Access Token Generation - getClientCredentials()
To get refresh token and access token(expired after 2 hours) with using provided clientId
and clientSecret
.
const result = await SDK;
Refresh Access Token - refreshToken(string)
To get new access token(expired after 2 hours) with using provided clientId and clientSecret (recommended to schedule to run this fucntion on every less than 2 hours) in order to avoid expired access token error.
const result = await SDK;
Merchant related API
Get merchant profile - getMerchantProfile(accessToken)
const result = await SDK;
Get merchant subscription - getMerchantSubscriptions(accessToken)
const result = await SDK
Store realted API
Get list of stores - getStores(accessToken)
const result = await SDK
Get store by Id - getStoreById(accessToken)
const result = await SDK
Create store - createStore(accessToken, data)
const result = await SDK
Update store - updateStore(accessToken, storeId, data)
const result = await SDK
Delete store - deleteStore(accessToken, storeId)
const result = await SDK
User related API
Get user profile - getUserProfile(accessToken)
const result = await SDK
Payment (Transaction QRCode/URL)
Create transaction QRCode/URL
Payment.createTransactionUrl(accessToken, transactionPayload)
const result = await SDKPaymentconsole
Get list of transaction QRCode/URLs generated
Payment.getTransactionUrl(accessToken)
const result = await SDKPayment
Get transaction QRCode/URL by code
Payment.getTransactionUrlByCode(accessToken, code)
const result = await SDKPayment
Get list of transactions by code
Payment.getTransactionsByCode(accessToken, code)
const result = await SDKPayment
Payment (Quick Pay)
Initiate Quick Pay transaction
Payment.initQuickPay(accessToken, data)
const result = await SDKPayment;
Refund transaction
Payment.refund(accessToken, data)
const result = await SDKPayment;
Reverse transaction
Payment.reverse(accessToken, data)
const result = await SDKPayment;
Get list of payment transactions
Payment.getPaymentTransactions(accessToken)
const result = await SDKPayment;
Get payment transaction by Id
Payment.getTransactionById(accessToken, Id)
const result = await SDKPayment;
Get payment trasaction by Order Id
Payment.getTransactionByOrderId(accessToken, orderId)
const result = await SDKPayment;
Get daily settlement report
Payment.getDailySettlementReport(accessToken, data)
const result = await SDKPayment;
Loyalty related API
Give loyalty point - giveLoyaltyPoint(accessToken, data)
const result = await SDK;
Voucher related API
Issue voucher - issueVoucher(accessToken, batchKey)
const result = await SDK
Void voucher - voidVoucher(accessToken, code)
const result = await SDK
Get voucher by code - getVoucherByCode(accessToken, code)
const result = await SDK
Get list of voucher batches - getVoucherBatches(accessToken)
const result = await SDK
Get voucher batch by key - getVoucherBatchByKey(accessToken, batchKey)
const result = await SDK
Get WeChat User OAuth URL throught Revenue Monster Official Account
const result = await SDK
Get Revenue Monster Official Account WeChat User Information By Code
const result = await SDK