Add/Update Payment


The following endpoint can be used to add or update a payment within the Hyfin application that were already processed.


Punto Final

The following endpoint can be used to add or update a payment. 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}/payment/addUpdate

Solicitud
Campo
Tipo
Descripción
_id
String
El id del pago. Este campo es generado automáticamente por el sistema y no es necesario al crear un nuevo pago, pero es necesario al actualizar un pago existente.
externalId
String
The unique payment id from the source system/database. Required when _id is not passed in. If we detect a record with the same externalId, it will be updated, otherwise it will be added.
displayName
String
El nombre de visualización seguro y amigable del método de pago. Ejemplo: VISA **** 3421.
amount
Number
El monto que se pagó. Este es un número entero de centavos, por lo que 1035 significa $10.35.
paidOn
Date
La fecha y hora en que se realizó el pago. Format = YYYY-MM-DDTHH:mm:ssZ
gatewayTransactionId
String
El identificador único que se asignó al registro de pago desde la pasarela cuando se procesó el pago.
invoice
A reference to the orden de compra record. On a write this is how the payment is applied to an orden de compra; it is echoed back on a read, alongside the fuller allocations list.
status
String
El estado actual del pago.
Default = captured | One of declined, authorized, captured, voided, settled, returned, refundFailed, refunded, refundSettled
site
String
El _id del sitio
type
String
El tipo de método de pago utilizado para realizar el pago.
One of payment_card, ach, cash, check
subType
String
El subtipo del método de pago utilizado para realizar el pago.
One of checking, savings, visa, mastercard, discover, amex, cash, other
totals
Los montos totales del pago.
allocations
Las asignaciones para el pago. Este es un arreglo de objetos que especifican cómo se asignó el pago a diferentes pedidos o reembolsos.
deleted
Boolean
Esta bandera representa si el registro ha sido eliminado y ya no está disponible para ser utilizado.
Sample Request
			
{
  "externalId": "65432325",
  "gatewayTransactionId": "53912387124235234",
  "type": "payment_card",
  "subType": "visa",
  "displayName": "VISA **** 5123",
  "amount": 3515,
  "paidOn": "2021-01-01T14:32:18Z",
  "status": "captured",
  "allocations": [
    {
      "refType": "Invoice",
      "ref": "61f32dc2f62bdc6a48951255",
      "amount": 3515
    }
  ]
}


		
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.
updatedAt
Date
The date the record was last updated.
errors
String [ ]
A list of errors. Will only be returned if success is false.
Sample Response (Successful)
			
{
  "success": true,
  "action": "added",
  "_id": "60f720d248f143332af022e0",
  "updatedAt": "2025-05-30T19:19:44.143Z"
}


		
Sample Response (Failed)
			
{
  "success": false,
  "errors": [
    "invalid field2",
    "missing field_name"
  ]
}