# OnBoard New Merchant

{% tabs %}
{% tab title="Javascript" %}

```javascript
//A code snippet on how to consume the API

var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "first_name": "Feranmi",
  "last_name": "Emmanuel",
  "user_type": "Merchant",
  "email": "ep29--@exaeeey6mple.com",
  "password": "password",
  "password_confirmation": "password",
  "business_name": "BUSINESS",
  "phone": "08145986958",
  "bvn": "222211277",
  "bank_code": "044",
  "account_no": "0767474393",
  "settlement_bank_title": "Test",
  "bank_name": "Access Bank",
  "settlement_email": "example@example.com"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://demo.backend.monicredit.com/core/auth/onboard-business", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="PHP" %}

```php
//A code snippet on how to consume the API

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://demo.backend.monicredit.com/core/auth/onboard-business',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "first_name": "Feranmi",
    "last_name": "Emmanuel",
    "user_type": "Merchant",
    "email": "ep29--@exaeeey6mple.com",
    "password": "password",
    "password_confirmation": "password",
    "business_name": "BUSINESS",
    "phone": "08145986958",
    "bvn": "222211277",
    "bank_code": "044",
    "account_no": "0767474393",
    "settlement_bank_title": "Test",
    "bank_name": "Access Bank",
    "settlement_email": "example@example.com"
}',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

{% endtab %}
{% endtabs %}

<mark style="color:green;">`POST`</mark> `{{BaseURL}}/core/auth/onboard`

If the Onboarding is successful, the API will return a response with a `200` status code and a JSON object containing the data of the Merchant.

#### Request Body

| Name                                                      | Type   | Description     |
| --------------------------------------------------------- | ------ | --------------- |
| first\_name<mark style="color:red;">\*</mark>             | String | Test            |
| last\_name<mark style="color:red;">\*</mark>              | String | Test            |
| user\_type<mark style="color:red;">\*</mark>              | String | Merchant        |
| email<mark style="color:red;">\*</mark>                   | String | <test@test.com> |
| password<mark style="color:red;">\*</mark>                | String | password        |
| password\_confirmation<mark style="color:red;">\*</mark>  | String | password        |
| business\_name<mark style="color:red;">\*</mark>          | String | Business        |
| phone<mark style="color:red;">\*</mark>                   | String | 00000000        |
| bvn<mark style="color:red;">\*</mark>                     | String | 000000000       |
| bank\_code<mark style="color:red;">\*</mark>              | String | 0000            |
| account\_no<mark style="color:red;">\*</mark>             | String | 00000000        |
| settlement\_bank\_title<mark style="color:red;">\*</mark> | String | Test            |
| bank\_name<mark style="color:red;">\*</mark>              | String | Test            |
| settlement\_email<mark style="color:red;">\*</mark>       | String | <test@test.com> |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "success": true,
    "message": "Merchant Onboarding Successfull",
    "UserData": {
        "id": "US000000",
        "success": true,
        "message": "Account Created."
    },
    "AccountData": {
        "headers": {},
        "original": {
            "status": true,
            "message": "Account created succesfully",
            "data": {
                "id": "ACC000000",
                "user_id": "US000000",
                "name": "Test",
                "type": "MERCHANT",
                "tier": "test",
                "updated_at": "2022-09-13T16:28:20.000000Z",
                "created_at": "2022-09-13T16:28:20.000000Z"
            }
        },
        "exception": null
    }
}
```

{% endtab %}
{% endtabs %}
