# Policy

{% hint style="info" %}
***NOTE:*** If a principal customer has one beneficiary that means the number of users is two (2) and you are going to use`''price_config''` for the number of users (2) respectively.
{% endhint %}

## Retrieve Quoted Price

## Get a quoted price

<mark style="color:green;">`POST`</mark> `https://sandbox.insurpass.comapi/merchant/micro_health/get_quote`

This endpoint allows a merchant to get and display the price of the micro-health insurance plan about to be subscribed to by the customer.

#### Headers

| Name                                            | Type   | Description                     |
| ----------------------------------------------- | ------ | ------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer {$secret-key}/{$api-key} |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json                |

#### Request Body

| Name                                                 | Type    | Description                                                                                                                       |
| ---------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- |
| subscription\_type<mark style="color:red;">\*</mark> | String  | What type of micro-healthy insurance subscription the principal customer is purchasing - **\['monthly', 'yearly', 'quarterly']**. |
| no\_of\_users<mark style="color:red;">\*</mark>      | integer | Number of beneficiaries - 4                                                                                                       |
| product\_id<mark style="color:red;">\*</mark>        | string  | The unique number that identifies which insurance product you're purchasing  - **3**                                              |

{% tabs %}
{% tab title="200 " %}
{% code overflow="wrap" lineNumbers="true" %}

```javascript
{
    "success": true,
    "response_message": "Quote price get successful",
    "response_code": "QOT101",
    "data": {
        "quote_price": 700
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="PHP" %}
{% code overflow="wrap" lineNumbers="true" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://sandbox.insurpass.com/api/merchant/micro_health/get_quote',
  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 =>'{
  "no_of_users": 2,
  "subscription_type": "monthly",
  "product_id": "1"
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {{SECRETKEY}}',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endcode %}
{% endtab %}

{% tab title="NODE JS" %}
{% code overflow="wrap" lineNumbers="true" %}

```javascript
var axios = require('axios');
var data = JSON.stringify({
  "no_of_users": 2,
  "subscription_type": "monthly",
  "product_id": "1"
});

var config = {
  method: 'post',
  url: 'https://sandbox.insurpass.com/api/merchant/micro_health/get_quote',
  headers: { 
    'Authorization': 'Bearer {{SECRETKEY}}', 
    'Content-Type': 'application/json'
  },
  data: data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
```

{% endcode %}
{% endtab %}

{% tab title="CURL" %}
{% code overflow="wrap" %}

```clike
curl --location --request POST https://sandbox.insurpass.com/api/merchant/micro_health/get_quote' \
--header 'Authorization: Bearer {{SECRETKEY}}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "no_of_users": 2,
  "subscription_type": "monthly",
  "product_id": "1"
}'
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Initiate Micro-Health Policy&#x20;

## This method initiates the creation of a Micro-Health Policy.

<mark style="color:green;">`POST`</mark> `https://sandbox.insurpass.com/api/merchant/micro_health/initiate`

This endpoint allows you to subscribe your customers to the Malaria care plan for the first time.

#### Headers

| Name                                            | Type   | Description                     |
| ----------------------------------------------- | ------ | ------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer {$secret-key}/{$api-key} |
| Content-Type<mark style="color:red;">\*</mark>  | String | application                     |

#### Request Body

