Salta ai contenuti

Avvio rapido Portogallo

Questo avvio rapido descrive i passaggi essenziali per iniziare a utilizzare l’API SIGN PT, dall’autenticazione alla creazione del primo documento fiscale. Per una guida più dettagliata, consultate la nostra guida all’integrazione.

  • Un account fiskaly (registratevi su hub.fiskaly.com)
  • Una chiave API e un segreto per un’organizzazione GROUP nell’ambiente TEST
  • Credenziali dell’utente secondario AT Portal das Finanças per il contribuente (credenziali reali richieste solo in LIVE)
  1. Autenticarsi

    curl -X POST https://test.api.fiskaly.com/tokens \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -d '{
        "content": {
          "type": "API_KEY",
          "key": "YOUR_API_KEY",
          "secret": "YOUR_API_SECRET"
        }
      }'
  2. Creare un'Organizzazione UNIT

    curl -X POST https://test.api.fiskaly.com/organizations \
      -H "Authorization: Bearer ${ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -d '{
        "content": {
          "type": "UNIT",
          "name": "My Portuguese Merchant"
        }
      }'
  3. Creare una chiave API Subject e autenticarsi

    Create una chiave API per la UNIT, quindi autenticatevi con essa:

    # Create Subject API Key (scoped to the `UNIT`)
    curl -X POST https://test.api.fiskaly.com/subjects \
      -H "Authorization: Bearer ${ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -H "X-Scope-Identifier: ${ORG_ID}" \
      -d '{"content": {"type": "API_KEY"}}'
    
    # Authenticate with the new API Key
    curl -X POST https://test.api.fiskaly.com/tokens \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -d '{"content": {"type": "API_KEY", "key": "NEW_KEY", "secret": "NEW_SECRET"}}'
  4. Creare Contribuente, Sede e Sistema

    # Create Taxpayer
    curl -X POST https://test.api.fiskaly.com/taxpayers \
      -H "Authorization: Bearer ${ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -d '{
        "content": {
          "type": "COMPANY",
          "name": {
            "legal": "Minha Empresa Lda."
          },
          "address": {
            "line": {
              "type": "STREET_NUMBER",
              "street": "Rua Augusta",
              "number": "28"
            },
            "code": "1100-053",
            "city": "Lisboa",
            "country": "PT"
          },
          "fiscalization": {
            "type": "PT",
            "tax_id_number": "512345678",
            "email": "fiscal@minhaempresa.pt",
            "registration": {
              "capital": "50000.00",
              "office": "CRC Lisboa",
              "other": "sob NIF 512345678"
            },
            "credentials": {
              "type": "AT",
              "username": "512345678/3",
              "password": "YOUR_AT_PASSWORD"
            }
          }
        }
      }'
    
    # Commission Taxpayer
    curl -X PATCH "https://test.api.fiskaly.com/taxpayers/${TAXPAYER_ID}" \
      -H "Authorization: Bearer ${ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -d '{"content": {"state": "COMMISSIONED"}}'
  5. Creare il primo Record

    I Record richiedono due chiamate: una INTENTION seguita da una TRANSACTION.

    # Part A: Intention
    curl -X POST https://test.api.fiskaly.com/records \
      -H "Authorization: Bearer ${ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -d '{
        "content": {
          "type": "INTENTION",
          "system": {"id": "YOUR_SYSTEM_ID"},
          "operation": {"type": "TRANSACTION"}
        }
      }'
    
    # Part B: Transaction
    curl -X POST https://test.api.fiskaly.com/records \
      -H "Authorization: Bearer ${ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -d '{
        "content": {
          "type": "TRANSACTION",
          "record": {"id": "YOUR_INTENTION_ID"},
          "operation": {
            "type": "RECEIPT",
            "document": {
              "number": "FS-2026/00001",
              "series": "FS-2026",
              "total_vat": {
                "amount": "2.30",
                "exclusive": "10.00",
                "inclusive": "12.30"
              }
            },
            "entries": [
              {
                "type": "SALE",
                "data": {
                  "type": "ITEM",
                  "text": "Product A",
                  "unit": {"quantity": "1.00", "price": "10.00"},
                  "value": {"base": "10.00"},
                  "vat": {
                    "type": "VAT_RATE",
                    "code": "STANDARD",
                    "percentage": "23.00",
                    "amount": "2.30",
                    "exclusive": "10.00",
                    "inclusive": "12.30"
                  }
                },
                "details": {"concept": "GOOD"}
              }
            ],
            "payments": [
              {
                "type": "CASH",
                "details": {"amount": "12.30", "currency": "EUR"}
              }
            ]
          }
        }
      }'

    Una volta che il Record raggiunge lo stato COMPLETED, SIGN PT restituisce il payload di conformità per la stampa: codice ATCUD, contenuto del codice QR, estratto hash e numero di certificato del software.

Was this page helpful?