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.


Point de terminaison

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

Demande
Champ
Type
Requis
Description
_id
String
L'identifiant du client. Ce champ est généré par le système et n'est pas requis lors de la création d'un nouveau client, mais il est requis lors de la mise à jour d'un client existant.
display_name
String
Le nom qui sera affiché pour le client.
account_name
String
--
Si le client est un groupe, vous voudrez peut-être fournir un nom d'entreprise ou l'adresse du client ici.
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
--
L'identifiant du client parent, si 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
--
Notes internes pour le client. Visible seulement par le commerçant.
attachment_refs
--
Une liste de pièces jointes.
deleted
Boolean
--
Que le dossier du client ait été supprimé et n'est plus actif.
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
    }
  ]
}
			
		
Réponse
Champ
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"
  ]
}