You could use this to host your backend services that can house calls to Mastercard Qkr! APIs.
If you are looking to call Qkr! APIs directly then head over to node-qkr-api
If you are looking to build a mobile app using the server APIs then head over to qkr-mobile-app
You can add your API call authentication logic in api.ts marked by
//TODO: Your API Request Authentication Logic
- Bash
export QKR_PUBLIC_KEY="---qkr-public-key---"
export QKR_PRIVATE_KEY="---qkr-private-key---"
export QKR_URL="---qkr-sandbox-or-production-url---"
npm run build && npm start
- Powershell
$env:QKR_PUBLIC_KEY="---qkr-public-key---"
$env:QKR_PRIVATE_KEY="---qkr-private-key---"
$env:QKR_URL="---qkr-sandbox-or-production-url---"
npm run build ; npm start
-Heroku
heroku create yourappserver
heroku config:set NPM_CONFIG_PRODUCTION=false
heroku config:set QKR_PUBLIC_KEY="---qkr-public-key---"
heroku config:set QKR_PRIVATE_KEY="---qkr-private-key---"
heroku config:set QKR_URL="---qkr-sandbox-or-production-url---"
git push heroku master
- Bash
export QKR_PUBLIC_KEY="---qkr-public-key---"
export QKR_PRIVATE_KEY="---qkr-private-key---"
export QKR_URL="---qkr-sandbox-or-production-url---"
export API_KEY_ENABLED="true"
export API_KEY_SOURCE="request"
export API_KEY_NAME="yourKeyName"
export API_KEY_VALUE="yourKeyValue"
npm run build && npm start
- Powershell
$env:QKR_PUBLIC_KEY="---qkr-public-key---"
$env:QKR_PRIVATE_KEY="---qkr-private-key---"
$env:QKR_URL="---qkr-sandbox-or-production-url---"
$env:API_KEY_ENABLED="true"
$env:API_KEY_SOURCE="request"
$env:API_KEY_NAME="yourKeyName"
$env:API_KEY_VALUE="yourKeyValue"
npm run build ; npm start
-Heroku
heroku create yourappserver
heroku config:set NPM_CONFIG_PRODUCTION=false
heroku config:set QKR_PUBLIC_KEY="---qkr-public-key---"
heroku config:set QKR_PRIVATE_KEY="---qkr-private-key---"
heroku config:set QKR_URL="---qkr-sandbox-or-production-url---"
heroku config:set API_KEY_ENABLED="true"
heroku config:set API_KEY_SOURCE="request"
heroku config:set API_KEY_NAME="yourKeyName"
heroku config:set API_KEY_VALUE="yourKeyValue"
git push heroku master
Test Calls (the test folder contains sample test calls as well)
There is also a postman collection of calls that you can directly import from node-qkr-api-server sample postman calls collection
curl --request POST \
--url http://localhost:3000/api/v1/lightbox \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"countryOfResidence":"US","callbackUrl":"myapp://lightbox"}'
curl --request POST \
--url http://localhost:3000/api/v1/login \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"email":"someemail@somedomain.com","pwd":"somepassword99"}'
curl --request POST \
--url http://localhost:3000/api/v1/merchant/list \
--header 'cache-control: no-cache'
curl --request POST \
--url http://localhost:3000/api/v1/product/list \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"id":"155952"}'
curl --request POST \
--url http://localhost:3000/api/v1/cart/add \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"token": "logintoken","request":{"locatedScanId": "155955","outletId": "155942","purchaseNote": "Some note","quantity": 1,"variantId": "155954"}}'
curl --request POST \
--url http://localhost:3000/api/v1/card/list \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"token": "logintoken"}'
curl --request POST \
--url http://localhost:3000/api/v1/cart/list \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"token": "logintoken"}'
curl --request POST \
--url http://localhost:3000/api/v1/cart/checkout \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"token": "logintoken","request":{"amountMinorUnits": "200","cardId": "1","cartId": "1","tipAmount": 0}}'
curl --request POST \
--url http://localhost:3000/api/v1/address/list \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"token": "logintoken"}'
curl --request POST \
--url http://localhost:3000/api/v1/address/add \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"token": "---your-auth-token---","request":{"city": "San Carlos","country": "US","line1": "Mastercard","line2": "959 Skyway Rd","zip": "94070","state": "CA","alias": "somealias","isDefault": "false","recipientName": "John Doe","recipientPhone":"--your-optional-phone-number--","recipientPhoneCountryCode":"1"}}'
curl --request DELETE \
--url http://localhost:3000/api/v1/address/delete \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"token": "logintoken", "id": "---address-id---"}'
- Make sure the partnerTxId is unique per call
curl --request POST \
--url http://localhost:3000/api/v1/express/checkout \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"token": "---your-auth-token---","request":{"amount": "200","cardId": "c0b37d63-4c2b-4677-a956-522761914ee1","description": "some description","outletId":"155942","partnerTxId": "some tx id"}}'
curl --request POST \
--url http://localhost:3000/api/v1/profile \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--data '{"token": "---your-auth-token---","id":"---internalAccountId-from-authresponse---"}'