Add/Update Payment


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


Point de terminaison

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/v3/site/{site_id}/payment/addUpdate

Demande
Champ
Type
Requis
Description
external_id
String
The unique payment id from the source system/database. If we detect a record with the same `external_id`, it will be updated, otherwise it will be added.
gateway_transaction_id
String
L'identifiant unique qui a été attribué à l'enregistrement de paiement par la passerelle lorsque le paiement a été traité.
display_name
String
The secure friendly display name of the payment method. Example: `VISA **** 3421`.
amount
Number
Le montant qui a été payé. Format = 0.00
paid_on
Date
La date et l'heure à laquelle le paiement a été effectué. Format = YYYY-MM-DDTHH:mm:ssZ
tip
Number
--
Le montant du pourboire qui a été ajouté. Format = 0.00
tax
Number
--
Le montant de taxe qui a été ajouté. Format = 0.00
fee
Number
--
Le montant des frais qui a été ajouté. Format = 0.00
invoice
--
Une référence à l'enregistrement de la facture.
payment_type
String
--
Le type de méthode de paiement utilisé pour effectuer le paiement.
One of `payment_card`, `ach`, `cash`, `check`
payment_sub_type
String
--
Le sous-type de la méthode de paiement utilisée pour effectuer le paiement.
One of `checking`, `savings`, `visa`, `mastercard`, `discover`, `amex`, `cash`, `other`
status
String
--
L'état actuel du paiement.
Default = `captured` | One of `declined`, `authorized`, `captured`, `voided`, `settled`, `returned`, `refundFailed`, `refunded`, `refundSettled`
active
Boolean
--
Ce drapeau représente si l'enregistrement de paiement est actif.
Default = `true`
Sample Request
			
				{
  "external_id": "65432325",
  "gateway_transaction_id": "53912387124235234",
  "payment_type": "payment_card",
  "payment_sub_type": "visa",
  "display_name": "VISA **** 5123",
  "amount": 35.15,
  "paid_on": "2021-01-01T14:32:18Z",
  "status": "captured",
  "invoice": {
    "external_id": "65432661"
  }
}
			
		
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"
  ]
}