{"id":21445209,"url":"https://github.com/revenuemonster/rm-js-sdk","last_synced_at":"2025-07-14T18:32:23.250Z","repository":{"id":43869929,"uuid":"163794491","full_name":"RevenueMonster/rm-js-sdk","owner":"RevenueMonster","description":"Revenue Monster Nodejs Payment SDK","archived":false,"fork":false,"pushed_at":"2023-07-11T20:56:16.000Z","size":545,"stargazers_count":2,"open_issues_count":15,"forks_count":5,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-11-10T04:57:45.864Z","etag":null,"topics":["browser","nodejs","rm","sdk","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RevenueMonster.png","metadata":{"files":{"readme":"README.MD","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-02T04:37:04.000Z","updated_at":"2023-06-12T02:33:34.000Z","dependencies_parsed_at":"2023-01-23T04:15:54.780Z","dependency_job_id":null,"html_url":"https://github.com/RevenueMonster/rm-js-sdk","commit_stats":null,"previous_names":["revenuemonster/rm-api-sdk-nodejs"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RevenueMonster%2Frm-js-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RevenueMonster%2Frm-js-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RevenueMonster%2Frm-js-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RevenueMonster%2Frm-js-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RevenueMonster","download_url":"https://codeload.github.com/RevenueMonster/rm-js-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225992507,"owners_count":17556481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser","nodejs","rm","sdk","typescript"],"created_at":"2024-11-23T02:24:53.455Z","updated_at":"2024-11-23T02:24:54.072Z","avatar_url":"https://github.com/RevenueMonster.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API-SDK-Nodejs\n[![](https://img.shields.io/npm/v/rm-api-sdk.svg?style=flat-square)](https://www.npmjs.com/package/rm-api-sdk)\n[![](https://img.shields.io/npm/types/rm-api-sdk.svg)](https://www.npmjs.com/package/rm-api-sdk)\n\nThis is an Nodejs/Typescript SDK that maps some of the RESTful methods of Open API that are documented at [doc.revenuemonster.my](https://doc.revenuemonster.my/).\n\n### Installation\n```bash\n# using npm\nnpm i rm-api-sdk\n# using yarn\nyarn add rm-api-sdk\n```\n\n### Supported APIs\n* Client Credentials (Authentication)\n  * [client credential - access token generation](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#access-token-generation---getclientcredentials)\n  * [refresh access token](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#refresh-access-token---refreshtokenstring)\n* Mechant related API\n  * [get merchant profile](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-merchant-profile---getmerchantprofileaccesstoken)\n  * [get list of merchant subscriptions](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-merchant-subscription---getmerchantsubscriptionsaccesstoken)\n* Store related API\n  * [get list of stores](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-list-of-stores---getstoresaccesstoken)\n  * [get store by Id](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-store-by-id---getstorebyidaccesstoken)\n  * [create store](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#create-store---createstoreaccesstoken-data)\n  * [update store](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#update-store---updatestoreaccesstoken-storeid-data)\n  * [delete store](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#delete-store---deletestoreaccesstoken-storeid)\n* User related API\n  * [get user profile](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-user-profile---getuserprofileaccesstoken)\n* Payment (Transaction QRCode/URL)\n  * [create transaction QRCode/URL](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#create-transaction-qrcodeurl)\n  * [get list of transaction QRCode/URLs generated](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-list-of-transaction-qrcodeurls-generated)\n  * [get transaction QRCode/URL by code](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-transaction-qrcodeurl-by-code)\n  * [get list of transactions by code](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-list-of-transactions-by-code)\n* Payment (Quick Pay)\n  * [initiate Quick Pay transaction](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#initiate-quick-pay-transaction)\n  * [refund transaction](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#refund-transaction)\n  * [reverse transaction](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#reverse-transaction)\n  * [get list of payment transactions](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-list-of-payment-transactions)\n  * [get payment transaction by Id](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-payment-transaction-by-id)\n  * [get payment trasaction by Order Id](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-payment-trasaction-by-order-id)\n  * [get daily settlement report](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-daily-settlement-report)\n* Loyalty\n  * [give loyalty point](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#give-loyalty-point---giveloyaltypointaccesstoken-data)\n* Voucher\n  * [issue voucher](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#issue-voucher---issuevoucheraccesstoken-batchkey)\n  * [void voucher](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#void-voucher---voidvoucheraccesstoken-code)\n  * [get voucher by code](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-voucher-by-code---getvoucherbycodeaccesstoken-code)\n  * [get list of voucher batches](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-list-of-voucher-batches---getvoucherbatchesaccesstoken)\n  * [get voucher batch by key](https://github.com/RevenueMonster/RM-API-SDK-Nodejs#get-voucher-batch-by-key---getvoucherbatchbykeyaccesstoken-batchkey)\n\n### Prerequisites\n1. Get Client ID and Client Secret from portal.\n![ClientIDClientSecret](https://storage.googleapis.com/rm-portal-assets/img/rm-landing/clientIDclientSecret.png)\n2. Generate private key and publci key from portal. \n![PrivateKeyPublicKey](https://storage.googleapis.com/rm-portal-assets/img/rm-landing/privateKeypublicKey.PNG)\n3. Store private key for own use and public key at portal.\n![PastePublicKey](https://storage.googleapis.com/rm-portal-assets/img/rm-landing/pastePublicKey.png)\n\n## SDK API\n\nImport the RMSDK via `require`\n```js\nvar RMSDK = require('rm-api-sdk').RMSDK\n```\nOr ES5\n```js\nvar { RMSDK } = require('rm-api-sdk')\n```\nOr Import/Export convention\n```js\nimport { RMSDK } from 'rm-api-sdk'\n```\n\nInitialise a RMSDK instance by using\n```js\nconst SDK = RMSDK({\n    clientId: '5499912462549392892',\n    clientSecret: 'pwMapjZzHljBALIGHxfGGXmiGLxjWBKt',\n    privateKey: Buffer.from(fs.readFileSync('privateKey.pem')).toString(),\n\n    openApiVersion: 'v3'  // default, optional\n    oauthApiVersion: 'v1' // default, optional\n    isProduction: false   // default, optional\n    timeout: 2000,        // default, optional\n})\n```\n\n### Access Token Generation - getClientCredentials()\nTo get refresh token and access token(expired after 2 hours) with using provided `clientId` and `clientSecret`.\n\n```js\nconst result = await SDK.getClientCredentials();\n```\n\n### Refresh Access Token - refreshToken(string)\nTo 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.\n```js\nconst result = await SDK.refreshToken(refreshToken);\n```\n\n## Merchant related API\n\n### Get merchant profile - getMerchantProfile(accessToken)\n```js\nconst result = await SDK.getMerchantProfile(accessToken);\n```\n### Get merchant subscription - getMerchantSubscriptions(accessToken)\n```js\nconst result = await SDK.getMerchantSubscriptions(accessToken)\n```\n\n## Store realted API\n### Get list of stores - getStores(accessToken)\n```js\nconst result = await SDK.getMerchantSubscriptions(accessToken)\n```\n\n### Get store by Id - getStoreById(accessToken)\n```js\nconst result = await SDK.getStoreById(accessToken)\n```\n\n### Create store - createStore(accessToken, data)\n```js\nconst result = await SDK.createStore(accessToken, {\n    name: 'Revenue Monster',\n    addressLine1: 'B-5-30, 5th Floor, Block Bougainvillea,'\n    addressLine2: 'PJU 6A, Lebuhraya SPRINT, 10 Boulevard,' // optional\n    postCode: '47400',\n    city: 'Petaling Jaya',\n    state: 'Selangor',\n    country: 'Malaysia',\n    countryCode: '60',\n    phoneNumber: '377334080',\n    geoLocation: { // optional\n        Lat: 3.1349857,\n        Lng: 101.6136659\n    }\n})\n```\n\n### Update store - updateStore(accessToken, storeId, data)\n```js\nconst result = await SDK.updateStore(accessToken, '1662168764176583360', {\n    name: 'Revenue Monster',\n    addressLine1: 'B-5-30, 5th Floor, Block Bougainvillea,'\n    addressLine2: 'PJU 6A, Lebuhraya SPRINT, 10 Boulevard,' // optional\n    postCode: '47400',\n    city: 'Petaling Jaya',\n    state: 'Selangor',\n    country: 'Malaysia',\n    countryCode: '60',\n    phoneNumber: '377334080',\n    geoLocation: { // optional\n        Lat: 3.1349857,\n        Lng: 101.6136659\n    }\n})\n```\n\n### Delete store - deleteStore(accessToken, storeId)\n```js\nconst result = await SDK.deleteStore(accessToken, '1662168764176583360')\n```\n\n## User related API\n### Get user profile - getUserProfile(accessToken)\n```js\nconst result = await SDK.getUserProfile(accessToken)\n```\n\n## Payment (Transaction QRCode/URL)\n### Create transaction QRCode/URL\n**Payment.createTransactionUrl(accessToken, transactionPayload)**\n```js\nconst result = await SDK.Payment.createTransactionUrl(accessToken, {\n    amount: 100,\n    currencyType: 'MYR',\n    expiry: { type: 'PERMANENT' },\n    isPreFillAmount: true,\n    method: ['WECHATPAY'],\n    order: {\n        details: 'detail AAA',\n        title: 'title BBB',\n    },\n    redirectUrl: 'https://www.google.com',\n    storeId: '1981039839353524638',\n    type: 'DYNAMIC',\n})\nconsole.log(result)\n```\n\n### Get list of transaction QRCode/URLs generated\n**Payment.getTransactionUrl(accessToken)**\n```js\nconst result = await SDK.Payment.getTransactionUrl(accessToken)\n```\n\n### Get transaction QRCode/URL by code\n**Payment.getTransactionUrlByCode(accessToken, code)**\n```js\nconst result = await SDK.Payment.getTransactionUrlByCode(accessToken, 'a669adc3b06fe5cef977cc762f40ce8c')\n```\n\n### Get list of transactions by code\n**Payment.getTransactionsByCode(accessToken, code)**\n```js\nconst result = await SDK.Payment.getTransactionsByCode(accessToken)\n```\n\n## Payment (Quick Pay)\n\n### Initiate Quick Pay transaction\n**Payment.initQuickPay(accessToken, data)**\n```js\nconst result = await SDK.Payment.initQuickPay(accessToken, {\n    authCode: '161108235812586242',\n    order: {\n        amount: 100,\n        currencyType: 'MYR',\n        id: '12344333233444',\n        title: 'title',\n        detail: 'description here',\n        additionalData: 'API testing',\n    },\n    ipAddress: '175.143.101.229',\n    storeId: '5237968049713769466'\n});\n```\n\n### Refund transaction\n**Payment.refund(accessToken, data)**\n```js\nconst result = await SDK.Payment.refund(accessToken, {\n    transactionId: '181203100634010427614646',\n    refund: {\n        type: 'FULL',\n        currencyType: 'MYR',\n        amount: 100,\n    },\n    reason: 'testing purpose',\n});\n```\n### Reverse transaction\n**Payment.reverse(accessToken, data)**\n```js\nconst result = await SDK.Payment.reverse(accessToken, {\n    orderId: '12345678123'\n});\n```\n\n### Get list of payment transactions\n**Payment.getPaymentTransactions(accessToken)**\n```js\nconst result = await SDK.Payment.getPaymentTransactions(accessToken);\n```\n\n### Get payment transaction by Id\n**Payment.getTransactionById(accessToken, Id)**\n```js\nconst result = await SDK.Payment.getPaymentTransactionById(accessToken, '1805260552060011600267');\n```\n\n### Get payment trasaction by Order Id\n**Payment.getTransactionByOrderId(accessToken, orderId)**\n```js\nconst result = await SDK.Payment.getPaymentTransactionByOrderId(accessToken, '9809099398273542333339');\n```\n\n### Get daily settlement report\n**Payment.getDailySettlementReport(accessToken, data)**\n```js\nconst result = await SDK.Payment.getDailySettlementReport(accessToken, {\n    date: \"2019-01-06\",\n    method: \"WECHATPAY\",\n    region: \"MALAYSIA\",\n    sequence: 1\n});\n```\n\n## Loyalty related API\n### Give loyalty point - giveLoyaltyPoint(accessToken, data)\n```js\nconst result = await SDK.giveLoyaltyPoint(accessToken, {\n    point: 100,\n    type: 'PHONENUMBER',\n    countryCode: '60',\n    phoneNumber: '176473298',\n});\n```\n\n## Voucher related API\n### Issue voucher - issueVoucher(accessToken, batchKey)\n```js\nconst result = await SDK.issueVoucher(\n    accessToken,\n    'EhQKCE1lcmNoYW50EJXVzd3wraqTORIYCgxWb3VjaGVyQmF0Y2gQkvnGweaB2uQg'\n)\n```\n\n### Void voucher - voidVoucher(accessToken, code)\n```js\nconst result = await SDK.voidVoucher(accessToken, 'NAklEfbVdV')\n```\n\n### Get voucher by code - getVoucherByCode(accessToken, code)\n```js\nconst result = await SDK.getVoucherByCode(accessToken, 'NAklEfbVdV')\n```\n\n### Get list of voucher batches - getVoucherBatches(accessToken)\n```js\nconst result = await SDK.getVoucherBatches(accessToken)\n```\n\n### Get voucher batch by key - getVoucherBatchByKey(accessToken, batchKey)\n```js\nconst result = await SDK.getVoucherBatchByKey(\n    accessToken,\n    'EhQKCE1lcmNoYW50EJXVzd3wraqTORIYCgxWb3VjaGVyQmF0Y2gQxZP495jpsOla'\n)\n```\n\n### Get WeChat User OAuth URL throught Revenue Monster Official Account\n```js\nconst result = await SDK.getWechatOauthUrl(\n    accessToken,\n    'user-defined-redirectUrl'\n)\n```\n\n###  Get Revenue Monster Official Account WeChat User Information By Code\n```js\nconst result = await SDK.getWechatUserByCode(\n    accessToken,\n    'code-you-get-from-wechat-oauth-url'\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frevenuemonster%2Frm-js-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frevenuemonster%2Frm-js-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frevenuemonster%2Frm-js-sdk/lists"}