How it works
Receiving a TED is an automatic process detected by the polling worker every 30 seconds.

- The origin bank sends the TED to JD SPB
- Every 30 seconds, the TED Plugin polls JD via the
RecebeMensagemservice - On detection, the plugin processes the transfer and credits the recipient account
- Optionally, a webhook notifies your system in real time
Detection flow
- Every 30 seconds, the worker queries JD’s
RecebeMensagemservice - When finding a new
STR0008R2message that doesn’t correspond to a transfer sent by the system, it’s identified as an incoming TED - The raw XML message is immediately saved in the
JDIncomingMessagetable (at-least-once delivery guarantee with deduplication)
Processing
- Creates a new
Transferentity with typeTED_INand statusRECEIVED - Validates if the recipient’s account exists in CRM
- If the recipient is valid, calculates the cashin fee (if enabled)
- Credits the account in Midaz through
CreateCashinTransaction - Updates status to
COMPLETED - Sends webhook notification
Timeline
- T+0s — External bank sends the TED
- T+30s — Polling detects message via
RecebeMensagem; persisted inJDIncomingMessage→RECEIVED - T+32s — Recipient validated in CRM →
PROCESSING - T+35s — Account credited via
CreateCashinTransaction→COMPLETED - T+36s — Webhook notification sent
TED IN states
| State | Description |
|---|---|
RECEIVED | Transfer detected, awaiting processing |
PROCESSING | Validating recipient and preparing credit |
COMPLETED | Amount credited to recipient’s account |
REJECTED | Recipient not found or invalid account |
Query received transfers
Endpoint: GET /v1/transfers
Query parameters
| Parameter | Type | Description |
|---|---|---|
type | String | Filter by type (TED_IN) |
status | String | Filter by status (COMPLETED, REJECTED) |
fromDate | ISO8601 | Period start date |
toDate | ISO8601 | Period end date |
pageNumber | Integer | Page number (default: 1) |
pageSize | Integer | Items per page (default: 50, max: 100) |
Response
Transfer details
Endpoint: GET /v1/transfers/
Response
Receiving fee (cashin)
The plugin can charge a fee on received transfers. Configuration is done per organization. When enabled, the fee is calculated via plugin-fees and deducted from the credited amount:
Example with fee
Recipient validation
The plugin validates the recipient using the document (CPF/CNPJ) provided in the STR0008R2 message:
- Queries CRM by document
- If found, identifies the corresponding account
- If not found, initiates chargeback
Rejected transfer
When the recipient is not found, a chargeback is automatically sent to the origin bank:Error handling
Receiving webhook
Configure a webhook to be notified in real-time about received transfers.
Event: transfer.incoming
Reconciliation
For accounting reconciliation, use the following fields:
| Field | Usage |
|---|---|
controlNumber | JD SPB control number (unique per transfer) |
transferId | Lerian internal identifier |
createdAt | Detection timestamp |
completedAt | Credit timestamp |
Processing guarantees
The plugin implements guarantees to avoid duplicates and losses:
| Guarantee | Implementation |
|---|---|
| At-least-once | Messages persisted BEFORE processing |
| Idempotency | Same sequenceNumber is not processed twice |
| Retry | Transient failures retried with exponential backoff |
| DLQ | Permanent failures go to dead-letter queue |
CRITICAL: The message is persisted in the
JDIncomingMessage table BEFORE processing, ensuring no transfer is lost in case of failure.
