> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# Internal TED transfers (P2P)

> Move funds between Accounts within your institution in under 2 seconds, 24/7, without BACEN routing — automatic detection, no extra integration.

P2P transfers allow your customers to move funds between accounts within your institution instantly, typically at no cost, 24 hours a day. Fees can be configured per organization — see [Fee configuration](#fee-configuration) below. Because the transfer never leaves your system, it settles in under 2 seconds and requires no BACEN network involvement.

## When to use P2P

***

P2P is the right transfer type whenever both the sender and recipient hold accounts at your institution. Common scenarios include:

* **Moving money between a customer's own accounts** — a customer transferring from their checking account to their savings account, or between two accounts they manage.
* **Paying another customer at the same institution** — a customer sending money to a friend, family member, or business that also banks with you.
* **Internal treasury movements** — splitting balances between corporate accounts held within the same organization.
* **Payment splitting** — distributing amounts across multiple accounts for payroll, expense sharing, or cashback.

The plugin detects P2P automatically: when the recipient's ISPB matches your institution's ISPB, the transfer is routed internally. Your API integration is identical to TED OUT — no separate endpoint or logic required.

## Key advantages

***

| Aspect               | P2P                                   | TED OUT              |
| -------------------- | ------------------------------------- | -------------------- |
| **Settlement time**  | Under 2 seconds                       | 5–10 minutes         |
| **Operating hours**  | 24/7, including weekends and holidays | Mon–Fri, 06:30–17:00 |
| **Fee (default)**    | None                                  | Configurable         |
| **BACEN dependency** | None                                  | Required (JD SPB)    |

## How it works

***

P2P reuses the same API as TED OUT, so your integration remains consistent across transfer types. The process is two steps from the customer's perspective:

<img src="https://mintcdn.com/lerian-49cb71fc/b2nvatq9CwD1vsXB/images/en/docs/ted-how-it-works-p2p.jpg?fit=max&auto=format&n=b2nvatq9CwD1vsXB&q=85&s=cbac637ccf1f80015a0a58d8d106087e" alt="P2P flow diagram" width="1951" height="800" data-path="images/en/docs/ted-how-it-works-p2p.jpg" />

1. **Initiate** — Customer submits the transfer details. The plugin validates the recipient, checks the sender balance, and confirms the fee (typically R\$ 0.00). The customer sees the transfer summary before committing.
2. **Confirm** — Customer confirms. The plugin creates an atomic debit + credit in Midaz. The transfer completes immediately — typically within 2 seconds.

The two-step flow gives you a natural moment to show the customer a confirmation screen with the full transfer summary before any funds move.

## Transfer states

***

<img src="https://mintcdn.com/lerian-49cb71fc/L16w9jbmemhqlM9_/images/en/docs/ted-state-machine-ted-p2p.jpg?fit=max&auto=format&n=L16w9jbmemhqlM9_&q=85&s=08801b48480e5c33d9065cb281bfed06" alt="P2P state machine diagram" width="1725" height="905" data-path="images/en/docs/ted-state-machine-ted-p2p.jpg" />

| State        | What it means                                      |
| ------------ | -------------------------------------------------- |
| `CREATED`    | Transfer initiated, awaiting customer confirmation |
| `PROCESSING` | Midaz atomic transaction underway                  |
| `COMPLETED`  | Transfer settled — funds have moved                |
| `FAILED`     | Internal error; no funds were moved                |
| `CANCELLED`  | Cancelled by the customer before confirmation      |

<Note>
  The `PENDING` state does not apply to P2P transfers. `PENDING` is used in TED OUT to indicate funds reserved while awaiting SPB submission. P2P settles entirely within Midaz, so the transfer moves directly from `PROCESSING` to `COMPLETED` — typically in under 2 seconds.
</Note>

## Fee configuration

***

<Note>
  P2P fees are disabled by default. Most institutions offer internal transfers at no charge, but the configuration is available if your pricing model requires it. To enable fees for P2P, see [TED configuration](/en/midaz/plugins/ted/ted-configuration).
</Note>

## Recipient validation

***

The recipient must be a registered account within the same institution. When you submit a transfer, the plugin looks up the recipient in CRM using the bank details you provide (ISPB, branch, account, and holder document).

If the recipient is not found, the transfer is rejected and no funds are moved. The customer should verify the account details and try again.

## Technical integration

***

P2P uses the same endpoints as TED OUT. No additional integration work is required beyond what you already built for outbound transfers.

* [Initiate Transfer](/en/reference/midaz/plugins/ted/initiate-transfer) — POST /v1/transfers/initiate
* [Process Transfer](/en/reference/midaz/plugins/ted/process-transfer) — POST /v1/transfers/process
* [Get Transfer](/en/reference/midaz/plugins/ted/retrieve-transfer) — GET /v1/transfers/{transferId}

<Note>
  The `type` field in the transfer response will be `P2P`. There is no `controlNumber` on P2P transfers, as they do not go through JD SPB.
</Note>

## Error handling

***

P2P transfers are atomic: the debit and credit are created in a single Midaz transaction. If any part of the operation fails, the entire transaction is rolled back. There is no intermediate state where funds are partially moved or temporarily missing from an account.

If a transfer fails, the customer's balance is unchanged and they can retry. See the [full error list](/en/reference/midaz/plugins/ted/ted-error-list) for specific error codes and recovery guidance.
