# Signup and onboarding forms

> Cut business customer signup down to a single field. They enter a company ID and the name, address and VAT number arrive from the registers.

Signing up a business customer is usually the longest form in an application. Filling in the rest from the company ID shortens it to one field and gives you data that matches the register.

## The problem

Long signup forms have high abandonment. Every field a user has to fill by hand is a place they can leave or make a mistake.

Hand-entered data also cannot be reconciled against the register. You do not know whether the company exists, whether it is active or whether the address is right – you find out at the first invoice.

## How FirmAPI solves it

Leave a single field for the company ID or name in the first step. Call the detail once it is entered and prefill the rest of the form. The user only confirms.

The same call tells you whether the entity is active and whether it is a VAT payer. If terminated_date is set, you can reject the signup outright or flag it for review.

## Verify and prefill at signup

```
$response = Http::withHeaders(['X-API-Key' => $key])
    ->get("https://api.firmapi.sk/v1/company/ico/{$ico}", ['scope' => 'tax']);

$company = $response->json('data');

if ($company['terminated_date'] !== null) {
    return back()->withErrors(['ico' => 'The entity has been dissolved.']);
}

$customer->fill([
    'name'      => $company['name'],
    'street'    => $company['address']['street'],
    'city'      => $company['address']['city'],
    'vat_payer' => $company['tax']['is_vat_payer'],
]);
```

## Data used
- RPO – Legal Entities Register
- Tax Authority – VAT payers
- EU VIES

## Frequently asked questions

### What if the company is not in the register?

The API returns 404. In that case let the user fill the details manually – this mostly concerns foreign entities, which are not in Slovak registers.

### Can a foreign VAT number be verified?

Yes, through VIES. When signing up a customer from another EU member state it is the only way to confirm their VAT number is valid.
