Skip to content

A simple Node.js service that connect to SCB OpenAPI that covered most of use cases

License

Notifications You must be signed in to change notification settings

ayuthmang/scb-openapi-oh-my-merchant-service

Repository files navigation

oh-my-merchant-service

What is this project?

diagram

This is just a POC of the service that uses the SCB Open Banking API Document to

  • Login and generate the token.
  • Create a QR code for payment (C Scan B).
  • Slip Verification.
  • B Scan C payment.

We recommended using with Somjai Application.

The project structure was inspired by rails.

System requirements

  • Node v12.16.2

Dev requirements

  • Postman - for testing an endpoint.
  • ngrok - for exposing the local service to a public URL.
  • nvm - for switching between node versions.

Setup and config

To start the system, you need to create an account and the app in SCB Open Banking API Document, because we need several fields such as API_KEY, API_SECRET, BILLER_ID, MERCHANT_ID, MERCHANT_TERMINAL_ID.

Config the service

After we registered an account and created an application in https://developer.scb/. We'll need to config several fields that we mention above.

To start, just copy .env.example to .env and change the field that has the prefix <Your ...> to yours.

# Application
SCB_API_KEY=<Your API KEY>
SCB_API_SECRET=<Your API SECRET>
SCB_API_BASE_URL=https://api-sandbox.partners.scb # No need to change

# Biller Information
SCB_BILLER_ID=<Your Biller ID>

# Merchant Information
SCB_MERCHANT_ID=<Your Merchant ID>
SCB_MERCHANT_TERMINAL_ID=<Your Terminal ID>

Start a development server

The development server is including the debug log that we do not include in production mode.

$ yarn dev
# or
$ npm run dev

Start a server

$ yarn start
# or
$ npm run start

Production deployment

In the demonstration, we are using the Heroku to deploy and do CI/CD.

To use a project in production, we have many concerns, for example, some request body validation, validation token, and database to store a transaction id or token. You'll need to put some effort to make it ready to use in production.

We recommended reading the Futher reading section.

Postman collection

Postman collection available here, docs/postman

Further reading

Express

SCB Open Banking API

Socket.io

Heroku


Made with ❤️ by Ayuth Mangmesap.

About

A simple Node.js service that connect to SCB OpenAPI that covered most of use cases

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published