{"openapi":"3.0.3","info":{"title":"Kanan Bayar API","version":"1.9.0","description":"External REST API Kanan Bayar untuk merchant, mutasi, QRIS, hosted payment, invoice, produk/varian, outlet, customer, POS, API usage, dan reconciliation. Stateless, CORS-ready, Bearer/X-API-Key authentication, webhook HMAC, dan idempotency."},"servers":[{"url":"https://bayar.kanan.id/api/v1"}],"tags":[{"name":"Account"},{"name":"Merchant"},{"name":"Transactions"},{"name":"Payments"},{"name":"Invoices"},{"name":"Finance"}],"paths":{"/ping":{"get":{"summary":"Health check API publik","description":"Tidak membutuhkan API key. Gunakan untuk memverifikasi TLS, routing, dan availability dari sistem eksternal.","security":[],"responses":{"200":{"description":"API dapat dijangkau","content":{"application/json":{"schema":{"type":"object"},"example":{"success":true,"data":{"service":"Kanan Bayar API","version":"1.9.0","status":"ok","time":"2026-10-05T13:30:00+07:00","request_id":"req_c8f1..."}}}}}}},"options":{"summary":"CORS preflight","security":[],"responses":{"204":{"description":"Preflight accepted"}}}},"/account/usage":{"get":{"summary":"Paket dan kuota akun","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"},"example":{"success":true,"data":{"plan":{"code":"pro","name":"Pro","price_monthly":299000},"usage":{"merchants":{"used":1,"limit":10},"transactions":{"used":84,"limit":10000},"api_requests":{"used":1472,"limit":100000}},"reset_at":"2026-11-01T00:00:00+07:00"}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Scope: `account:read`."}},"/account/api-usage":{"get":{"summary":"API usage metrics","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"},"example":{"success":true,"data":{"days":30,"daily":[{"day":"2026-10-05","requests":128,"errors":2,"avg_ms":94}],"routes":[{"route":"/api/v1/payments","method":"POST","requests":48,"errors":1,"avg_ms":132}]}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Scope: `account:read`.","parameters":[{"name":"days","in":"query","required":false,"description":"7-90 hari","schema":{"type":"integer"},"example":30}]}},"/merchants":{"get":{"summary":"Daftar merchant dan token health","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"},"example":{"success":true,"data":[{"id":"mer_3Q0K7Pz7c8xA2F5mS7pLVA","name":"DeltaNet","status":"active","token_status":"valid","last_token_check_at":"2026-10-05 13:25:12","connected_at":"2026-10-05 09:18:44","last_sync_at":"2026-10-05 13:29:41"}]}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Scope: `merchants:read`."}},"/transactions":{"get":{"summary":"Daftar mutasi masuk","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"},"example":{"success":true,"data":[{"transaction_id":"01a109ba-9428-7000-a121-5e997b3e4331","order_id":"QRIS-0220261005014305QykVUCzAuaID","merchant":{"id":"mer_3Q0K7Pz7c8xA2F5mS7pLVA","name":"DeltaNet"},"amount":10000,"status":"settlement","issuer":"BCA","transaction_time":"2026-10-05T08:43:05+07:00"}],"meta":{"page":1,"per_page":50,"total":1,"pages":1}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Scope: `transactions:read`.","parameters":[{"name":"merchant","in":"query","required":false,"description":"Merchant public ID","schema":{"type":"string"},"example":"mer_3Q0K7Pz7c8xA2F5mS7pLVA"},{"name":"from","in":"query","required":false,"description":"YYYY-MM-DD","schema":{"type":"string"},"example":"2026-10-01"},{"name":"to","in":"query","required":false,"description":"YYYY-MM-DD","schema":{"type":"string"},"example":"2026-10-05"},{"name":"page","in":"query","required":false,"description":"Halaman","schema":{"type":"integer"},"example":1},{"name":"per_page","in":"query","required":false,"description":"1-100","schema":{"type":"integer"},"example":50}]}},"/qris":{"post":{"summary":"Buat QRIS langsung","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"201":{"description":"QRIS dibuat","content":{"application/json":{"schema":{"type":"object"},"example":{"success":true,"data":{"qris_id":"qris_xxx","trx_id":"trx_xxx","qris_code":"00020101021226...6304ABCD","amount":12000,"expires_at":"2026-10-05T13:36:00+07:00"}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Scope: `qris:create`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["merchant_id","amount"],"properties":{"merchant_id":{"type":"string","description":"Public merchant ID berformat mer_... dari GET /merchants. Bukan GoBiz Merchant ID G..."},"amount":{"type":"integer","minimum":1000,"description":"Nominal dalam Rupiah integer. Contoh 12000 = Rp12.000."}}},"example":{"merchant_id":"mer_3Q0K7Pz7c8xA2F5mS7pLVA","amount":12000}}}}}},"/payments":{"get":{"summary":"Daftar/cari hosted payment","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"},"example":{"success":true,"data":[{"id":"pay_58I_RSoy3OofBIh0pCbBig","reference_id":"KB-261005-E6CC1A7CDF","order_id":"ORDER-20261005-0001","external_id":"INV-CLIENT-001","amount":12000,"status":"paid","payment_url":"https://bayar.kanan.id/bayar/pay_58I_RSoy3OofBIh0pCbBig","expires_at":"2026-10-05T13:40:00+07:00","paid_at":"2026-10-05T13:37:21+07:00"}],"meta":{"page":1,"per_page":50,"total":1,"pages":1}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Scope: `payments:read`.","parameters":[{"name":"merchant","in":"query","required":false,"description":"Merchant public ID","schema":{"type":"string"},"example":"mer_3Q0K7Pz7c8xA2F5mS7pLVA"},{"name":"order_id","in":"query","required":false,"description":"Order ID milik sistem pengguna","schema":{"type":"string"},"example":"ORDER-20261005-0001"},{"name":"external_id","in":"query","required":false,"description":"External ID legacy/opsional","schema":{"type":"string"},"example":"INV-CLIENT-001"},{"name":"status","in":"query","required":false,"description":"pending|paid|expired|cancelled","schema":{"type":"string"},"example":"paid"},{"name":"page","in":"query","required":false,"description":"Halaman","schema":{"type":"integer"},"example":1},{"name":"per_page","in":"query","required":false,"description":"1-100","schema":{"type":"integer"},"example":50}]},"post":{"summary":"Buat hosted payment + invoice","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"201":{"description":"Payment dibuat/idempotent","content":{"application/json":{"schema":{"type":"object"},"example":{"success":true,"data":{"id":"pay_58I_RSoy3OofBIh0pCbBig","reference_id":"KB-261005-E6CC1A7CDF","order_id":"ORDER-20261005-0001","external_id":"INV-CLIENT-001","amount":12000,"status":"pending","payment_url":"https://bayar.kanan.id/bayar/pay_58I_RSoy3OofBIh0pCbBig","invoice":{"id":"inv_xxx","number":"INV-2610-000004","url":"https://bayar.kanan.id/invoice/inv_xxx"},"expires_at":"2026-10-05T13:40:00+07:00","paid_at":null,"qris_code":"00020101021226...6304ABCD"}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Scope: `payments:create`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["merchant_id","order_id","amount"],"properties":{"merchant_id":{"type":"string","example":"mer_xxx","description":"Public merchant ID berformat mer_... dari GET /merchants. Bukan GoBiz Merchant ID G..."},"order_id":{"type":"string","maxLength":100,"example":"ORDER-20260825-0001"},"external_id":{"type":"string","maxLength":100},"amount":{"type":"integer","example":25000,"description":"Nominal dalam Rupiah integer. Contoh 12000 = Rp12.000."},"description":{"type":"string"},"customer_name":{"type":"string"},"customer_phone":{"type":"string"},"expiration_minutes":{"type":"integer","minimum":1},"callback_url":{"type":"string","format":"uri","description":"HTTPS public port 443 only"},"callback_secret":{"type":"string","minLength":16,"maxLength":128}}},"example":{"merchant_id":"mer_3Q0K7Pz7c8xA2F5mS7pLVA","order_id":"ORDER-20261005-0001","external_id":"INV-CLIENT-001","amount":12000,"description":"Internet Oktober","customer_name":"Budi","customer_phone":"6281234567890","expiration_minutes":5,"callback_url":"https://app.example.com/callback/kanan-bayar","callback_secret":"replace-with-random-secret-32chars"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Fallback order_id/idempotency token jika body tidak mengirim order_id/external_id. 1-100 karakter: A-Z a-z 0-9 . _ : -","schema":{"type":"string","maxLength":100},"example":"ORDER-20261005-0001"}]}},"/payments/{id}":{"get":{"summary":"Detail hosted payment","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"},"example":{"success":true,"data":{"id":"pay_58I_RSoy3OofBIh0pCbBig","reference_id":"KB-261005-E6CC1A7CDF","order_id":"ORDER-20261005-0001","external_id":"INV-CLIENT-001","amount":12000,"status":"paid","payment_url":"https://bayar.kanan.id/bayar/pay_58I_RSoy3OofBIh0pCbBig","invoice":{"id":"inv_xxx","number":"INV-2610-000004","url":"https://bayar.kanan.id/invoice/inv_xxx"},"expires_at":"2026-10-05T13:40:00+07:00","paid_at":"2026-10-05T13:37:21+07:00"}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Scope: `payments:read`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^pay_"},"example":"pay_58I_RSoy3OofBIh0pCbBig"}]}},"/payments/{id}/check":{"post":{"summary":"Cek manual status hosted payment","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"},"example":{"success":true,"data":{"id":"pay_58I_RSoy3OofBIh0pCbBig","reference_id":"KB-261005-E6CC1A7CDF","order_id":"ORDER-20261005-0001","external_id":"INV-CLIENT-001","amount":12000,"status":"paid","payment_url":"https://bayar.kanan.id/bayar/pay_58I_RSoy3OofBIh0pCbBig","invoice":{"id":"inv_xxx","number":"INV-2610-000004","url":"https://bayar.kanan.id/invoice/inv_xxx"},"expires_at":"2026-10-05T13:40:00+07:00","paid_at":"2026-10-05T13:37:21+07:00","check":{"status":"paid"}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Scope: `payments:check`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^pay_"},"example":"pay_58I_RSoy3OofBIh0pCbBig"}]}},"/invoices":{"get":{"summary":"Daftar invoice","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"},"example":{"success":true,"data":[{"id":"inv_xxx","number":"INV-2610-000004","order_id":"ORDER-20261005-0001","reference_id":"KB-261005-E6CC1A7CDF","status":"paid","total":12000,"payment_id":"pay_58I_RSoy3OofBIh0pCbBig"}],"meta":{"page":1,"per_page":50,"total":1,"pages":1}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Scope: `payments:read`.","parameters":[{"name":"merchant","in":"query","required":false,"description":"Merchant public ID","schema":{"type":"string"},"example":"mer_3Q0K7Pz7c8xA2F5mS7pLVA"},{"name":"order_id","in":"query","required":false,"description":"Order ID","schema":{"type":"string"},"example":"ORDER-20261005-0001"},{"name":"status","in":"query","required":false,"description":"unpaid|paid|expired|cancelled","schema":{"type":"string"},"example":"paid"},{"name":"page","in":"query","required":false,"description":"Halaman","schema":{"type":"integer"},"example":1},{"name":"per_page","in":"query","required":false,"description":"1-100","schema":{"type":"integer"},"example":50}]}},"/invoices/{id}":{"get":{"summary":"Detail invoice","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"},"example":{"success":true,"data":{"id":"inv_xxx","number":"INV-2610-000004","order_id":"ORDER-20261005-0001","reference_id":"KB-261005-E6CC1A7CDF","merchant":{"id":"mer_3Q0K7Pz7c8xA2F5mS7pLVA","name":"DeltaNet"},"payment_id":"pay_58I_RSoy3OofBIh0pCbBig","status":"paid","total":12000,"issue_date":"2026-10-05","due_at":"2026-10-05T13:40:00+07:00","paid_at":"2026-10-05T13:37:21+07:00","url":"https://bayar.kanan.id/invoice/inv_xxx","pdf_url":"https://bayar.kanan.id/invoice/inv_xxx/pdf","description":"Internet Oktober","items":[]}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Scope: `payments:read`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^inv_"},"example":"inv_3Q0K7Pz7c8xA2F5mS7pLVA"}]}},"/reconciliation":{"get":{"summary":"Ringkasan rekonsiliasi payment vs mutasi","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"},"example":{"success":true,"data":{"merchant":{"id":"mer_3Q0K7Pz7c8xA2F5mS7pLVA","name":"DeltaNet"},"period":{"from":"2026-10-01","to":"2026-10-31"},"gross":447000,"matched_amount":420000,"unmatched_payment_amount":12000,"unmatched_transaction_amount":15000,"matched_count":18,"unmatched_payment_count":1,"unmatched_transaction_count":2}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Scope: `transactions:read`.","parameters":[{"name":"merchant","in":"query","required":true,"description":"Merchant public ID","schema":{"type":"string"},"example":"mer_3Q0K7Pz7c8xA2F5mS7pLVA"},{"name":"from","in":"query","required":false,"description":"YYYY-MM-DD","schema":{"type":"string"},"example":"2026-10-01"},{"name":"to","in":"query","required":false,"description":"YYYY-MM-DD","schema":{"type":"string"},"example":"2026-10-05"}]}},"/products":{"get":{"summary":"Daftar produk dan varian","description":"Scope: `products:read`.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"422":{"description":"Validation error"},"429":{"description":"Rate limited"}},"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active","inactive","all"]},"example":"active"},{"name":"outlet_id","in":"query","required":false,"schema":{"type":"string"},"example":"out_xxx"}]},"post":{"summary":"Tambah produk","description":"Scope: `products:write`.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"422":{"description":"Validation error"},"429":{"description":"Rate limited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"name":"Kopi Susu","price":18000,"sku":"KOPI","outlet_id":"out_xxx","track_stock":false}}}}}},"/products/{id}":{"post":{"summary":"Ubah produk","description":"Scope: `products:write`.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"422":{"description":"Validation error"},"429":{"description":"Rate limited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"name":"Kopi Susu","price":19000,"status":"active"}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"prd_xxx"}]}},"/products/{id}/variants":{"post":{"summary":"Tambah varian produk","description":"Scope: `products:write`.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"422":{"description":"Validation error"},"429":{"description":"Rate limited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"name":"Large","price":23000,"sku":"KOPI-L","barcode":"899000000001","track_stock":true,"stock_qty":25,"min_stock":5}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"prd_xxx"}]}},"/variants/{id}":{"post":{"summary":"Ubah varian produk","description":"Scope: `products:write`.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"422":{"description":"Validation error"},"429":{"description":"Rate limited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"price":24000,"status":"active"}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"var_xxx"}]}},"/outlets":{"get":{"summary":"Daftar outlet","description":"Scope: `outlets:read`.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"422":{"description":"Validation error"},"429":{"description":"Rate limited"}}},"post":{"summary":"Tambah outlet","description":"Scope: `outlets:write`.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"422":{"description":"Validation error"},"429":{"description":"Rate limited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"merchant_id":"mer_xxx","name":"Cabang Dago","code":"DGO","address":"Bandung","phone":"081234567890"}}}}}},"/outlets/{id}":{"post":{"summary":"Ubah outlet","description":"Scope: `outlets:write`.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"422":{"description":"Validation error"},"429":{"description":"Rate limited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"name":"Cabang Dago","status":"active"}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"out_xxx"}]}},"/customers":{"get":{"summary":"Daftar customer","description":"Scope: `customers:read`.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"422":{"description":"Validation error"},"429":{"description":"Rate limited"}}},"post":{"summary":"Tambah customer","description":"Scope: `customers:write`.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"422":{"description":"Validation error"},"429":{"description":"Rate limited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"name":"Budi","phone":"081234567890","external_id":"CUST-001"}}}}}},"/customers/{id}":{"post":{"summary":"Ubah customer","description":"Scope: `customers:write`.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"422":{"description":"Validation error"},"429":{"description":"Rate limited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"name":"Budi Santoso","status":"active"}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"cus_xxx"}]}},"/pos/payments":{"post":{"summary":"Buat transaksi POS","description":"Scope: `pos:create`.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"422":{"description":"Validation error"},"429":{"description":"Rate limited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"merchant_id":"mer_xxx","outlet_id":"out_xxx","customer_id":"cus_xxx","order_id":"POS-EXT-000123","items":[{"product_id":"prd_xxx","variant_id":"var_xxx","qty":2},{"product_id":"prd_yyy","qty":1}],"discount_type":"percent","discount_value":10,"expiration_minutes":5}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"Authorization: Bearer kb_live_..."},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Fallback untuk proxy/hosting yang tidak meneruskan Authorization."}},"schemas":{"Error":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}},"request_id":{"type":"string"}},"example":{"success":false,"error":{"code":"validation_error","message":"Parameter tidak valid.","request_id":"req_c8f1..."}}}}}}