| Name                                                              | Type               | Description                                                                                                                               |
| ----------------------------------------------------------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| first\_name<mark style="color:red;">\*</mark>                     | string             | Principal Customer's first name - **Favour**                                                                                              |
| surname<mark style="color:red;">\*</mark>                         | string             | Principal Customer's surname (Last name) - **Ezedibia**                                                                                   |
| email<mark style="color:red;">\*</mark>                           | Email              | Principal Customer's email address -- **<email@domain.com>**                                                                              |
| phone\_no<mark style="color:red;">\*</mark>                       | numeric\|digits:11 | Principal Customer's phone number - 08102223475                                                                                           |
| date\_of\_birth<mark style="color:red;">\*</mark>                 | string             | Principal Customer's date of birth - FORMAT: YYY-MM-DD                                                                                    |
| product\_id<mark style="color:red;">\*</mark>                     | string             | The unique number that identifies micro-health insurance product you're purchasig - **3**                                                 |
| subscription\_type<mark style="color:red;">\*</mark>              | string             | Accepted: **\['monthly', 'quarterly' and 'yearly']**                                                                                      |
| amount<mark style="color:red;">\*</mark>                          | numeric            | The price of the insurance policy - 200,000                                                                                               |
| nin\_number<mark style="color:red;">\*</mark>                     | integer            | The Principal Customer's NIN - 22222222222                                                                                                |
| first\_beneficiary\_full\_name<mark style="color:red;">\*</mark>  | string             | The name of the first beneficiary added by the Principal customer                                                                         |
| second\_beneficiary\_full\_name<mark style="color:red;">\*</mark> | string             | The name of the second beneficiary added by the Principal Customer.                                                                       |
| third\_beneficiary\_full\_name<mark style="color:red;">\*</mark>  | string             | The name of the third beneficiary added by the Principal Customer                                                                         |
| id\_url<mark style="color:red;">\*</mark>                         | string             | The URL of the Principal Customer's ID uploaded to their profile - <https://images.pexels.com/photos/10840765/pexels-photo-10840765.jpeg> |
| profile\_url<mark style="color:red;">\*</mark>                    | string             | The URL of the Principal Customer's profile -  <https://images.pexels.com/photos/10840765/pexels-photo-10840765.jpeg>                     |

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

```javascript
{
    "success": true,
    "data": {
        "token": "21c6a88014a906b6dee712c804bcd51970d321d4"
    },
    "response_message": "Insurance Policy subscription initiate Successfully",
    "response_code": "FRT008"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="PHP" %}
{% code overflow="wrap" lineNumbers="true" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://sandbox.insurpass.com/api/merchant/micro_health/initiate',
  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" : "bob",
    "surname" : "Bobbison",
    "email" :"email@gmail.com",
    "phone_no": "08102223475" ,
    "date_of_birth": "1999-09-09",
    "product_id" : 3,
    "subscription_type":"monthly",
    "amount" : 700,
    "nin_number" : 22222222222,
    "first_beneficiary_full_name" :"Bob Bobbison",
    "second_beneficiary_full_name" : "Bob1 Bobbison1",
    "third_beneficiary_full_name" : " Bob2 Bobbison2",
    "id_url": "https://images.pexels.com/photos/10840765/pexels-photo-10840765.jpeg",
    "profile_url" :"profile_url"
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {{SECRETKEY}}',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

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

{% endcode %}
{% endtab %}

{% tab title="NODE JS" %}
{% code overflow="wrap" lineNumbers="true" %}

```javascript
var axios = require('axios');
var data = JSON.stringify({
  "first_name": "bob",
  "surname": "Bobbison",
  "email": "email@gmail.com",
  "phone_no": "08102223475",
  "date_of_birth": "1999-09-09",
  "product_id": 3,
  "subscription_type": "monthly",
  "amount": 700,
  "nin_number": 22222222222,
  "first_beneficiary_full_name": "Bob Bobbison",
  "second_beneficiary_full_name": "Bob1 Bobbison1",
  "third_beneficiary_full_name": " Bob2 Bobbison2",
  "id_url": "https://images.pexels.com/photos/10840765/pexels-photo-10840765.jpeg",
  "profile_url": "profile_url"
});

