Customer

Create, Find, Manage Customers

🧍 Create or Identify Customer

Securely.io identifies a Customer by their email or phone number. If the customer already exists in Securely.io, the customer data is returned.

curl -X POST \
  https://sandbox.securelyio.com/api/customers/import \
  -H "Authorization: Basic $(echo -n "$API_KEY:$API_SECRET" | base64)" \
  -H "Content-Type: application/json" \
  -d '{
    firstName: "first_name",
    lastName: "last_name",
    email: "email",
    phone: "phone",
    externalIdentifier: "member_id"
  }'
var apiKey = "YOUR_API_KEY";
var apiSecret = "YOUR_API_SECRET";
var encodedCredentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{apiKey}:{apiSecret}"));

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://sandbox-api.securelyme.io/customers/import");
request.Headers.Add("Authorization", $"Basic {encodedCredentials}");
var content = new StringContent("{\r\n    \"firstName\": \"Demarco\",\r\n    \"lastName\": \"Boyle\",\r\n    \"email\": \"[email protected]\",\r\n    \"phone\": \"281.500.1111\",\r\n    \"externalIdentifier\": \"CUSTOMER-001\"\r\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

const apiKey = "YOUR_API_KEY";
const apiSecret = "YOUR_API_SECRET";
const encodedCredentials = Buffer.from(`${apiKey}:${apiSecret}`).toString('base64');


const axios = require('axios');
let data = JSON.stringify({
  "firstName": "first_name",
  "lastName": "last_name",
  "email": "email_address",
  "phone": "phone_number",
  "externalIdentifier": "customer_identifier"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://sandbox-api.securelyme.io/customers/import',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': `Basic ${encodedCredentials}`
  },
  data : data
};

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

The response of this endpoint, is a list of customers ordered by the best match first.

πŸ“˜

Note:

Securely.io may standardize some of the customer data. For example: lower case names, will be converted to proper case and phone numbers will be standardized.

The payload of this call returns the standardized data. Subsequently, attempts to find a customer in Securely.io should use this standardized customer data.

API Reference: Import a customer.


πŸ” Find a Customer

If you have a repeat Customer, then, it may be better to search for the Customer in Securely.io.

curl -X POST \
  https://sandbox.securelyio.com/api/customers/search \
  -H "Authorization: Basic $(echo -n "$API_KEY:$API_SECRET" | base64)" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "email",
    "phone": "phone",
    "externalIdentifier": "member_id",
    "accountNumber": "account_number"
  }'
var apiKey = "YOUR_API_KEY";
var apiSecret = "YOUR_API_SECRET";
var encodedCredentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{apiKey}:{apiSecret}"));

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://sandbox.securelyio.com/api/customers/search");
request.Headers.Add("Authorization", $"Basic {encodedCredentials}");

var jsonData = @"{
    ""email"": ""email"",
    ""phone"": ""phone"",
    ""externalIdentifier"": ""member_id"",
    ""accountNumber"": ""account_number""
  }"

var content = new StringContent(jsonData, null, "application/json");
request.Content = content
;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

const apiKey = "YOUR_API_KEY";
const apiSecret = "YOUR_API_SECRET";
const encodedCredentials = Buffer.from(`${apiKey}:${apiSecret}`).toString('base64');


const axios = require('axios');
let data = JSON.stringify({
    "email": "email",
    "phone": "phone",
    "externalIdentifier": "member_id",
    "accountNumber": "account_number"
  });

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://sandbox.securelyio.com/api/customers/search',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': `Basic ${encodedCredentials}`
  },
  data : data
};

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

Some of the fields above are optional. You may choose to search only by email or only by external Identifier and email.

The response of this query, will be a list of customers with Securely.io for the given search criteria.

API Reference: Search for a customer.