---
id: registration
title: "Registration"
sidebar_label: "Registration"
hide_title: true
description: "Register buyer"
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import Ingress from "../../src/components/ingress/ingress.react";

<Ingress title="Apply to be an buyer">
  These endpoint are used to setup a new profile or create an application for
  new buyers.
</Ingress>

The registration process involves the following steps:

1. The applicant enters `Organization Id` and `Phone Number` and / or `Registration Number` which is then posted to the applications endpoint.
2. If the applicant is not authorized to review, a list of reviewers are returned, from which the applicant chooses one and enters their phone number.
3. The reviewer ID and phone number is posted to the reviewers endpoint.
4. A SMS is sent to the entered phone number asking the reviewer to identify with their Electronic ID and approve the buyer.
5. Finally an SMS is sent back to the applicant informing them that they've been approved as an buyer for the organization.

<div>
  <a href="/img/b2b/b2b_registration.png" target="_blank">
    <img src="/img/b2b/b2b_registration.png" alt="" />
  </a>
</div>

### Initiate new application

This endpoint is used to request that a person is added as buyer to an organization. The list of reviewers contains both names and a unique ID. The names should be displayed to the applicant while the ID is used to identify which reviewer the applicant has chosen

<Tabs defaultValue="req" values={[
{ label: 'Request', value: 'req', },
{ label: 'Response', value: 'res', }
]}>

<TabItem value="req">

```json
POST /b2b/{{countryCode}}/applications HTTP/1.1
Host: api.uat.walleydev.com // (Please note! Different hostname in production)
Authorization: Bearer bXlVc2VybmFtZTpmN2E1ODA4MGQzZTk0M2VmNWYyMTZlMDE...

{
    "organizationId": "2576102-5",
    "applicantPhoneNumber": "+46073456789",
    "applicantRegistrationNumber": "200110282381",
    "firstName" : "John",
    "lastName" : "Doe"
}
```

</TabItem>

<TabItem value="res">

```json
Status: 201 Created
/* Body */
{
    "data": {
        "applicationId": "933fb0ec-bdc0-4a40-b02d-e4205072e90c",
        "organizationName": "Test Company Education Oy",
        "reviewers": [
            {
                "name": "Test Name_B",
                "id": "927f1ec3-90e5-4e5e-8dfc-ca5d3acd0464"
            },
            {
                "name": "Test Name_A",
                "id": "e12d1a09-8e11-4f0c-a4ed-ed98c0663a81"
            }
        ],
        "buyerStatus": "Inactive"
    }
}
```

</TabItem>
</Tabs>

#### Request headers

| Header            | Required | Explanation                                                                                                             |
| ----------------- | -------- | ----------------------------------------------------------------------------------------------------------------------- |
| **Authorization** | Yes      | Instructions on how to generate the Bearer token value can be found [here](/docs/manage/getting-started/authentication) |

#### Request path

| Path            | Required | Explanation                                            |
| --------------- | -------- | ------------------------------------------------------ |
| **countryCode** | Yes      | The country where the purchase is made. (SE, NO or FI) |

#### Request body

Phone number or Registration number is required.

| Property                        | Required | Explanation                                                 | Type   | Notes                |
| ------------------------------- | -------- | ----------------------------------------------------------- | ------ | -------------------- |
| **organizationId**              | Yes      | The company's organization ID                               | string |                      |
| **applicantPhoneNumber**        | No       | Phone number to the person wanting to become a buyer        | string | Include country code |
| **applicantRegistrationNumber** | No       | Registration number to the person wanting to become a buyer | string | Include country code |
| **firstName**                   | No       | First name of the applicant                                 | string |                      |
| **lastName**                    | No       | Last name of the applicant                                  | string |                      |

#### Response body

Phone number or Registration number is required.

| Property             | Explanation                                                 | Type   | Notes |
| -------------------- | ----------------------------------------------------------- | ------ | ----- |
| **applicationId**    | Unique id for the application, used in subsequentl calls    | string |       |
| **organizationName** | The name of the organization                                | string |       |
| **reviewers**        | List of people authorized to approve the application        | array  |       |
| **buyerStatus**      | If `Active` the application has been automatically approved | string |       |

### Choose reviewer

This endpoint is used to choose a reviewer that should approve the request. Here the application ID and reviewer ID from the response above is used to select a reviewer.
The phone number must include the country code eg. `+46`.

:::info Automatically approved applicant
If the applicant is an authorized signatory themselves the application is automatically approved.
This is indicated with `buyerStatus=Active` in the response above. In that case there is no need to choose a reviewer with the request below, and the applicant can proceed to place a purchase directly.
:::

<Tabs defaultValue="req" values={[
{ label: 'Request', value: 'req', },
{ label: 'Response', value: 'res', }
]}>

<TabItem value="req">

```json
POST /b2b/{{countryCode}}/applications/{{applicationId}}/reviewers HTTP/1.1
Host: api.uat.walleydev.com // (Please note! Different hostname in production)
Authorization: Bearer bXlVc2VybmFtZTpmN2E1ODA4MGQzZTk0M2VmNWYyMTZlMDE...

{
    "reviewer": {
        "reviewerId": "927f1ec3-90e5-4e5e-8dfc-ca5d3acd0464",
        "phoneNumber": "+46123456789"
    }
}
```

</TabItem>

<TabItem value="res">

```json
Status: 202 Accepted
/* No Body */
```

</TabItem>
</Tabs>

#### Request headers

| Header            | Required | Explanation                                                                                                             |
| ----------------- | -------- | ----------------------------------------------------------------------------------------------------------------------- |
| **Authorization** | Yes      | Instructions on how to generate the Bearer token value can be found [here](/docs/manage/getting-started/authentication) |

#### Request path

| Path              | Required | Explanation                                            |
| ----------------- | -------- | ------------------------------------------------------ |
| **countryCode**   | Yes      | The country where the purchase is made. (SE, NO or FI) |
| **applicationId** | Yes      | A unique ID to identify a registration request         |

#### Request body

| Property        | Required | Explanation                        | Type   | Notes                                  |
| --------------- | -------- | ---------------------------------- | ------ | -------------------------------------- |
| **reviewerId**  | Yes      | Unique identifier for the reviewer | number | Received when creating the application |
| **phoneNumber** | Yes      | Phone number to the reviewer       | number | Include country code                   |

## Response codes

| Http status code | Description                                                                                                                      |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| 400              | Error, refer to returned problem details                                                                                         |
| 401              | Unauthorized, token verification needed. See: [Authentication](/docs/manage/getting-started/authentication) for more information |
| 403              | Permissions needed                                                                                                               |
| 404              | Organization, application or reviewer not found                                                                                  |