var config = {
  method: 'post',
  url: 'https://sandbox.insurpass.com/api/merchant/micro_health/initiate',
  headers: { 
    'Authorization': 'Bearer {{SECRETKEY}}', 
    'Content-Type': 'application/json'
  },
  data: data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
```

{% endcode %}
{% endtab %}

{% tab title="CURL" %}
{% code overflow="wrap" %}

```clike
curl --location --request POST https://sandbox.insurpass.com/api/merchant/micro_health/initiate' \
--header 'Authorization: Bearer {{SECRETKEY}}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "first_name": "bob",
  "surname": "Bobbison",
  "email": "email@gmail.com",
  "phone_no": "08102223475",
  "date_of_birth": "1999-09-09",
  "product_id": 3,
  "subscription_type": "monthly",
  "amount": 700,
  "nin_number": 22222222222,
  "first_beneficiary_full_name": "Bob Bobbison",
  "second_beneficiary_full_name": "Bob1 Bobbison1",
  "third_beneficiary_full_name": " Bob2 Bobbison2",
  "id_url": "https://images.pexels.com/photos/10840765/pexels-photo-10840765.jpeg",
  "profile_url": "profile_url"
}'
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Verify Micro-Health Policy&#x20;

## This endpoints sends a token that verifies the creation of a Micro-Health Policy.

<mark style="color:green;">`POST`</mark> `https://sandbox.insurpass.com/api/merchant/micro_health/verify`

This endpoint allows you to verify that a customer has successfully subscribed to the Malaria care plan.

#### Headers

| Name                                            | Type   | Description                     |
| ----------------------------------------------- | ------ | ------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer {$secret-key}/{$api-key} |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json                |

#### Request Body

| Name                                    | Type   | Description                                                                                               |
| --------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------- |
| token<mark style="color:red;">\*</mark> | string | Note that after 15 minutes, the token expires and you will need to reinitiate - **IDP163438169412711526** |

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

```javascript
{
    "success": true,
    "data": {
        "id": 25,
        "user_id": 32,
        "product_id": 1,
        "recurring": true,
        "subscriptions_type": "monthly",
        "subscriptions_no": 1,
        "start_date": "2021-04-14T00:00:00.000000Z",
        "end_date": "2021-05-14T00:00:00.000000Z",
        "enable": 1,
        "policy_no": "2104205800051",
        "merchant_user_id": 1,
        "created_at": "2021-04-14T16:38:17.000000Z",
        "updated_at": "2021-04-14T16:38:24.000000Z",
        "active_date": "2021-04-18 00:00:00",
        "product": {
            "id": 1,
            "name": "malaria care 1",
            "details": "<p>my product details</p>",
            "beneficiaries": true,
            "max_beneficiaries": 3,
            "provider_id": 1,
            "logo_url": null,
            "enable": true,
            "created_at": "2021-03-26T22:57:33.000000Z",
            "updated_at": "2021-03-26T22:57:34.000000Z"
        }
    },
    "message": "Subscription get successful"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The Initiate token expires in 15 minutes, and if a user does not verify his/her subscription after 15 minutes of initiation, the details of the subscription will be deleted.
{% endhint %}

{% tabs %}
{% tab title="PHP" %}
{% code overflow="wrap" lineNumbers="true" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://sandbox.insurpass.com/api/merchant/micro_health/verify',
  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 =>'{
    "token":"IDP163438169412711526"
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {{SECRETKEY}}',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

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

{% endcode %}
{% endtab %}

{% tab title="NODE JS" %}
{% code overflow="wrap" lineNumbers="true" %}

```javascript
var axios = require('axios');
var data = JSON.stringify({
  "token": "IDP163438169412711526"
});

var config = {
  method: 'post',
  url: 'https://sandbox.insurpass.com/ap/merchant/micro_health/verify',
  headers: { 
    'Authorization': 'Bearer {{SECRETKEY}}', 
    'Content-Type': 'application/json'
  },
  data: data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
```

{% endcode %}

{% endtab %}

{% tab title="CURL" %}
{% code overflow="wrap" %}

```clike
curl --location --request POST https://sandbox.insurpass.com/api/merchant/micro_health/verify' \
--header 'Authorization: Bearer {{SECRETKEY}}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "token": "IDP163438169412711526"
}'
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Renew Subscription

