# Payment protection

> In four steps, say who can receive the store's money, how the SDK should react, what is normal at checkout and which extra fields to watch.

URL: https://docs.proteside.com/en/docs/guide/settings/payment-protection

**Settings → Payment protection** defines how the SDK behaves on the selected store's checkout. The screen is split
into four numbered steps:

1. **Who can receive your money**: the trusted recipients.
2. **How the SDK should react**: monitor or block.
3. **What is normal at your checkout**: expected payment providers, GTM containers and service workers.
4. **Detected payment methods**: what the SDK has already recognized and the extra fields to watch.

Changes reach your pages through the SDK's remote configuration, without touching your site, with one exception: the
[release channel](#canal-de-release-do-sdk). The technical details are in
[Configuration](https://docs.proteside.com/en/docs/integration/configuration).

## Before you start
* Only **owners** and **admins** can change this screen. The other roles see everything, but without the edit
  buttons, and the banner at the top says "Only owners and admins can change these settings."
* **Recipients** (step 1) are saved immediately.
* Steps 2, 3 and 4 are saved separately. Each one has its own **Save this step** button and shows **Saved** or
  **Changed · not saved**. Save a step before leaving the screen.
* Changes reach the SDK within a few minutes. To test a change, wait a few minutes and reload the checkout. Every
  saved change is recorded in the [Audit log](https://docs.proteside.com/en/docs/guide/settings/audit-log).

## Who can receive your money
*Image: How the check works (1), recipients seen (2), trusted recipients (3) and manual registration (4).*

Trusted recipients are the keys and accounts that receive your store's payments. The SDK checks the recipient of every
Pix, boleto, QR or wallet shown at checkout and raises an alert when someone outside the list appears.

With no recipient registered, the SDK records who shows up at checkout but does not alert on unknown recipients. That's
why this is the most important step on the screen.

**How the check works** (1) opens a summary of how the recipient is checked for each type of code.

### Confirm the recipients seen at checkout
The **Recipients seen at your checkout** list (2) shows the recipients the SDK found at checkout that you haven't
confirmed yet. For each one you see the method, the masked recipient, how many times it was seen and when.

* Click **It is my store** to add it to the trusted recipients list.
* Click **I don't recognize it** if the recipient isn't yours. This opens a critical **Recipient not recognized**
  alert in [Alerts](https://docs.proteside.com/en/docs/guide/alerts). Treat it as an incident.

If the list is empty, place a test order at checkout: the recipient shows up right after.

> **Pix generated by a payment provider**
>
> When the store's Pix is generated by a provider (Mercado Pago, Pagar.me, PagBank and others), the key used in the
> code is usually not the one you know. In that case, confirm what shows up under **Recipients seen at your checkout**
> instead of registering the key by hand.

### Trusted recipients
The **Trusted recipients** table (3) lists what is already approved, with the columns **Method**, **Recipient**,
**Source** (**Added manually** or **Seen at checkout**), **Label**, **Added** and **Active**.

* Use the **Active** switch to turn a recipient off without deleting it.
* To remove one, click the trash icon and confirm with **Remove** on the row itself, or click **Cancel**.

Proteside doesn't store the key in plain text. That's why you can't view or edit the key after it's saved. To replace
it, register the new one and remove the old one.

### Add manually
Use **Add manually** (4) when you know the receiving key or account.

#### Choose the method
Click **Add manually** to open the form and choose the **Method**: **Pix**, **Boleto**, **Crypto wallet**, **UPI
(India)**, **PayNow (Singapore)**, **PromptPay (Thailand)**, **DuitNow (Malaysia)**, **QR Ph (Philippines)**, **HK FPS
(Hong Kong)** or **Transferencias 3.0 (Argentina)**.

#### Enter the key
The **Key** field shows, below it, the format accepted for the chosen method. Some examples:

* **Pix:** CPF, CNPJ, email, phone number (`+55…`) or random key.
* **Boleto:** paste the typeable line of a boleto issued by the store.
* **Crypto wallet:** paste the wallet address. You don't need to pick a coin: the screen shows **Network detected**
  with the network recognized from the address format.
* **UPI:** a VPA in the `name@bank` format.

If you want, fill in a **Label** (up to 80 characters), for example "main account".

#### Click Add
The recipient is saved immediately and appears in the table with the key masked and the source **Added manually**.

You can also get here from the **Register** button on the [Payment integrity](https://docs.proteside.com/en/docs/guide/payment-integrity) screen. For
methods that accept manual registration, the form opens with the right method already selected. For Pix, the screen
guides you to confirm what shows up under **Recipients seen at your checkout**. How the check works on the checkout is
explained in [Trusted recipients](https://docs.proteside.com/en/docs/integration/payment-integrity#recebedores-confi%C3%A1veis-pix-key-pinning).

## How the SDK should react
*Image: Protection mode (1), Rules note (2), options for the technical team (3) and Save this step (4).*

Choose one of the cards (1). The card in use shows **You are here**.

| Mode                                          | What happens                                                                                                                                                             |
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Monitor** (recommended for the first weeks) | The SDK detects and raises alerts, without touching the page.                                                                                                            |
| **Block**                                     | Besides alerting, the SDK reacts on its own and undoes the tampering on the page, for example by removing an injected unknown script or restoring the original Pix code. |

Some detections only raise alerts, in both modes. See
[Monitor mode and block mode](https://docs.proteside.com/en/docs/integration/configuration#modo-monitor-e-modo-bloqueio).

The note below the cards (2) reminds you that [Rules](https://docs.proteside.com/en/docs/guide/rules) apply in both modes: a script with a block rule is
stopped even in **Monitor**. The mode only decides the SDK's automatic reactions to things without a rule. **Open
Rules** takes you to the rules screen.

> **Test before turning on Block**
>
> In **Block** mode, a wrong rule can break the checkout. Stay in **Monitor** for a few weeks, review the alerts and
> the scripts, and test **Block** on a low-traffic page before turning it on.

### Options for the technical team
The collapsed **Options for the technical team** block (3) holds two integration settings.

#### Developer mode
**Developer mode** pauses the SDK: it sends only a visit record and doesn't run any protection. Use it during
integrations and tests.

> **Don't forget to turn it off**
>
> With developer mode on, the store is **unprotected** and [SDK Health](https://docs.proteside.com/en/docs/guide/sdk-health) shows the SDK as paused.
> The blocking rules written into the snippet still apply, but without generating any events in the dashboard.

#### SDK release channel
The **SDK release channel** chooses which SDK version the store loads:

* `stable` (default): the validated version.
* `latest`: the most recent release, to try new features early.

> **Changing the channel requires pasting the snippet again**
>
> The screen says no reinstall is needed. But the channel is written into the SDK URL inside the snippet: the snippet
> you've already published keeps loading the old channel. After changing the channel and saving, copy the snippet again
> in [Pages & Domains](https://docs.proteside.com/en/docs/guide/settings/pages#copiar-o-snippet) and publish it.

### Save step 2
After choosing the mode and adjusting the options, click **Save this step** (4).

## What is normal at your checkout
*Image: Iframe origins and suggestions (1), GTM containers (2), service workers (3), detected methods (4), extra fields (5) and Save this step (6).*

In step 3, tell the SDK which payment providers and tools belong to your checkout. Anything outside the lists becomes
an alert. **An empty list means no restriction** for that item. When you're done, click **Save this step** in step 3.

### Expected iframe origins
Hosts of legitimate payment iframes, such as your payment provider's and the 3DS authentication's (1). When the list is
filled in, the SDK alerts on iframes from providers that aren't on it inside the checkout.

* Type the host (for example `checkout.psp.com`) and click **Add** or press Enter. If you paste a full URL, only the
  host is kept. Use `*.` to include subdomains.
* In **Suggestions (catalog PSPs)**, click a provider to add it. The suggestions prioritize providers from the store's
  country, set in [Store](https://docs.proteside.com/en/docs/guide/settings/store#pa%C3%ADs-e-fuso-hor%C3%A1rio). Use the search or **Show all** to find others.
* Up to 50 hosts.

### Allowed GTM containers
Authorized Google Tag Manager IDs, in the `GTM-XXXXXXX` format (2). When the list is filled in, containers that
aren't on it are blocked on the checkout. Up to 20 containers.

> **The GTM list blocks in both modes**
>
> The screen talks about blocking in **Block** mode, but when the list is filled in, containers outside it are also
> stopped in **Monitor**. Google Analytics 4 (`G-…`) and Google Ads (`AW-…`) tags loaded by JavaScript, including by
> GTM itself, are also blocked, and there's no way to add them to the list. Before filling it in, check with whoever
> handles marketing whether the store uses these tags on the checkout. Also remember to paste the snippet again: it
> keeps a copy of this list.

### Allowed service workers
This is in the collapsed **Allowed service workers (advanced)** block (3). Enter the paths of the site's legitimate
service workers, such as `/sw.js`. The path starts with `/` and has no spaces. When the list is filled in, a service
worker that isn't on it raises an alert and, in **Block** mode, is removed. Up to 20 paths.

## Detected payment methods
In step 4 there are no methods to tick: the SDK recognizes payment methods on its own by reading the checkout page.

* **Detected payment methods** (4) shows each method as **Seen at checkout** or **Not seen yet**. It's read-only.
  **View payment integrity** opens [Payment integrity](https://docs.proteside.com/en/docs/guide/payment-integrity).
* **Extra fields to watch** (5): the SDK already recognizes card, Pix and personal data fields on its own. Use **Extra
  selectors (optional)** only for fields in your store with non-standard names, one CSS selector per line. What you add
  is **added** to the automatic detection; nothing is turned off. Leave it empty if your fields follow the standard.

Click **Save this step** (6) to store the selectors.

## Installation order warning
The warning that the snippet isn't the first script in the `<head>` isn't configured on this screen. If your platform
doesn't let you put the snippet at the top, use **Stop warning for this store** on the alert itself. See
[Alerts](https://docs.proteside.com/en/docs/guide/alerts#parar-o-aviso-de-ordem-de-instala%C3%A7%C3%A3o).

## Next steps
- [Configuration](https://docs.proteside.com/en/docs/integration/configuration): The effect of each setting in the browser, in detail.
- [Payment integrity and Pix](https://docs.proteside.com/en/docs/integration/payment-integrity): How the SDK validates Pix codes, boletos and crypto addresses.
