Add/Update Customer


The following endpoint can be used to add or update a customer within the Hyfin application. The customer mobile phone number and email address will be used to send payment requests to the customer.


Endpoint

The following endpoint can be used to add or update a customer. You must replace the {base_url} and {site_id} variable with the site id that was provided when the site was created.

POST
{base_url}/api/v3/site/{site_id}/customer/addUpdate

Request
Field
Type
Required
Description
external_id
String
The unique customer id from the source system/database. If we detect a record with the same `external_id`, it will be updated, otherwise it will be added.
first_name
String
The first name of the customer.
last_name
String
The last name of the customer.
account_name
String
--
If the customer is a business, you may use this field as an extra identifier (Ex. 123 Main Street or ABC Company).
mobile_phone
String
--
The customers mobile phone number. Required if `notification_options.notify_phone` is enabled.
email
String
--
The customers email address. Required if `notification_options.notify_email` is enabled.
notes
String
--
Internal customer notes. Visible to merchant only.
active
Boolean
--
Whether the customer record is active and available to be used.
Default = `true`
notification_options
--
The customer's preferences for receiving notifications via text message and email.
Sample Request
			
				{
  "external_id": "39772634",
  "first_name": "John",
  "last_name": "Doe",
  "account_name": "",
  "mobile_phone": "111-222-3333",
  "email": "johndoe@abc.com",
  "notes": "World's best customer",
  "active": true,
  "notification_options": {
    "notify_phone": true,
    "notify_email": true
  }
}
			
		
Response
Field
Type
Description
success
Boolean
Whether the record was added or updated successfully.
action
String
Informs whether the record was added or updated. Will only be returned if `success` is `true`.
One of `added`, `updated`
_id
String
The auto generated id assigned to the record.
errors
String [ ]
A list of errors. Will only be returned if `success` is `false`.
Sample Response (Successful)
			
				{
  "success": true,
  "action": "added",
  "_id": "60f720d248f143332af022e0"
}
			
		
Sample Response (Failed)
			
				{
  "success": false,
  "errors": [
    "invalid field2",
    "missing field_name"
  ]
}