## This endpoints renews a Micro-Health Policy.

<mark style="color:green;">`POST`</mark> `https://sandbox.insurpass.com/api/merchant/micro_health/top_up`

This endpoint allows you renew your customers malaria care plan subscription\_

#### Headers

| Name                                            | Type   | Description                     |
| ----------------------------------------------- | ------ | ------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer {$secret-key}/{$api-key} |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json                |

#### Request Body

| Name                                                 | Type    | Description                                                                                                                       |
| ---------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- |
| amount<mark style="color:red;">\*</mark>             | numeric | Amount the micro-health insurance plan cost to purchase - 200,000                                                                 |
| subscription\_type<mark style="color:red;">\*</mark> | string  | What type of micro-healthy insurance subscription the principal customer is purchasing - **\['monthly', 'yearly', 'quarterly'].** |
| policy\_no<mark style="color:red;">\*</mark>         | string  | Principal customer's insurance policy number for the micro health plan. - **"UIC/HGJ/7685/GHF**                                   |

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

```javascript
{
    "success": true,
    "data": {
        "id": 25,
        "user_id": 32,
        "product_id": 1,
        "recurring": true,
        "subscriptions_type": "monthly",
        "subscriptions_no": 1,
        "start_date": "2021-04-14T00:00:00.000000Z",
        "end_date": "2021-05-14T00:00:00.000000Z",
        "enable": 1,
        "policy_no": "2104205800051",
        "merchant_user_id": 1,
        "created_at": "2021-04-14T16:38:17.000000Z",
        "updated_at": "2021-04-14T16:38:24.000000Z",
        "active_date": "2021-04-18 00:00:00",
        "product": {
            "id": 1,
            "name": "malaria care 1",
            "details": "<p>my product details</p>",
            "beneficiaries": true,
            "max_beneficiaries": 3,
            "provider_id": 1,
            "logo_url": null,
            "enable": true,
            "created_at": "2021-03-26T22:57:33.000000Z",
            "updated_at": "2021-03-26T22:57:34.000000Z"
        }
    },
    "message": "Subscription renew successful"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The renewal of an insurance plan is dependent on the payment frequency selected by the principal customer at the point of subscription. The payment frequency could either be monthly, quarterly or annually.
{% endhint %}

{% tabs %}
{% tab title="PHP" %}
{% code overflow="wrap" lineNumbers="true" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://sandbox.insurpass.com/api/merchant/micro_health/top_up',
  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 =>'{
    "subscription_type":"monthly",
    "amount" : 200000 ,
    "policy_no":"UIC/HGJ/7685/GHF"
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {{SECRETKEY}}',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

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

{% endcode %}
{% endtab %}

{% tab title="NODE JS" %}
{% code overflow="wrap" lineNumbers="true" %}

```javascript
var axios = require('axios');
var data = JSON.stringify({
  "subscription_type": "monthly",
  "amount": 200000,
  "policy_no": "UIC/HGJ/7685/GHF"
});

var config = {
  method: 'post',
  url: 'https://sandbox.insurpass.com/api/merchant/micro_health/top_up',
  headers: { 
    'Authorization': 'Bearer {{SECRETKEY}}', 
    'Content-Type': 'application/json'
  },
  data: data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
```

{% endcode %}
{% endtab %}

{% tab title="CURL" %}
{% code overflow="wrap" %}

```clike
curl --location --request POST https://sandbox.insurpass.com/api/merchant/micro_health/top_up' \
--header 'Authorization: Bearer {{SECRETKEY}}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "subscription_type": "monthly",
  "amount": 200000,
  "policy_no": "UIC/HGJ/7685/GHF"
}'
```

{% endcode %}
{% endtab %}
{% endtabs %}

## List of Micro-health Policy subscriptions

## This endpoint returns a list of all the  Micro-health Policy subscriptions

<mark style="color:blue;">`GET`</mark> `https://sandbox.insurpass.com/api/merchant/micro_health/all_subscriptions`

