MyTIX POS adalah aplikasi kasir tiket (POS) dengan frontend static di GitHub Pages dan backend API di Google Apps Script menggunakan Google Sheets sebagai database.
- List produk tiket per kategori.
- Keranjang + checkout tunai + hitung kembalian.
- Simpan transaksi ke Google Sheet.
- Data produk dummy otomatis saat setup awal.
- Cetak struk thermal Bluetooth (Web Bluetooth) dari browser yang support.
| Home | Checkout |
|---|---|
![]() |
![]() |
| Receipt Modal | Payment Flow |
|---|---|
![]() |
![]() |
- Frontend (
index.html) di-host di GitHub Pages. - Frontend memanggil API Apps Script (
/exec?action=...) viafetch. - Apps Script membaca/menulis data ke Google Sheets.
- Printer thermal Bluetooth dipanggil langsung dari browser frontend (bukan dari Apps Script).
- Frontend: HTML, CSS, Vanilla JS.
- Backend API: Google Apps Script (
Code.gs). - Database: Google Sheets.
- Hosting frontend: GitHub Pages.
MyTIX by GAS/
|-- index.html
|-- Code.gs
|-- appsscript.json
`-- README.md
- Buka script.new.
- Isi
Code.gsdanappsscript.jsondari project ini. - Simpan.
- Jalankan
setupDatabase()sekali untuk inisialisasi DB + dummy data. - Deploy sebagai Web App:
Deploy->New deployment- Type:
Web app Execute as:MeWho has access:Anyone/Anyone with the link(sesuai kebutuhan)
- Salin URL deployment
/exec.
Contoh URL:
https://script.google.com/macros/s/AKfycb.../exec
- Buat repository GitHub baru.
- Upload minimal file
index.html. - Di repo:
Settings->Pages. - Source:
Deploy from a branch. - Branch:
main, Folder:/ (root). - Simpan dan tunggu URL GitHub Pages aktif.
Contoh:
https://username.github.io/mytix-pos/
Frontend membaca URL API dari prioritas berikut:
- Query param
?api=... - Global
window.MYTIX_API_EXEC_URL DEFAULT_API_EXEC_URLdiindex.html
Untuk testing printer, frontend juga mendukung override query:
?lang=esc-pos|star-prnt|star-line?cp=epson|xprinter|pos-5890|mpt|star|...?cols=32|35|42|44|48(atur lebar kolom struk)
Edit DEFAULT_API_EXEC_URL di index.html ke URL /exec milikmu.
GET /exec?action=productsResponse:
{
"ok": true,
"data": [
{
"id": "w1",
"category": "wisata",
"name": "Tiket Terusan Dufan",
"price": 275000,
"desc": "Akses penuh ke semua wahana."
}
]
}POST /exec?action=create-transaction
Content-Type: text/plainBody:
{
"action": "create-transaction",
"payload": {
"paymentMethod": "cash",
"cashReceived": 300000,
"items": [
{ "id": "w1", "qty": 1 },
{ "id": "k1", "qty": 2 }
]
}
}GET /exec?action=healthGET /exec?action=setup-dbSaat setup awal, sistem membuat 3 sheet:
products
id | category | name | price | desc | is_active | created_at | updated_at
transactions
transaction_id | created_at | payment_method | total | cash_received | change_amount | line_count | qty_total
transaction_items
transaction_id | product_id | product_name | category | qty | unit_price | subtotal
- Harus dibuka dari halaman HTTPS top-level (GitHub Pages), bukan panel preview Apps Script.
- Gunakan browser yang mendukung Web Bluetooth (umumnya Chrome Android).
- Jika gagal reconnect printer, hubungkan ulang via tombol
Hubungkan Printer Bluetooth.
- Cek URL API
/execbenar. - Cek deployment Apps Script terbaru.
- Cek endpoint
?action=healthdan?action=products.
- Pastikan payload transaksi valid (
cashReceived, item ID, qty). - Cek logs di Apps Script (
Executions).
- Jangan buka app dari iframe/editor panel.
- Buka langsung URL GitHub Pages di tab browser.
- Hard refresh halaman GitHub Pages (
Ctrl+F5) untuk memastikan JS terbaru ter-load. - Reconnect printer lewat tombol
Hubungkan Printer Bluetooth. - Coba pakai override mapping di URL:
https://username.github.io/mytix-pos/?cp=epson
atau:
https://username.github.io/mytix-pos/?cp=xprinter
- Jika printer Star mode, coba set language:
https://username.github.io/mytix-pos/?lang=star-prnt
- Jika hasil cetak kurang proporsional, coba sesuaikan kolom:
https://username.github.io/mytix-pos/?cols=42
atau:
https://username.github.io/mytix-pos/?cols=48
Mau belajar Google Apps Script bareng, diskusi studi kasus, dan upgrade praktik production-ready?
Join WhatsApp Group Komunitas GAS: https://chat.whatsapp.com/HhXHuhvQtQYAnRtR8uCil5



