{
  "info": {
    "name": "ODZreshop Payment API (User) — v2",
    "description": "REST API khusus user/merchant. Set variabel `baseUrl` dan `apiKey` terlebih dahulu.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "apikey",
    "apikey": [
      { "key": "key", "value": "X-API-KEY", "type": "string" },
      { "key": "value", "value": "{{apiKey}}", "type": "string" },
      { "key": "in", "value": "header", "type": "string" }
    ]
  },
  "variable": [
    { "key": "baseUrl", "value": "https://admin.odzreshop.id/api/v2" },
    { "key": "apiKey", "value": "PASTE_API_KEY_HERE" },
    { "key": "reference", "value": "" }
  ],
  "item": [
    {
      "name": "Profile",
      "item": [
        {
          "name": "Get Profile & Saldo",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/profile",
              "host": ["{{baseUrl}}"],
              "path": ["profile"]
            }
          }
        }
      ]
    },
    {
      "name": "Transaksi",
      "item": [
        {
          "name": "Create Transaksi",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "const json = pm.response.json();",
                  "if (json.success && json.data && json.data.reference) {",
                  "    pm.collectionVariables.set('reference', json.data.reference);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"amount\": 10000,\n    \"payment_method\": \"qris\"\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/create-transaksi",
              "host": ["{{baseUrl}}"],
              "path": ["create-transaksi"]
            }
          }
        },
        {
          "name": "Cek Status",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/cek-status?reference={{reference}}",
              "host": ["{{baseUrl}}"],
              "path": ["cek-status"],
              "query": [
                { "key": "reference", "value": "{{reference}}" }
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Webhook (internal, signature)",
      "item": [
        {
          "name": "Payment Callback (qris/va/emoney)",
          "request": {
            "auth": { "type": "noauth" },
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-TIMESTAMP", "value": "2026-08-20T12:00:00+07:00" },
              { "key": "X-SIGNATURE", "value": "<signature-hmac-sha512>" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"partnerReferenceNo\": \"{{reference}}\",\n    \"transactionStatus\": \"SUCCESS\",\n    \"paymentMethod\": \"qris\"\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/webhook",
              "host": ["{{baseUrl}}"],
              "path": ["webhook"]
            }
          }
        }
      ]
    }
  ]
}
