> For the complete documentation index, see [llms.txt](https://docs.opencityitalia.it/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.opencityitalia.it/stanza-del-cittadino/sviluppatori-e-partner-tecnologici/integrazioni/integrazione-con-intermediari-di-pagamento-pagopa/configurazione-tenant-e-servizi/accesso-tramite-payments-api.md).

# Accesso tramite Payments API

A partire dalla versione 1.2.0, le API dei proxy di pagamento non verrano più chiamate singolarmente per gestire le configurazioni di tenant e servizio. Tutte le chiamate passeranno attraverso le API Payments [qui](https://api.qa.stanzadelcittadino.it/payment-dispatcher/docs) documentate, che funge da **punto di accesso unico** e instrada le richieste verso il proxy corretto.

### Come funziona

Per ogni richiesta di configurazione, il servizio:

1. Riceve la chiamata dal consumer su `/payment-gateways/{gateway}/...`
2. Risolve il gateway in base alla configurazione (`PAYMENT_GATEWAYS`)
3. Costruisce l'URL del proxy: `{PAYMENT_PROXY_BASE_URL}/{gateway}/{versione}`
4. Inoltra la richiesta (metodo HTTP, body, header `Authorization` se presente)
5. Restituisce la risposta del proxy invariata — status code e body as-is

{% hint style="info" %}
Il comportamento delle API di tenant e configurazione non cambia: schema dei campi, metodi HTTP e risposte sono quelli definiti in API v2. Cambia solo il punto di ingresso.
{% endhint %}

### Endpoint disponibili

**Gateway**

| Metodo | Path                | Descrizione                   |
| ------ | ------------------- | ----------------------------- |
| `GET`  | `/payment-gateways` | Lista dei gateway configurati |

**Tenant**

| Metodo   | Path                                         | Descrizione                                   |
| -------- | -------------------------------------------- | --------------------------------------------- |
| `GET`    | `/payment-gateways/{gateway}/tenants/schema` | Schema dei campi per la configurazione tenant |
| `POST`   | `/payment-gateways/{gateway}/tenants`        | Crea una nuova configurazione tenant          |
| `GET`    | `/payment-gateways/{gateway}/tenants/{id}`   | Legge una configurazione tenant               |
| `PUT`    | `/payment-gateways/{gateway}/tenants/{id}`   | Aggiorna una configurazione tenant            |
| `PATCH`  | `/payment-gateways/{gateway}/tenants/{id}`   | Aggiornamento parziale                        |
| `DELETE` | `/payment-gateways/{gateway}/tenants/{id}`   | Disattiva una configurazione tenant           |

**Configurazione pagamento**

| Metodo   | Path                                         | Descrizione                                      |
| -------- | -------------------------------------------- | ------------------------------------------------ |
| `GET`    | `/payment-gateways/{gateway}/configs/schema` | Schema dei campi per la configurazione pagamento |
| `POST`   | `/payment-gateways/{gateway}/configs`        | Crea una nuova configurazione                    |
| `GET`    | `/payment-gateways/{gateway}/configs/{id}`   | Legge una configurazione                         |
| `PUT`    | `/payment-gateways/{gateway}/configs/{id}`   | Aggiorna una configurazione                      |
| `PATCH`  | `/payment-gateways/{gateway}/configs/{id}`   | Aggiornamento parziale                           |
| `DELETE` | `/payment-gateways/{gateway}/configs/{id}`   | Disattiva una configurazione                     |

### Risposte di errore

| Status                         | Quando                                            |
| ------------------------------ | ------------------------------------------------- |
| `404 application/problem+json` | Il gateway non è tra quelli in `PAYMENT_GATEWAYS` |
| `502 application/problem+json` | Il payment-proxy downstream non è raggiungibile   |

{% hint style="warning" %}
Gli errori restituiti dal proxy downstream (es. `400`, `422`) vengono inoltrati al chiamante così come sono.
{% endhint %}

### Autenticazione

L'header `Authorization` viene inoltrato al proxy downstream se presente. La sua assenza non genera un errore `401`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.opencityitalia.it/stanza-del-cittadino/sviluppatori-e-partner-tecnologici/integrazioni/integrazione-con-intermediari-di-pagamento-pagopa/configurazione-tenant-e-servizi/accesso-tramite-payments-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
