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.
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
invoice
Una referencia al registro de la orden de compra.
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
			
{
  "_id": "61f32dc2f62bdc6a48945067",
  "gatewayTransactionId": "53912387124235234",
  "paymentType": "payment_card",
  "paymentSubType": "visa",
  "displayName": "VISA **** 5123",
  "amount": 3515,
  "paidOn": "2021-01-01T14:32:18Z",
  "status": "captured",
  "invoice": {
    "_id": "61f32dc2f62bdc6a48951255"
  }
}


		
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"
  ]
}