# Integrations

**Setări → Integrări** (Settings → Integrations) is where the shop connects the services it takes card payments,
ships parcels, issues invoices, takes marketplace orders, keeps newsletter subscribers and answers WhatsApp and
Messenger messages through. It needs *Change shop settings*; a service's page asks for your password
again, because it holds credentials.

Each service is listed under its kind (online payments, couriers, invoicing) with its state: **Pornit** (on),
**Implicit** (default), **Mod test** (test mode). Open one to:

- fill in its **credentials** (date de acces). Passwords and keys are stored encrypted and never shown again: leave a
  saved one blank to keep it, or tick **Șterge valoarea salvată** to remove it. Fields marked required are needed
  only to switch the service on;
- switch it **on**, make it the **default** of its kind (one per kind), and use the provider's **test mode** when it
  has one;
- copy the **notification address** (adresa de notificare) into your account at the provider, if it asks for one:
  that is where it confirms payments or parcel statuses;
- **test the connection** with the saved credentials, for the services that can.

A service you switch off is no longer offered, but orders that already used it can still be followed (a parcel's
tracking, a refund).

## Demo services

**Demo** services move no money and ship nothing: they are for the demo shop and for trying the shop out before
signing a contract with a provider. The demo payment page lets you choose whether the payment goes through or is
declined.

## Using couriers

