# Contract options

Salaxy files to the Tax Administration and the Incomes Register on an employer's behalf, so every customer company must have authorised Salaxy before it can run payroll. How the company does that depends on your [account structure](https://code.salaxy.com/integration/account-structure.md). Pick the option before you build the onboarding step.
Examples use the **test** environment; see [Environments](https://code.salaxy.com/get-started/environments.md) for demo and production.

*Diagram: Salaxy is at the top. Three parties each have their own agreement with Salaxy. The partner has signed a power of attorney for its partner account. An accounting firm has signed its own power of attorney and, when agreed with Salaxy, holds its own Incomes Register certificate. A customer company has either signed a power of attorney itself, or accepted the terms with a click when its accounting firm has vouched for it. (Each party has its own agreement with Salaxy. The accounting firm's agreement is what makes the click option possible for its customer companies.)*

## Who has a contract with whom

| Party | Agreement with Salaxy | Notes |
|---|---|---|
| **Partner** | A signed power of attorney, behind your [partner account](https://code.salaxy.com/integration/partner-account.md) | Arranged with Salaxy outside the API |
| **Accounting firm** (three-tier) | Its own power of attorney. Its own Incomes Register certificate when its customers' reports are signed with it | Needed for the click option below. Without them its customer companies must sign themselves |
| **Customer company** | A power of attorney that it signs, **or** terms that it accepts with a click | Which one depends on the structure; see below |

An accounting firm's agreement with its customer company is between the two of them. Salaxy **trusts the firm's statement** that it holds the company's authorisation and does not check it.

## Which fits you?

### The company signs its own power of attorney

The default. The company's representative authorises Salaxy with a bank-authenticated signature. It works in every account structure and needs nothing from the accounting firm.

**Company signs: how it works:**
- The signing is bank-authenticated. Salaxy keeps the signed authorisation as the paper trail for its filings on the company's behalf.
- The authorisation type on the company account is `employerAuthorization`. The company can also sign the Salaxy agreement itself (`companyContract`).
- Use this if your accounting firm tier has not signed its own power of attorney, or you have no accounting firm tier.

### The company accepts the terms with a click

A shortcut for companies below an accounting firm. Salaxy enables it for the firm, or for the partner above the firm. The firm has already signed its own power of attorney, so the company only accepts the terms. The accepted authorisation records which account vouched for it (`partnerContract`).

Salaxy always sends the Incomes Register reports. The set-up agreed with Salaxy decides whose certificate signs them: Salaxy's by default, or the **accounting firm's own** certificate. Only in the second case does the firm need a valid certificate.

**Click option: how it works:**
The click is consent to terms, not a legal signature. The legal weight sits with the accounting firm's authorisation from its customer. For this reason the accounting firm may accept on the company's behalf, in the company's own session.

The acceptance **fails** when the company has no accounting firm above it, when the firm has not signed its own power of attorney, or when the firm's own certificate is required and is missing or expired. The company then signs its own power of attorney instead.

Two things can break it later, so handle them:

- **Certificate expiry.** When the firm's certificate is required, it is checked again every time an invoice is created. A company can onboard successfully and then fail to commit a payment months later when the firm's certificate expires.
- **Changes in the tree.** If the account that vouched leaves the company's hierarchy or loses its permission, the acceptance lapses (`hasValidContract` is `false`). Moving a company to another parent breaks it too.

| Method | Path | Purpose |
|---|---|---|
| `GET` | `/v03/api/onboarding/contract` | Which contract the current account must accept, whether it already has a valid one, and whether the parent's certificate blocks acceptance |
| `POST` | `/v03/api/onboarding/contract` | Accept it. The call acts on the signed-in account, so use a token for the company |

```json
{
  "authorizationType": "partnerContract"
}
```

A `GET` response:

```json
{
  "authorizationType": "partnerContract",
  "hasValidContract": false,
  "isParentIrCertificateRequiredButMissingOrExpired": false
}
```

When `authorizationType` is `employerAuthorization`, the company must sign the power of attorney instead. When `isParentIrCertificateRequiredButMissingOrExpired` is `true`, the parent account must add a valid certificate first; the terms cannot be accepted before that.

## In each structure

| Structure | Typical contract path |
|---|---|
| **Two-tier** (technical account to company) | Company signs its own power of attorney. Whether the click option is open to your technical account is **To be decided** with Salaxy at the kick-off |
| **Three-tier** (accounting firm in between) | The accounting firm signs its own power of attorney, and adds its certificate if its own certificate is to sign. Its customer companies then accept with a click |
| **Mixed** | Per company: by the path of its own parent |

When the accounting firm's own certificate signs its customers' Incomes Register reports, the firm manages it with `GET` and `POST /v03/api/settings/irCertificate` and `POST /v03/api/settings/irCertificate/renew`. See [Incomes Register filing](https://code.salaxy.com/integration/incomes-register.md).

## Test it

1. Create a customer company under an accounting firm, as in [Account structure](https://code.salaxy.com/integration/account-structure.md#test-it).
2. With a token for the company, call `GET https://test-secure.salaxy.com/v03/api/onboarding/contract`. Check `authorizationType` and `hasValidContract`.
3. If `authorizationType` is `partnerContract` and `isParentIrCertificateRequiredButMissingOrExpired` is `false`, post the acceptance as above and read the contract again: `hasValidContract` should now be `true`.
4. If your set-up uses the firm's own certificate, repeat without it to see the blocked state.

## Checklist

- You know which contract path each of your customer segments uses, and it matches your [account structure](https://code.salaxy.com/integration/account-structure.md).
- Your onboarding reads `GET /v03/api/onboarding/contract` and shows the right step: sign, accept or wait for the parent's certificate.
- You tell an accounting firm early that it needs its own power of attorney, and its own Incomes Register certificate if your set-up uses it. You then monitor the certificate's expiry.
- You handle a lapsed acceptance (`hasValidContract: false`) after a company changes parent.

**Next:** [Service models](https://code.salaxy.com/integration/service-models.md)
