4 - Webhooks
A webhook is a notification mechanism that enables automated communication between systems, sending relevant information in real-time to pre-configured endpoints. In the context of Closed Loop, webhooks are used to notify merchants about the status of their transactions directly in their Point of Sale (POS) system.
When a transaction is authorized, processed, or finalized, the FitBank system automatically sends a JSON payload with transaction details to the endpoint configured by the merchant. This integration ensures that merchants receive up-to date information about their transactions without the need for manual queries, promoting efficiency and automation.
How the Webhook Works:
- Automatic Trigger: When the status of a transaction changes (such as authorization, settlement, or error), the Closed Loop system triggers a webhook to the endpoint configured by the merchant.
- Reception in POS: The merchant's POS system receives the payload in JSON format, containing all relevant transaction details.
- Validation and Processing: The merchant's system validates the received content and updates the transaction status in its own system, enabling real-time tracking.
- HTTP Response: To confirm receipt, the merchant's system must return an HTTP 200 (OK) status code in response to the webhook. If not, the system will attempt to resend the webhook at predefined intervals.
Below is the JSON structure sent by the webhook, along with a description of each field:
-
JSON REQUEST:
{ "Method": "UpdatePurchaseClosedLoopStatusMongo", "BusinessUnitId": 66 "MerchantName": "Loja Exemplo", “UserName”: “José Ricardo” "UserAccountKey": "498191-209911-9590853-5", "Identifier": "PCL-TesteViniEntrys-c8a212b0-9d8f-40d1-896a-2ebf7f0c85f8", "Status": "CanBePreAuthorized", "Date": "2024-08-19T18:59:15.403415-03:00", "TotalValue": "20.00", "TransactionIdentifier": "TRA8ca7fe5d-99ce-4071-aa6c-0cfb23ee6060TRA", }
Parameter Descriptions:
Parameter | Type | Mandatory | Description | Example |
---|---|---|---|---|
Method | string | Yes | Method name | "UpdatePurchaseClosedLoopStatusMongo" |
BusinessUnitId | int | Yes | Information provided by FitBank | "234334" |
Partner | bigint | Yes | Information provided by FitBank | "847561" |
Status | tinyint | Yes | Transaction status | "Authorized" |
MerchantName | varchar | Yes | Name of the merchant associated with the transaction | "Super 24 - Montufar" |
UserName | varchar | Yes | Paying username | "José Ricardo" |
UserAccountKey | varchar | Yes | End user account identifier | "378320-014700-0146333-1" |
Identifier | varchar | Yes | Transaction description provided by the client | "PurchaseTESTEcloseLOOP" |
TotalValue | decimal | Yes | Total transaction value | 20.00 |
TransactionIdentifier | varchar | Yes | Transaction identifier | "TRA4eb415ef-5c63-4996-8957-e1d2e3a95415TRA" |
Note: For each transaction, the method name in the JSON must be updated accordingly.
- Purchase: "UpdatePurchaseClosedLoopStatusMongo"
- Withdrawal (Cash Out): "UpdateDepositClosedLoopStatusMongo"
- Deposit (Cash In): "UpdateWithdrawalClosedLoopStatusMongo"
Updated 25 days ago