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.


Punto Final

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

Solicitud
Campo
Tipo
Requerido
Descripción
_id
String
El id del cliente. Este campo es generado por el sistema y no es necesario al crear un nuevo cliente, pero es necesario al actualizar un cliente existente.
display_name
String
El nombre que se mostrará al cliente.
account_name
String
--
Si el cliente es un grupo, es posible que desees proporcionar un nombre comercial o la dirección del cliente aquí.
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
--
El id del cliente padre, si corresponde.
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
--
Notas internas del cliente. Visible solo para el comerciante.
attachment_refs
--
Una lista de adjuntos.
deleted
Boolean
--
Si el registro del cliente ha sido eliminado y ya no está activo.
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
    }
  ]
}
			
		
Respuesta
Campo
Tipo
Descripción
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"
  ]
}