This endpoint allows a merchant to request for the list of all subscriptions made on their platform

#### Headers

| Name                                            | Type   | Description                     |
| ----------------------------------------------- | ------ | ------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer {$secret-key}/{$api-key} |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json                |

{% tabs %}
{% tab title="200 " %}
{% code overflow="wrap" lineNumbers="true" %}

```javascript
{
  "success": true,
  "data": {
    "current_page": 1,
    "data": [{
      "id": 32,
      "first_name": "tobimola",
      "middle_name": null,
      "surname": "tyidewale",
      "phone_no": "02090908910",

      "email": "oyideia8dewalet@gmail.com",
      "address": null,
      "gender": null,
      "date_of_birth": "1990-06-08T00:00:00.000000Z",
      "password": null,
      "policy_no": "2104205800051",
      "have_beneficiaries": true,
      "enable": true,
      "next_of_kin_full_name": "adewalet ayuba",
      "merchant_user_id": 1,
      "user_type": "user",
      "created_at": "2021-04-14T16:38:15.000000Z",
      "updated_at": "2021-04-14T16:38:25.000000Z",
      "beneficiary": [{
          "id": 3,
          "full_name": "adewalet ayuba",
          "surname": null,
          "email": null,
          "phone_no": null,
          "address": null,
          "gender": null,
          "date_of_birth": null,
          "product_id": null,
          "user_id": 32,
          "created_at": "2021-04-14T16:38:16.000000Z",
          "updated_at": "2021-04-14T16:38:16.000000Z"
        },
        {
          "id": 4,
          "full_name": "Ayomide Taiwp",
          "surname": null,
          "email": null,
          "phone_no": null,
          "address": null,
          "gender": null,
          "date_of_birth": null,
          "product_id": null,
          "user_id": 32,
          "created_at": "2021-04-14T16:38:16.000000Z",
          "updated_at": "2021-04-14T16:38:16.000000Z"
        },
        {

          "id": 5,
          "full_name": "third beneficiary ooo",
          "surname": null,
          "email": null,
          "phone_no": null,
          "address": null,
          "gender": null,
          "date_of_birth": null,
          "product_id": null,
          "user_id": 32,
          "created_at": "2021-04-14T16:38:16.000000Z",
          "updated_at": "2021-04-14T16:38:16.000000Z"
        }
      ],
      "subscriptions": {
        "id": 25,
        "user_id": 32,
        "product_id": 1,
        "recurring": true,
        "subscriptions_type": "monthly",
        "subscriptions_no": 1,
        "start_date": "2021-04-14T00:00:00.000000Z",
        "end_date": "2021-05-14T00:00:00.000000Z",
        "enable": 1,
        "policy_no": "2104205800051",
        "merchant_user_id": 1,
        "created_at": "2021-04-14T16:38:17.000000Z",
        "updated_at": "2021-04-14T16:38:24.000000Z",
        "active_date": "2021-04-18 00:00:00"
      },
      "transactions": [{
        "id": 32,
        "user_id": 32,
        "amount": "400.00",
        "product_id": 1,
        "status": "successful",
        "type": "credit",
        "subscriptions_id": 25,
        "merchant_user_id": 0,
        "created_at": "2021-04-14T16:38:17.000000Z",
        "updated_at": "2021-04-14T16:38:17.000000Z",
        "coverdor_commission": "50.00",

        "merchant_commission": "50.00",
        "total_commission": "100.00"
      }]
    }],

    "first_page_url": "http://insurpass-
    api.test / api / merchant / all_subscriptions ? page = 1 ",

    "from" : 1,
    "last_page": 1,

    "last_page_url": "http://insurpass-
    api.test / api / merchant / all_subscriptions ? page = 1 ",

    "next_page_url" : null,
    "path": "http://insurpass-api.test/api/merchant/all_subscriptions",
    "per_page": 15,
    "prev_page_url": null,
    "to": 1,
    "total": 1
  },
  "message": "Your subscribers get successful"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="PHP" %}
{% code overflow="wrap" lineNumbers="true" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://sandbox.insurpass.com/api/merchant/micro_health/all_subscriptions',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {{SECRETKEY}}'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endcode %}
{% endtab %}

{% tab title="NODE JS" %}
{% code overflow="wrap" lineNumbers="true" %}

```javascript
var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://sandbox.insurpass.com/api/merchant/micro_health/all_subscriptions',
  headers: { 
    'Authorization': 'Bearer {{SECRETKEY}}'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
```

{% endcode %}
{% endtab %}

{% tab title="CURL" %}
{% code overflow="wrap" %}

```clike
curl --location --request GET https://sandbox.insurpass.com/api/merchant/micro_health/all_subscriptions' \
--header 'Authorization: Bearer {{SECRETKEY}}' \
--header 'Accept: application/json' \
--data-raw ''
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
A merchant can request all subscribed customers' details either per day, week, month, quarter, year or from one specific date to another.
{% endhint %}

## Validate subscription by Policy number

## This endpoint validates a subscription by Policy number

<mark style="color:blue;">`GET`</mark> `https://sandbox.insurpass.com/api/merchant/micro_health/validate_policy/:policy_no`

This endpoint allows a merchant to request a specific customer's details by passing the customer's policy number for validation.

#### Path Parameters

| Name       | Type   | Description                                                                      |
| ---------- | ------ | -------------------------------------------------------------------------------- |
| policy\_no | String | The unique number that identifies the purchased  insurance policy - **20570819** |

#### Headers

| Name                                            | Type   | Description                     |
| ----------------------------------------------- | ------ | ------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer {$secret-key}/{$api-key} |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json                |

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

```javascript
{
    "success": true,
    "data": {
        "id": 25,
        "user_id": 32,
        "product_id": 1,
        "recurring": true,
        "subscriptions_type": "monthly",
        "subscriptions_no": 1,
        "start_date": "2021-04-14T00:00:00.000000Z",
        "end_date": "2021-05-14T00:00:00.000000Z",
        "enable": 1,
        "policy_no": "2104205800051",
        "merchant_user_id": 1,
        "created_at": "2021-04-14T16:38:17.000000Z",
        "updated_at": "2021-04-14T16:38:24.000000Z",
        "active_date": "2021-04-18 00:00:00",
        "product": {
            "id": 1,
            "name": "malerail care 1",
            "details": "<p>my product details</p>",
            "beneficiaries": true,
            "max_beneficiaries": 3,
            "provider_id": 1,
            "logo_url": null,
            "enable": true,
            "created_at": "2021-03-26T22:57:33.000000Z",
            "updated_at": "2021-03-26T22:57:34.000000Z"
        }
    },
    "message": "Subscription get successful"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="PHP" %}
{% code overflow="wrap" lineNumbers="true" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://sandbox.insurpass.com/api/merchant/micro_health/validate_policy/:policy_no',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {{SECRETKEY}}'
  ),
));

$response = curl_exec($curl);

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

{% endcode %}
{% endtab %}

{% tab title="NODE JS" %}
{% code overflow="wrap" lineNumbers="true" %}

```javascript
var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://sandbox.insurpass.com/api/merchant/micro_health/validate_policy/:policy_no',
  headers: { 
    'Authorization': 'Bearer {{SECRETKEY}}'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% endcode %}
{% endtab %}

{% tab title="CURL" %}
{% code overflow="wrap" %}

```clike
curl --location --request GET https://sandbox.insurpass.com/api/merchant/micro_health/validate_policy/:policy_no' \
--header 'Authorization: Bearer {{SECRETKEY}}' \
--header 'Accept: application/json' \
--data-raw ''
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://milonics.gitbook.io/api-documentation/insurpass-api-reference/subscription/credit-life-insurance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
