{
  "info": {
    "_postman_id": "c7619735-07f7-4e9c-a24f-urontopay-v1",
    "name": "UrontoPay Payment API",
    "description": "Create a hosted payment link and verify a payment transaction. Keep Client ID, Secret Key, and Brand Key in private Postman environment variables. Never publish real credentials.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "noauth"
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "if (!pm.collectionVariables.get('base_url')) {",
          "  pm.collectionVariables.set('base_url', 'https://pay1.urontopay.com');",
          "}"
        ]
      }
    }
  ],
  "variable": [
    {
      "key": "base_url",
      "value": "https://pay1.urontopay.com",
      "type": "string"
    },
    {
      "key": "client_id",
      "value": "YOUR_CLIENT_ID",
      "type": "secret"
    },
    {
      "key": "secret_key",
      "value": "YOUR_SECRET_KEY",
      "type": "secret"
    },
    {
      "key": "brand_key",
      "value": "YOUR_BRAND_KEY",
      "type": "secret"
    },
    {
      "key": "transaction_id",
      "value": "UP123456",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Payments",
      "item": [
        {
          "name": "Create Payment Link",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              },
              {
                "key": "CLIENT-ID",
                "value": "{{client_id}}",
                "type": "text"
              },
              {
                "key": "SECRET-KEY",
                "value": "{{secret_key}}",
                "type": "text"
              },
              {
                "key": "BRAND-KEY",
                "value": "{{brand_key}}",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"amount\": 500,\n  \"cus_name\": \"Customer Name\",\n  \"cus_email\": \"customer@example.com\",\n  \"success_url\": \"https://merchant.example/payment/success\",\n  \"cancel_url\": \"https://merchant.example/payment/cancel\",\n  \"webhook_url\": \"https://merchant.example/webhooks/urontopay\",\n  \"return_type\": \"GET\",\n  \"metadata\": {\n    \"order_id\": \"ORDER-1001\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/api/payment/create",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "payment",
                "create"
              ]
            },
            "description": "Create a hosted payment link from a trusted server. Redirect the customer to payment_url. Do not mark the local order paid until verification succeeds."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Verification",
      "item": [
        {
          "name": "Verify Transaction",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              },
              {
                "key": "CLIENT-ID",
                "value": "{{client_id}}",
                "type": "text"
              },
              {
                "key": "SECRET-KEY",
                "value": "{{secret_key}}",
                "type": "text"
              },
              {
                "key": "BRAND-KEY",
                "value": "{{brand_key}}",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"transaction_id\": \"{{transaction_id}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/api/payment/verify",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "payment",
                "verify"
              ]
            },
            "description": "Verify from a trusted server. Mark the local order paid only when status is COMPLETED and the amount and metadata match."
          },
          "response": []
        }
      ]
    }
  ]
}
