Skip to content

ariqpradipa/dynamic-qris

Repository files navigation

Dynamic QRIS Converter

A serverless project to convert static QRIS codes to dynamic QRIS codes using Cloudflare Workers or AWS Lambda.

What is QRIS?

QRIS (Quick Response Code Indonesian Standard) is a unified QR code payment system in Indonesia.

Static QRIS

Static QRIS is a fixed QR code that can be used repeatedly. The payment amount is not embedded, so customers must manually enter the amount. Ideal for small businesses like food stalls or shops.

Characteristics:

  • Fixed code, reusable for multiple transactions
  • Customers input amount manually
  • Low operational cost, no additional devices needed
  • Less accurate for automatic transaction recording

Dynamic QRIS

Dynamic QRIS generates a unique QR code for each transaction with the amount embedded. Customers don't need to input the amount manually. Used by modern businesses with digital systems for automatic transaction recording.

Characteristics:

  • Unique QR code per transaction
  • Safer and faster, reduces incorrect payment risk
  • Easier digital tracking and recording
  • Usually displayed on receipts or cashier screens

API Usage

Convert Static to Dynamic QRIS

Endpoint: GET /api/convert

Query Parameters:

  • qris-data (required): The static QRIS string
  • amount (required): The transaction amount (e.g., "10000")
  • image (optional): Include QR code image in response (default: "true")
  • size (optional): QR code image size in pixels (default: "256")

Example Request:

GET /api/convert?qris-data=00020101021126580014ID.CO.QRIS.WWW0215ID20200123456780303UME51440014ID.CO.QRIS.WWW0215ID20200123456780303UME5204839853033605802ID5921Nama%20Merchant%20Test6013Kota%20Test6105123456212012345678906304ABCD&amount=50000

Example Response:

{
  "originalQris": "00020101021126580014ID.CO.QRIS.WWW0215ID20200123456780303UME51440014ID.CO.QRIS.WWW0215ID20200123456780303UME5204839853033605802ID5921Nama%20Merchant%20Test6013Kota%20Test6105123456212012345678906304ABCD",
  "amount": "50000",
  "dynamicQris": "00020101021226580014ID.CO.QRIS.WWW0215ID20200123456780303UME51440014ID.CO.QRIS.WWW0215ID20200123456780303UME5204839853033605406500005802ID5921Nama%20Merchant%20Test6013Kota%20Test6105123456212012345678906304XXXX",
  "dynamicQrisQRCodeBase64": "PHN2ZyB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiIgdmlld0JveD0iMCAwIDI1NiAyNTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2IiBmaWxsPSIjZmZmZmZmIi8+CjxwYXRoIGQ9Ik0gMjQgMjRoMjA4djIwOEgyNFoiIGZpbGw9IiMwMDAwMDAiLz4KPHBhdGggZD0iTTI0IDI0aDIwOHYyMDhIMjRaIiBmaWxsPSIjZmZmZmZmIi8+Cjwvc3ZnPg=="
}

Development

npm install
npm run dev

Deployment

npm run deploy

For generating/synchronizing types based on your Worker configuration run:

npm run cf-typegen

Pass the CloudflareBindings as generics when instantiating Hono:

// src/index.ts
const app = new Hono<{ Bindings: CloudflareBindings }>()

About

A serverless project to convert static QRIS codes to dynamic QRIS codes. Dynamic QRIS generates a unique QR code for each transaction with the amount embedded. Customers don't need to input the amount manually.

Topics

Resources

License

Stars

Watchers

Forks

Contributors