---
# System prepended metadata

title: 'Custos Enterprise API - API-P02 Custos membership authentication from contracted vendors '
tags: [合作店家]

---

# Custos membership authentication from contracted vendors
Custos-Enterprise API-P02
V1.0	

Contracted vendors will have to check if the customers have Custos membership. If they have, they will call [API-P01](https://hackmd.io/@custos-it/SkpdkLrK3) to send transaction details back to Custos. Otherwise they will ignore [API-P01](https://hackmd.io/@custos-it/SkpdkLrK3).

Contracted vendors provide an interface for customers to enter their cellphone number which is used for Custos membership registration.

[toc]
## Initiate

1. Request parameters：
(1)	Contracted vendor's serial number (#vendor_corp_data_id)
(2)	Cellphone number: cellphone number used for Custos membership registration (#emp_phone)
(3)	Country and language setting (#language_setting)

2. Create system log: Contracted vendor #vendor_corp_data_id|Custos membership authentication|Process starts

## API Process Start
1.	Check if this customer has active Custos membership by his/her cellphone number (#emp_phone)
*select data_id, corp_data_id from corp_member_emp where emp_phone = '#emp_phone' and status = 'Y'*

2.	If this customer has active Custos membership, response result = 'Y' and create a new record in the following table:
*insert into corp_member_emp_vendor_connection (vendor_corp_data_id, emp_corp_data_id, emp_data_id) values (#vendor_corp_data_id, #corp_data_id, #data_id)*

3.	Otherwise, response result = 'N' and message = 'This phone number is not a valid Custos member.'

## API Process End
Create system log: Contracted vendor #vendor_corp_data_id|Custos membership authentication|Process ends

## Exception Handling
If there is error/exception occurs, create an error log: [YYYYMMDDHHMMSS] Enterprise-API-P02 Error! Message: (the system exception messages).

## Specification and Sample
|API No.|Enterprise-API-P02|
|-|-|
|API Name|checkCustosMembership|
|URL|${url}/APP/getData/checkCustosMembership|
|Purpose|Custos membership authentication|
|Description|Contracted vendors check if the customers have Custos membership.|
|Content-Type|application/json|

**Request**
|Parameters|Data Type|Mandatory|Length|Description|
|-|-|:-:|:-:|-|
|vendor_corp_data_id|INT|Y||Contracted vendor's serial number|
|emp_phone|String|Y|16|Cellphone number used for Custos membership registration|
|language_setting|String|Y|10|Country and language setting|

**Response**
|Parameters|Data Type|Mandatory|Description|
|-|-|:-:|-|
|result|String|Y|API process result，Y: Successfully, N: Failure|
|message|String|N|API process failure description|

**Request Sample**
```javascript
var input = {
  "vendor_corp_data_id": 12,
  "emp_phone": "0912345678",
  "language_setting": "en-SG"
}
```
**Response Sample**
```javascript
{	
  "result": "Y",	//API process result
  "message": "..."	//API process failure description
}	
```