Skip to content

Validate LDA

The purpose of this function is to validate if a consumer is of legal drinking age taking into consideration the country and type of alcohol.

Path

https://api.b-fonline.com/api/validate_lda

Method

POST

Required Parameters

  • birth_date (YYYY-MM-DD)
  • country (2 or 3 letter ISO code)
  • category ('spirits' or 'wine')

Responses

  • 200 OK
    • true (valid legal drinking age)
    • false (under legal drinking age)
  • 422 (Unprocessable Entity)
    • Error message in JSON response

Code Examples

1
2
3
4
5
6
7
8
9
curl -X POST \
  https://api.b-fonline.com/api/validate_lda \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{
    "birth_date": "1923-02-10",
    "country": "usa",
    "category": "wine"
  }'
var data = {
  birth_date: '1923-10-22',
  country: 'usa',
  category: 'wine'
};

var settings = {
  url: 'https://api.b-fonline.com/api/validate_lda',
  method: 'POST',
  data: JSON.stringify(data),
  contentType: 'application/json',
  dataType: 'json'
};

$.ajax(settings).done(function(response){
  console.log(response);
});
<?php

$api_url = 'https://api.b-fonline.com/api/validate_lda';

$data = array(
  'country' => 'USA',
  'birth_date' => '1980-01-01',
  'category' => 'spirits'
);

$data_string = json_encode($data);

$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_string))
);

$result = curl_exec($ch);
curl_close($ch);
var_dump($result);