With a courier switched on, the order page can book AWBs with it (see [Orders](orders.md#awb)); the default one is
suggested when several are on. The demo courier "delivers" in half an hour: picked up after 2 minutes, out for
delivery after 10, delivered after 30.

## Using invoicing

With an invoicing service switched on, the order page can issue and reverse invoices (see
[Orders](orders.md#invoice)). The demo service numbers its invoices in a DEMO series, with a PDF and no fiscal value.

## Marketplaces

With a marketplace switched on, its new orders come into the shop every 5 minutes and their status is kept in step
(see [Marketplace orders](marketplaces.md)). The demo marketplace places one made-up order a day from your first
product.

## Newsletter

With a newsletter service switched on, the shop offers the newsletter and keeps the confirmed subscribers in it (see
[Newsletter](newsletter.md)). The demo service only counts them.

## WhatsApp and Messenger

With **WhatsApp Business** or **Facebook Messenger** switched on, customers' messages there land in the chat inbox
next to the website chat, and replies go back on the same channel (see [Live chat](chat.md#whatsapp-and-messenger)).
The demo channel takes test messages posted to its webhook address and keeps the replies instead of sending them.

## Card payments

With a payment service switched on, checkout offers **Card online**. The customer places the order, pays on the
processor's secure page and comes back to the order page, which says whether the payment went through. The order
becomes **Plătită** (paid) only when the processor confirms it, in its signed notification or when asked directly;
if the processor reports a different amount, the payment is left unconfirmed for you to check. A declined payment
leaves the order waiting, and the order page offers **Încearcă din nou plata** (try paying again).

### NETOPIA Payments

1. In the NETOPIA account, get the **API key** (Profile → Security; one for testing, one for production) and the
   **POS signature** (`XXXX-XXXX-XXXX-XXXX-XXXX`).
2. Fill them in, with the **API address**: `https://secure.sandbox.netopia-payments.com` while testing, the
   production address NETOPIA gives you once approved. The public key is built in; fill it only if NETOPIA gives you
   another.
3. Switch it on and test the connection.

NETOPIA charges in lei; an order in euro is converted at the BNR rate. It confirms each payment with a signed
notification to the shop (the notification address is sent with every payment, nothing to set in NETOPIA). Its
return page carries no proof, so the order page may say it is waiting for a few seconds until the notification
arrives. NETOPIA has no public refund interface yet: refund from the NETOPIA admin. If NETOPIA refuses to start a
payment, the order is kept and the customer can try again from the order page.

### Stripe

The **secret key** (Developers → API keys: `sk_test_…` while testing, `sk_live_…` in production) and the **webhook
signing secret**: in Stripe, Developers → Webhooks, add the notification address the connection test shows, with
the `checkout.session.*` events, and copy its secret (`whsec_…`). Stripe charges in the order's currency. The
customer's return is checked by asking Stripe; refunds go through Stripe from the shop.

### PayU

The **POS ID** and its **OAuth client secret**, from the point of sale in the PayU panel. Test mode uses PayU's
sandbox. PayU's notifications are never taken at their word: the shop reads the order back from PayU, and captures
it when the point of sale only authorises payments. Charged in the order's currency; refunds go through PayU.

### EuPlătesc

The **merchant ID** and the hexadecimal **signing key** EuPlătesc gave you. In the EuPlătesc panel set the two
addresses the connection test shows: the **return address** (where the customer comes back) and the
**notification address**. Both carry EuPlătesc's signed answer; an answer whose signature does not match is ignored.
Charged in lei. EuPlătesc has no refund interface here: refund from its panel.

### LibraPay

The **merchant code**, **terminal** and hexadecimal **signing key** from Libra Internet Bank, and the merchant
**name, shop address and e-mail** exactly as declared to the bank (they are part of the signature). Give the bank the
notification address the connection test shows. Test mode uses LibraPay's test page. Charged in lei; refund from the
LibraPay console.

### ING WebPay and BT iPay

The **API user and password** the bank gave you (not the console ones) and the bank's **API address**, which differs
between testing and production (BT's test address is `https://ecclients-sandbox.btrl.ro/payment/rest`). The bank's
answer is always read back from the bank, on the customer's return and on its notification, if the bank sends one.
Charged in lei. Refunds go through the bank: a reversal for the whole amount before settlement, a refund otherwise.

Hosted-form banks (EuPlătesc, LibraPay) get a 15-digit order number for each payment attempt, since they accept
nothing else. Every processor here is tested against simulated answers: make a few payments in the processor's test
environment before switching to production.

## Couriers

### Sameday

1. Ask Sameday for API access: an **API username and password**, the **pickup point ID** and the **service ID** of
   your contract (and the easybox service ID, if different).
2. Fill them in, switch on **test mode** to use Sameday's test environment first, then **test the connection**: it
   lists your account's pickup points with their IDs.
3. **Insure parcels** declares the order value for insurance, which Sameday charges for; off by default.

The delivery locality is matched in Sameday's list within the order's county; when Sameday does not know it, the
order page says so and no AWB is booked. Cash on delivery is collected in lei. The label is Sameday's PDF; tracking
follows Sameday's statuses.

### FAN Courier

The **API username and password** of your selfAWB account and the **client ID**. The service is `Standard` unless
you name another (for example `Cont Colector`). FANbox lockers use FAN's FANbox service. FAN Courier can also price
a parcel before it is booked.

### Cargus

The **subscription key** (Primary Key, from the Cargus developer portal), the API **username and password**. Leave
the pickup point empty to send from the account's headquarters, or take an ID from the connection test. Leave the
service empty and it is chosen by weight and number of parcels; Cargus takes at most 15 parcels per shipment.

### DPD

The DPD **username and password**. The service is DPD Classic (2505) unless you name another.

### GLS

The **MyGLS e-mail, password and client number**, and the **sender's address**, which GLS wants on every parcel.
Test mode uses GLS's test environment. GLS gives the label when the AWB is booked, and its parcels cannot be
cancelled from the shop: cancel them in the MyGLS portal. ParcelShops and lockers come from GLS's public map.

## Invoicing

### SmartBill

1. In SmartBill, take the **API token** (My account → Integrations → API).
2. Fill in the account **e-mail**, the token, the company **CIF** and the **invoice series** the shop's invoices are
   numbered in.
3. The **tax names** must be exactly those in your SmartBill VAT list: by default `Normala` (21 %), `Redusa` (11 %)
   and `SDD` for the SGR deposit line, which is outside the VAT base. Check the deposit's name with your accountant.
4. Switch it on and test the connection: it checks the credentials and that the series exists.

### Oblio

The account **e-mail**, the **API key** (Settings → Account details → API), the company **CIF** and the invoice
**series**; the VAT names as in your Oblio VAT list (as for SmartBill). A credit note is issued as a new invoice with
the original lines negated, mentioning the invoice it reverses.

### FGO

The **API private key** (Settings → Users → API), the company **CIF** and the invoice **series**. Test mode uses FGO's
UAT environment with a test key. FGO adds VAT on top of the net price, so a line's total may differ from the order
by a ban in rare cases; check the first invoices against their orders.

### e-Factura ANAF (without an invoicing tool)

For a shop with no invoicing program, SyncSHOP issues the invoice itself and sends it to e-Factura. In your ANAF
account register an OAuth application (Online services → OAuth application registration) with the callback address
shown in **Setări → e-Factura (ANAF)**, then fill in its **Client ID**, **Client secret** and the **invoice series**
here and switch it on. Complete **Setări → Date firmă** (the seller on the invoice), then press **Conectează la ANAF** in
Setări → e-Factura and authorise with the company's qualified digital certificate. The connection lasts 90 days and
renews itself; test mode uses ANAF's test environment.

Each invoice is numbered in the series from 1, without gaps, written as CIUS-RO XML, sent to ANAF and kept with ANAF's
PDF. If ANAF does not take it at once, the invoice stands and the scheduled task *Trimite și urmărește e-Factura* (every
15 minutes) sends it again, then follows it: the order page shows **de trimis**, **în prelucrare**, **acceptată** or
**respinsă de ANAF** with ANAF's errors. The SGR deposit and gift cards go as exempt lines (E) with a reason: check this
with your accountant.

### All invoicing services

Invoices are issued in Romanian, with the client's CUI and trade registry number for a company, each discount right
after its product, and the payment recorded when the order is already paid (card or transfer). If e-Factura is on in
your SmartBill account, SmartBill sends the invoice to ANAF. A foreign-currency invoice carries the BNR rate of its
issue date. **Stornează** issues SmartBill's credit note.
