{
  "info": {
    "name": "Link de pagamento - V2",
    "description": "Link de pagamento no API Gateway (api-h em homologação, api em produção). Login client_credentials e rotas /api/v2/checkout. Não chame o host da Minha Conta. Sem secrets reais: preencha as variáveis.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://api-h.nuvende.com.br" },
    { "key": "clientId", "value": "" },
    { "key": "clientSecret", "value": "" },
    { "key": "accessToken", "value": "" },
    { "key": "checkoutId", "value": "" },
    { "key": "notificationSecret", "value": "" }
  ],
  "item": [
    {
      "name": "Login",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Content-Type", "value": "application/x-www-form-urlencoded" }
        ],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            { "key": "grant_type", "value": "client_credentials" },
            { "key": "scope", "value": "checkout.read checkout.write" }
          ]
        },
        "auth": {
          "type": "basic",
          "basic": [
            { "key": "username", "value": "{{clientId}}" },
            { "key": "password", "value": "{{clientSecret}}" }
          ]
        },
        "url": "{{baseUrl}}/api/v2/auth/login"
      }
    },
    {
      "name": "Criar checkout",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Accept", "value": "application/json" },
          { "key": "Content-Type", "value": "application/json" },
          { "key": "Authorization", "value": "Bearer {{accessToken}}" }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"reference_id\": \"PEDIDO-123\",\n  \"amount\": 15000,\n  \"due_date\": \"2026-09-20\",\n  \"payment_methods\": [{ \"type\": \"PIX\" }],\n  \"customer\": {\n    \"name\": \"Maria Silva\",\n    \"tax_id\": \"00000000000\"\n  },\n  \"redirect_url\": \"https://loja.exemplo/retorno\",\n  \"notification_url\": \"https://loja.exemplo/hooks/checkout\",\n  \"notification_secret\": \"{{notificationSecret}}\"\n}"
        },
        "url": "{{baseUrl}}/api/v2/checkout"
      }
    },
    {
      "name": "Consultar checkout",
      "request": {
        "method": "GET",
        "header": [
          { "key": "Accept", "value": "application/json" },
          { "key": "Authorization", "value": "Bearer {{accessToken}}" }
        ],
        "url": "{{baseUrl}}/api/v2/checkout/{{checkoutId}}"
      }
    },
    {
      "name": "Inativar checkout",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Accept", "value": "application/json" },
          { "key": "Authorization", "value": "Bearer {{accessToken}}" }
        ],
        "url": "{{baseUrl}}/api/v2/checkout/{{checkoutId}}/inactivate"
      }
    }
  ]
}
