# Connect a store's ERP

> For the owner: connect a store's ERP to Vendria, change the credentials, turn the connection off and see what changes right after.

Source: https://vendria.com/en/ajuda/conectar-o-erp-de-uma-loja

## Where to find it

In your account menu, under **Company Settings**, on the **ERP Integration** card.
It sits below **Order extraction hints** and above the list of
**Stores**.

⚠️ **Only the company Owner sees this card.** The company administrator and
the store administrator open the same page without it. It also disappears when
the Vendria team has turned off, for your company, connecting through this screen: in that case the one who connects
the ERP is the Vendria team. It is not a screen defect: the card simply
does not apply to you.

**Not the Owner?** There is nothing to configure here: the store may already be
connected, and you follow the integration through the bell notices and the
quote itself. See [Know whether the ERP integration is working](/en/ajuda/saber-se-a-integracao-com-o-erp-esta-funcionando). To connect
or change a connection, talk to the company Owner.

## Which ERPs you can connect here

Through the **ERP Integration** card you can connect the ERPs that appear in the
**ERP type** list, with the name in lowercase. Today there are two, and which ones is in
[Com quais ERPs a Vendria se integra](/ajuda/erps-integrados). Other ERPs (TOTVS Protheus, for
example) are connected by the Vendria team, not through this screen.

There are two ways to connect, depending on the ERP: **Bling** asks you to authorize
Vendria on its own screen, and the other ERPs on the list connect with the connector's
address and two access keys. Both step-by-step guides are below.

The connection is **per store**: in an organization with three stores, each one is connected
separately, and a store without a connection keeps working without an ERP. A store uses
**only one ERP type**: you cannot have two different ERPs in the same store.

## How to connect an ERP by access key, step by step

Before you start, have the connector's address and the two access keys at hand
(the API key and the webhook secret). They are provided by whoever installed the
ERP connector at your company, or by the Vendria team.

1. In **Company Settings**, on the **ERP Integration** card, click
   **Connect ERP**.
2. In **Store**, choose the store that uses this ERP.
3. In **ERP type**, choose the store's ERP.
4. In **Address (base URL)**, paste the connector's address. It must start
   with `https://`.
5. Fill in **API key** and **Webhook secret**. Both are required.
6. Click **Save**. The message **ERP connected** appears.

The connection shows up in the card's list with the store name, the badge with the
ERP name, the green **Credentials configured** badge and the switch on. It starts out active.

## How to connect Bling, step by step

Bling does not use a typed key: it asks you to authorize Vendria on Bling's own
screen.

1. In **Company Settings**, on the **ERP Integration** card, click
   **Connect ERP**.
2. In **Store**, choose the store that uses this Bling.
3. In **ERP type**, choose **bling**. The **Address (base URL)** comes
   pre-filled with Bling's address. Leave it as is.
4. Click **Save**. The connection appears with the yellow **Waiting for
   connection** badge and the switch off.
5. Click **Connect to Bling**, on the connection's row. You go to Bling's
   authorization screen.
6. Sign in with the store's Bling account and authorize.
7. When it finishes, the page **"Bling connected successfully! You can now
   close this tab."** appears. Go back to **Company Settings**: the badge changes to
   **Connected** and the switch turns on by itself.

⚠️ For Bling to send automatic updates, Vendria's notification URL
(webhook) must also be registered in the Bling panel. If you
do not know which it is, ask the Vendria team.

## What happens right after you connect the ERP

- **Stock**: if the store controls stock (in **Catalog and exports**, tab
  **Product page**, the option **Company manages stock**), stock lookup in the ERP starts right away: the
  quote starts warning about missing stock line by line. See [Estoque na cotação: o aviso de falta e as saídas](/ajuda/estoque-na-cotacao).
- ⚠️ **Pre-sale**: when this is the organization's **first** active connection, the
  **Pre-sale counts as stock** switch (in **Company Settings**) is
  **turned off automatically**. This is on purpose: without it, the first order
  confirmation after connecting could send the ERP a reservation order nobody
  asked for. If your operation sells pre-sale, turn the switch back on after connecting.
  Connecting a second store no longer touches this switch.
- **Bling catalog**: the first catalog load is queued as soon as the
  authorization finishes, and is applied once catalog sync is
  enabled for the store.
- **Everything else is enabled store by store**: automatic catalog, sellers, customers,
  last paid price and sending orders to the ERP do not turn on just because the connection exists.
  The Vendria team enables each one after checking your setup. See [What syncs with the ERP, and when](/en/ajuda/o-que-sincroniza-com-o-erp).

## Edit the connection or change the credentials

On the connection's row, click **Edit**. The **Edit ERP connection** window lets you
change the **Address (base URL)** and replace the credentials. The **Store** and the **ERP
type** cannot change after creation.

On an access-key connection, the credential fields come blank, marked
**(keep current)**: leaving them
blank keeps the keys already stored. Credentials are never
shown back, not even to the Owner. On a Bling connection there is no credential
to type: authorization is done on Bling's own screen.

⚠️ **To change the credentials, fill in API key and Webhook secret together.** If
you fill in only one of the two and save, Vendria stores the address and **keeps both
old keys**. The message **Connection updated** appears all the same.

## Turn a connection off and on again

The switch on the connection's row turns it on and off, without asking for confirmation. With the connection
off, Vendria **stops using that ERP in that store**: stock
lookup, customer data coming from the ERP and order sending stop
happening through it. Nothing is deleted: turning it back on restores what it was.

There is no delete-connection button on this screen; turning it off is how you stop using it.

⚠️ Turning the organization's **only** connection back on counts as a first connection: the
**Pre-sale counts as stock** switch is turned off again. Check it afterwards.

## When it goes wrong

- **"base_url deve usar https"**: the address starts with `http://`. Only secure
  addresses are accepted.
- **"base_url deve apontar para um host público"** or **"base_url inválida"**: the
  address points to an internal network, to `localhost`, or is misspelled. The
  connector must be reachable from the internet.
- **"Loja … já usa ERP '…'. Todas as conexões de uma loja devem ser do mesmo
  tipo."**: the store already has a connection to another ERP. A store does not mix ERPs.
- **The store appears greyed out in the Store list**: it already has a connection of that type.
- **"Conflito de conexão — tente novamente."**: two saves at the same time.
  Save again.
- **"Link de autorização inválido ou expirado. Refaça a conexão."** (Bling): the
  authorization link is valid for a short time and only once. Go back to **Company
  Settings** and click **Connect to Bling** again.
- **"Não foi possível concluir a autorização com o Bling. Tente novamente."**:
  Bling did not confirm the authorization. Repeat step 5.
- **I don't see the ERP Integration card**: you are not the company Owner, or
  the Vendria team has turned off, for your company, connecting through this screen. Talk to the
  Vendria team.
