State maps (activeOrders, notifiedOrders, orderRetryCount, orderMerchantId)
were keyed by the raw order_id in /createtransaksi and /api/payment-links,
but Midtrans webhooks and status checks always report back the sanitized
('.'-joined) order_id. Whenever the original order_id contained characters
Midtrans disallows (e.g. ':'), the two never matched — breaking duplicate/
already-completed detection and retry-suffix lookups. Both endpoints now
key exclusively on the sanitized order_id, with retry-suffix support added
to /api/payment-links for parity with /createtransaksi.
Also add HTTP Basic Auth (requireLogBasicAuth) in front of /api/logs,
/api/logs/files, and /api/logs/files/:filename — these were previously
gated only by LOG_EXPOSE_API, which defaults to true, leaving order data
and transaction details publicly readable with no credentials.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
||
|---|---|---|
| postman | ||
| public | ||
| scripts | ||
| server | ||
| src | ||
| tests | ||
| v4-backup/.bmad-core | ||
| web-bundles | ||
| .gitignore | ||
| README.md | ||
| ecosystem.config.cjs | ||
| eslint.config.js | ||
| index.html | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.cjs | ||
| tailwind.config.ts | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| vite.config.ts | ||
README.md
Core Midtrans CIFO (Frontend)
Frontend Vite + React untuk integrasi Midtrans Core API dengan UI kustom.
Setup
- Duplikasi file contoh env dan isi nilainya:
cp .env.example .env.local
Isi .env.local (lihat .env.example untuk referensi):
VITE_API_BASE_URL=http://localhost:8000/api
VITE_MIDTRANS_CLIENT_KEY=YOUR_CLIENT_KEY
VITE_MIDTRANS_ENV=sandbox
- Jalankan pengembangan:
npm install
npm run dev
App akan tersedia di http://localhost:5173/ (atau port lain jika 5173 dipakai).
Catatan Integrasi Midtrans
- Client Key hanya digunakan di frontend (mis. tokenisasi kartu/3DS). Server Key TIDAK pernah di frontend.
- Semua request ke Midtrans dilakukan lewat backend (
VITE_API_BASE_URL). Frontend memanggil endpoint seperti/payments/:orderId/status. - Status real-time dapat diimplementasikan via polling (TanStack Query) atau SSE/WebSocket dari backend.
Struktur Env di Kode
- Akses env melalui modul
src/lib/env.ts:Env.API_BASE_URLEnv.MIDTRANS_CLIENT_KEYEnv.MIDTRANS_ENV
Lisensi
Internal project skeleton.