Skip to main content

Customers

info

This object represents a customer of your business. It lets you create recurring charges and track payments that belong to the same customer.

All APIs endpoints

[POST] /users/customers

[GET] /users/customers

[GET] /users/customers:id

[PUT] /users/customers:id

[DEL] /users/customers

Create an customer

Parameters

  • email: required
    • Type: string
    • Validate: email input must be valid
  • first_name: required
    • Type: string
  • last_name: required
    • Type: string
  • phone: optional
    • Type: string
  • label_ids: optional
    • Type: string[]
    • description: a list of labels id to manage customer
  • address: optional
    • type address[]
    • description: a list of user's address
    • property
      • category: "Home" | "Office" | "Other"
      • location: object
        • name: string
        • geo: number[]

Request

curl --location --request POST 'http://localhost:9090/users/customers' \
--header 'x-app-id: 14e43e28-7e6d-461e-b1c9-7c54736f4331' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": "346dd239-cbe4-44fe-b9ee-be88fd2fa853",
"first_name": "customer",
"last_name": "first",
"phone": "+83497898519",
"email": "customer1@example.com",
"address": [
{
"category": "home",
"location": {
"name": "144 Xuan Thuy, United States Virgin Islands, United States Residential",
"geo": [46.80776431887119, -71.28464827789534]
}
}
],
"avatar": "",
"labels": ["b9a8f981-44e9-424c-89b5-79cde82a5fad", "eb4f3069-6a54-41b9-82e0-f95a8dd98ad1"],
"company_id": "231080c5-b622-4a25-aef8-c7e426927bb0",
"app_id": "14e43e28-7e6d-461e-b1c9-7c54736f4331"
}
}'

Response

{
"error": null,
"data": {
"id": "346dd239-cbe4-44fe-b9ee-be88fd2fa853",
"first_name": "customer",
"last_name": "first",
"phone": "+83497898519",
"email": "customer1@example.com",
"address": [
{
"category": "home",
"location": {
"name": "144 Xuan Thuy, United States Virgin Islands, United States Residential",
"geo": [46.80776431887119, -71.28464827789534]
}
}
],
"avatar": "",
"labels": [
"b9a8f981-44e9-424c-89b5-79cde82a5fad",
"eb4f3069-6a54-41b9-82e0-f95a8dd98ad1"
],
"company_id": "231080c5-b622-4a25-aef8-c7e426927bb0",
"app_id": "14e43e28-7e6d-461e-b1c9-7c54736f4331"
}
}

Get list of customers

Parameters


  • limit: optional
    • description: limit number of customer per page for pagination
    • default: 10
  • page: optional
    • description:current page for pagination
    • default: 1
  • sort_by: optional
    • description: sort by name or description by ASC/DECS
    • default: name
  • order_by: optional
    • description: sort by name or description by ASC/DECS
    • default: asc

Request

curl --location --request GET 'https://api-v1-stg.lumyri.com/users/customers?limit=10&page=1&search=&sort_by=name&order_by=asc' \
--header 'x-app-id: $APPLICATION_ID' \
--header 'Authorization: Bearer $ACCESS_TOKEN'

Response

{
"error": null,
"data": {
"total": 1,
"per_page": 1,
"current_page": 1,
"last_page": 1,
"data": [
{
"id": "346dd239-cbe4-44fe-b9ee-be88fd2fa853",
"first_name": "customer",
"last_name": "first",
"phone": "+83497898519",
"email": "customer1@example.com",
"address": [
{
"category": "home",
"location": {
"name": "144 Xuan Thuy, United States Virgin Islands, United States Residential",
"geo": [46.80776431887119, -71.28464827789534]
}
}
],
"avatar": "",
"labels": [
"b9a8f981-44e9-424c-89b5-79cde82a5fad",
"eb4f3069-6a54-41b9-82e0-f95a8dd98ad1"
],
"company_id": "231080c5-b622-4a25-aef8-c7e426927bb0",
"app_id": "14e43e28-7e6d-461e-b1c9-7c54736f4331"
}
]
}
}

get customer detail

Request

