Skip to main content

Transactions API

Endpoints untuk mengelola transaksi POS, pembayaran, dan refund.

GET /transactions

List all transactions dengan filtering.
GET /api/v1/transactions?page=1&limit=20&status=completed
Authorization: Bearer {token}
X-Merchant-ID: merchant_abc
Response:
{
  "data": [
    {
      "id": "trx_123",
      "transaction_code": "TRX-20240101-001",
      "total_amount": 250000,
      "status": "completed",
      "payment_method": "cash",
      "created_at": "2024-01-01T10:00:00Z"
    }
  ],
  "meta": { "page": 1, "total": 100 }
}

POST /transactions

Create new transaction.
POST /api/v1/transactions
Authorization: Bearer {token}
X-Merchant-ID: merchant_abc

{
  "items": [
    {
      "product_id": "prod_123",
      "quantity": 2,
      "price": 100000
    }
  ],
  "payment_method": "cash",
  "customer_id": "cust_456"
}

GET /transactions/:id

Get transaction detail.
GET /api/v1/transactions/trx_123
Authorization: Bearer {token}

POST /transactions/:id/refund

Refund transaction.
POST /api/v1/transactions/trx_123/refund
Authorization: Bearer {token}

{
  "reason": "Product defect",
  "amount": 100000
}
Lihat Transaction Flow untuk business logic lengkap.