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
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.
displayName
String
El nombre que se mostrará al cliente.
accountName
String
Si el cliente es un grupo, es posible que desees proporcionar un nombre comercial o la dirección del cliente aquí.
primaryContact
La información de contacto principal de los clientes. Requerida si no se proporcionan contacts.
contacts
Una lista de contactos de clientes. Requerido si no se pasa primaryContact.
parentCustomer
String
El id del cliente padre, si corresponde.
billToParentFlag
Boolean
Una bandera que indica si se debe facturar al cliente principal por este cliente. Solo aplicable si se proporciona parentCustomer.
notes
String
Notas internas del cliente. Visible solo para el comerciante.
attachmentRefs
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)
			
{
  "displayName": "ABC Plumbing",
  "primaryContact": {
    "firstName": "John",
    "lastName": "Doe",
    "mobilePhone": "333-444-5555",
    "email": "johndoe@abc.com",
    "billingAddress": {
      "addressLine1": "123 Main Street",
      "addressLine2": "Suite 123",
      "city": "Naples",
      "stateCode": "FL",
      "zipCode": "34102"
    }
  }
}


		
Sample Request (Add a Customer with multiple contacts)
			
{
  "displayName": "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"
  ]
}