> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paywise.de/llms.txt
> Use this file to discover all available pages before exploring further.

# Web Flow Onboarding

> Guide to onboarding users with the Onboarding Web Flow

### The onboarding flow

The Web Flow onboarding approach is the default that is applicable for most usecases as it does mitigate the need for you to provide all data we need while also providing a transparent and secure user experience.

Onboarding a new Company and user works in the following steps:

<Steps>
  <Step title="Create a Company">
    Create a [Company](/api-docs/partner-api/entities#companies). In this step you can provide as many of the data fields as possible - but you don't have to.
  </Step>

  <Step title="Start User onboarding">
    Using the new [Company](/api-docs/partner-api/entities#companies) you can start onboarding the first [User](/api-docs/partner-api/entities#users). To do this, Create a User Invite using the [User Invites](/api-docs/partner-api/userinvites/create-user-invite/) endpoint.
    The result of this operation is a URL on paywise that is used to complete the Onboarding process.
  </Step>

  <Step title="Redirect the User to the Onboarding URL">
    The user will be prompted for their personal data and can set a personal password for their paywise Account.
    Additionally, the first user that is onboarded to a new Company will be prompted to review and add any missing data on their company
  </Step>

  <Step title="Handle Onboarding Result">
    Once the user successfully completes providing their data, they will be redirected to a `success_url` you provided in Step 2. Now the onboarding of the company as a paywise client is considered complete.
    <Info>You also need to handle user cancellation and / or error cases appropriately.</Info>
  </Step>

  <Step title="Add additional Users (optional)">
    Repeating steps 2 - 4 you can onboard additional users to the company if required.
  </Step>

  <Step title="Start handing over Claims">
    <Check>The client is onboarded successfully and you can start handing over data using the [Case Management API](/api-docs/case-management-api/)</Check>

    All Data in the Case Management API has to be managed by a user that is allowed to access this information. As such, you must provide information on the user performing the current request. To do so, add a custom Header `X-User-Id` to every request to the Case Management API alongside your Partner Token as the Authorization Header. The `X-User-Id` must contain the identifier of one of the users you created in the previous steps.
    <Info>Please Note that when making requests to the Case Management API, both the user and the company must be fully onboarded, i.e. the `data_submission_completed` flag on the company must be set to `true` and the `email_verified` flag must be set for the user.</Info>
  </Step>
</Steps>

### Error Handling

To provide your users with a smooth user experience it is important to be able to handle the most common error and edge cases:

#### Redirects to the Failure URL

The most common case to handle will be the user being redirected to the `failure_url` during onboarding. This might be due to several different reasons:

* Expired User Invite: If the user fails to open the invite URL before the invite's expiry, they will be immediately redirected to the `failure_url`
* Manual Cancellation: If the user selects to cancel the onboarding process, they will be redirected to the `failure_url`. In this case, you'll have to create a new User Invite to restart the onboarding process.
* Duplicate Processing: If the invite was already processed, regardless of the outcome
  Please make sure to handle these cases accordingly.
  <Info>You can check the status of the invite via the [Get User Invite](/api-docs/partner-api/get-user-invite) endpoint to distinguish these cases.</Info>

#### Email Duplications

In rare cases, it might happen that you try to onboard a user that was already created, either through the API or by regular registration. In this case, the User API will respond with a 400 status code and you can prompt the user to choose a different email
<Info>If you want the existing account to be associated with the company you created, please contact our support</Info>
