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/v4/site/{site_id}/customer/addUpdate

Request
Field
Type
Required
Description
_id
String
The id of the customer. This field is auto generated by the system and is not required when creating a new customer, but it is required when updating an existing customer.
display_name
String
The name that will be displayed for the customer.
account_name
String
--
If the customer is a group, you may want to provide a business name or the customer's address here.
primary_contact
The customers primary contact information. Required if no `contacts` are provided.
contacts
A list of customer contacts. Required if `primary_contact` is not passed in.
parent_customer
String
--
The id of the parent customer, if applicable.
bill_to_parent_flag
Boolean
--
A flag indicating whether the parent customer should be billed for this customer. Only applicable if `parent_customer` is provided.
notes
String
--
Internal customer notes. Visible to merchant only.
attachment_refs
--
A list of attachments.
deleted
Boolean
--
Whether the customer record has been deleted and is no longer active.
Default = `false`
Sample Request (Add a Customer with a single contact)
			
				{
  "display_name": "ABC Plumbing",
  "primary_contact": {
    "first_name": "John",
    "last_name": "Doe",
    "mobile_phone": "333-444-5555",
    "email": "johndoe@abc.com",
    "billing_address": {
      "address_line1": "123 Main Street",
      "address_line2": "Suite 123",
      "city": "Naples",
      "state_code": "FL",
      "zip_code": "34102"
    }
  }
}
			
		
Sample Request (Add a Customer with multiple contacts)
			
				{
  "display_name": "ABC Plumbing",
  "contacts": [
    {
      "_id": "6839e415564d3cc21603221e",
      "isPrimary": true
    },
    {
      "_id": "6839e415564d3cc2160t623c",
      "isPrimary": false
    }
  ]
}
			
		
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"
  ]
}