Package: rmsdk
This is an Python SDK that maps some of the RESTful methods of Open API
that are documented atRevenue Monster Open API
Documentation.Getting StartedInstallationpip3 install rmsdkPrerequisiteBefore using the SDK, users must obtain credentials from merchant portal
first. Clickherefor tutorial.Supported APIsClient Credentials (Authentication)Generate Client CredentialsGenerate Refresh TokenMerchant Related APIsGet Merchant ProfileGet Merchant SubscriptionsStoreGet Store ListGet Store By IDCreate StoreUpdate StoreDelete StoreUserGet User ProfilePayment (Quickpay QR)QuickPayRefundReverseGet All TransactionsGet Transaction By IDGet Transaction By Order IDGet Daily Settlement ReportPayment (Transaction QR)Create TransactionGet TransactionGet Transaction By CodeGet List of Transactions By
CodeLoyaltyGive Loyalty PointGet Loyalty MemberGet List of Loyalty MembersGet Point HistoryVoucherIssue VoucherVoid VoucherGet Voucher By CodeGet Voucher BatchesGet Voucher Batches By Batch
KeyUsageThis section explains the basic usage of the SDK. Detail usage for
individual modules are prepared in theexamplesfolder.Adictionarythat containsclientID,clientSecret,environmentandprivateKey(path to private key) is expected to
passed in as argument. An object of theRMSDKclass will be
instantiated. All modules covered in this SDK will be available under
the instantiated object.For instance, to use the store module, simply,response = client.module.methodName(*args)AuthenticationAuthenticate SDKfrom rmsdk import RMSDK

client = RMSDK(configs={
    "environment": "sandbox", # or production
    "clientID": "client-id",
    "clientSecret": "client-secret",
    "privateKey": "path-to-private-key"
})

accessToken, refreshToken = client.accessToken, client.refreshTokenGenerate Client CredentialsTo get refresh token and access token(expired after 2 hours) with using
provided clientID and clientSecret.client = Auth({
    "environment": "sandbox", # or production
    "clientID": "client-id",
    "clientSecret": "client-secret",
    "privateKey": "path-to-private-key"
})

accessToken, refreshToken = client.clientCredentials()Generate Refresh TokenTo 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.accessToken, refreshToken = client.getRefreshToken(refreshToken)MerchantGet Merchant Profileresult = client.merchant.getMerchantProfile(accessToken)Get Merchant Subscriptionsresult = client.merchant.getMerchantSubcriptions(accessToken)StoreGet Store Listresult = client.store.getStores(accessToken)Get Store By IDresult = client.store.getStoreByID(accessToken, storeID)Create Storeresult = client.store.createStore(accessToken, {
    "name": "Test store",
    "addressLine1": "Earth",
    "addressLine2": "Mars",
    "postCode": "10001",
    "city": "Petaling Jaya",
    "state": "Selangor",
    "country": "Malaysia",
    "countryCode": "60",
    "phoneNumber": "377334080"
})Update Storeresult = client.store.updateStore(accessToken, storeID, {
    "name": "Test store",
    "addressLine1": "Earth",
    "addressLine2": "Mars",
    "postCode": "10001",
    "city": "Petaling Jaya",
    "state": "Selangor",
    "country": "Malaysia",
    "countryCode": "60",
    "phoneNumber": "377334080"
})Delete Storeresult = client.store.deleteStore(accessToken, storeID)UserGet User Profileresult = client.user.getUserProfile(accessToken)Payment (Quickpay QR)QuickPayresult = client.quickPay.quickPay(accessToken, {
    "authCode": "1234567890",
    "order": {
        "amount": 100,
        "currencyType":"MYR",
        "id":"1312331232",
        "title":"title",
        "detail":"desc",
        "additonalData":"API Test"
   },
    "ipAddress": "8.8.8.8",
    "terminalId": "19382734937293999",
    "storeId": "6170506694335521334"
})Refundresult = client.quickPay.refund(accessToken, {
    "transactionId": "190109042809010428940037",
    "refund": {
        "type": "FULL",
        "currencyType": "MYR",
        "amount": 100,
    },
    "reason": "test"
})Reverseresult = client.quickPay.reverse(accessToken, {
    "orderId": "111222333"
})Get All Transactionsresult = client.quickPay.getAllTransactions(accessToken)Get Transaction By IDresult = client.quickPay.getTransactionByID(accessToken, transactionID)Get Transaction By Order IDresult = client.quickPay.getTransactionByOrder(accessToken, orderID)Get Daily Settlement Reportresult = client.quickPay.dailySettlementReport(accessToken, {
    "date": "2019-01-09",
    "method": "WECHATPAY",
    "region": "MALAYSIA",
    "sequence": 1
})Payment (Transaction QR)Create Transactionresult = client.transaction.createTransaction(accessToken, {
    "amount": 100,
    "currencyType": "MYR",
    "expiry": {
        "type": "PERMANENT"
    },
    "isPreFillAmount": True,
    "method": ['WECHATPAY'],
    "order": {
        "details": "Test",
        "title": "Title"
    },
    "redirectUrl": 'https://www.revenuemonster.com',
    "storeId": '1981039839353524638',
    "type": 'DYNAMIC',
})Get Transactionresult = client.transaction.getTransaction(accessToken)Get Transaction By Coderesult = client.transaction.getTransactionByCode(accessToken, qrCode)Get List of Transactions By Coderesult = client.transaction.getTransactionByCode(accessToken, qrCode)LoyaltyGive Loyalty Pointresult = client.loyalty.giveLoyaltyPoint(accessToken, {
    "point": 100,
    "type": "ID",
    "memberId": "7765269777796630408",
    "countryCode": "60",
    "phoneNumber": "172826990"
})Get Loyalty Memberresult = client.loyalty.getLoyaltyMember(accessToken, memberID)Get List of Loyalty Membersresult = client.loyalty.getLoyaltyMembers(accessToken)Get Point HistoryGet Loyalty point history of a memberresult = client.loyalty.getLoyaltyMemberPointHistory(accessToken, memberID)VoucherIssue Voucherresult = client.voucher.issueVoucher(accessToken, batchKey)Void Voucherresult = client.voucher.voidVoucher(accessToken, voucherCode)Get Voucher By Coderesult = client.voucher.getVoucherByCode(accessToken, voucherCode)Get Voucher Batchesresult = client.voucher.getVoucherBatches(accessToken)Get Voucher Batches By Batch Keyresult = client.voucher.getVoucherBatchByKey(accessToken, batchKey)Detail examples can be found atexamples.