curl --location --request GET 'https://api-v1-stg.lumyri.com/users/customers/$CUSTMOMER_ID' \
--header 'x-app-id: $APPLICATION_ID' \
--header 'Authorization: Bearer $ACCESS_TOKEN'

Response

{
"id": "346dd239-cbe4-44fe-b9ee-be88fd2fa853",
"first_name": "customer",
"last_name": "first",
"phone": "+83497898519",
"email": "customer1@example.com",
"address": [
{
"category": "home",
"location": {
"name": "144 Xuan Thuy, United States Virgin Islands, United States Residential",
"geo": [46.80776431887119, -71.28464827789534]
}
}
],
"company_id": "231080c5-b622-4a25-aef8-c7e426927bb0",
"app_id": "14e43e28-7e6d-461e-b1c9-7c54736f4331",
"lables": [
{
"id": "b9a8f981-44e9-424c-89b5-79cde82a5fad",
"name": "label1",
"color": "red"
},
{
"id": "eb4f3069-6a54-41b9-82e0-f95a8dd98ad1",
"name": "label2",
"color": "green"
}
]
}

Update customer

Request

curl --location --request PUT 'http://localhost:9090/users/customers/dfe225ef-2a38-481b-83bd-c93b72cb2542' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wYW55X2lkIjoiMjMxMDgwYzUtYjYyMi00YTI1LWFlZjgtYzdlNDI2OTI3YmIwIiwiaXNzIjoiRGt5VFl6ZFR3RldKeUtLSk8xQjJsMndUbjBOTG5pdWQiLCJ1c2VyX2lkIjoiYzBjZDY2ZmUtYzA4Yi00NmMyLTk2OTctZTVlZDlhOTI3OTY5In0.l8aF5JdOw8gQpWK8xJ7Iobb7lOB-aGvYaLymzjLD-NI' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": "dfe225ef-2a38-481b-83bd-c93b72cb2542",
"first_name": "Phan",
"last_name": "Son 15",
"phone": "+83497898519",
"email": "home_address@lumyri.com",
"address": [
{
"category": "Home",
"location": {
"name": "82 Dich Vong Hau, United States Virgin Islands, United States Residential",
"geo": [
46.79810214256909,
-71.26258137960674
]
}
},
{
"category": "Office",
"location": {
"name": "Hoang Ngoc Building, United States Virgin Islands, United States Residential",
"geo": [
46.80776431887119,
-71.28464827789534
]
}
},
{
"category": "Other",
"location": {
"name": "61 Phung Chi Kien, United States Virgin Islands, United States Residential",
"geo": [
46.84558386923135,
-71.26885543171481
]
}
}
],
"avatar": "",
"labels": null,
"company_id": "956865a9-b9f7-4198-87eb-10b4f0f411c9",
"app_id": "14e43e28-7e6d-461e-b1c9-7c54736f4331"
}'

Response

{
"error": null,
"data": {
"id": "dfe225ef-2a38-481b-83bd-c93b72cb2542",
"first_name": "Phan",
"last_name": "Son 15",
"phone": "+83497898519",
"email": "home_address@lumyri.com",
"address": [
{
"category": "Home",
"location": {
"name": "82 Dich Vong Hau, United States Virgin Islands, United States Residential",
"geo": [46.79810214256909, -71.26258137960674]
}
},
{
"category": "Office",
"location": {
"name": "Hoang Ngoc Building, United States Virgin Islands, United States Residential",
"geo": [46.80776431887119, -71.28464827789534]
}
},
{
"category": "Other",
"location": {
"name": "61 Phung Chi Kien, United States Virgin Islands, United States Residential",
"geo": [46.84558386923135, -71.26885543171481]
}
}
],
"avatar": "",
"labels": null,
"company_id": "956865a9-b9f7-4198-87eb-10b4f0f411c9",
"app_id": "14e43e28-7e6d-461e-b1c9-7c54736f4331"
}
}

Delete customer

Request

curl --location --request DELETE 'localhost:9090/users/customers' \
--header 'Authorization: Bearer $ASSESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"customer_ids":["fbea0f23-e783-44e8-9cdc-9c4f69430f88"]
}'

Response

{
"error": null,
"data": {
"message": "OK"
}
}