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

# P2P

# Overview

The P2P object represents a payment from one of your activated `direct` connections to another. P2P payments must be individually authorized by the sender within 10 minutes of creation, using a verification code sent to their mobile device. Once committed, P2P payments are initiated immediately, and cannot be canceled.

<Note>
  **Permission Required**<br /><br />
  Executing peer to peer transactions requires the `payment.debit` permission from the source Account Connection and the `payment.credit` permission from the destination Account Connection. Since peer to peer implementations typically allow free money flow to/from all peers, we recommend requesting both permissions from all users.
</Note>

***

# Methods

<Tabs>
  <Tab title="Create">
    <Card icon="square-plus" iconType="solid" color="#86B74B">
      **`POST`  /p2p**<br />
      Initiate a payment between your Account Connections.
    </Card>

    ## Body Parameters

    <ParamField body="source" type="string" required="true">
      ID of the Account Connection sending money.
    </ParamField>

    <ParamField body="destination" type="string" required="true">
      ID of the Account Connection receiving money.
    </ParamField>

    <ParamField body="amount_in_cents" type="number" required="true">
      Amount in cents, e.g. \$1.00 would be the number 100.
    </ParamField>

    <ParamField body="description" type="string">
      Description of payout. (Visible to creators.) Default value: `Payment from ${sourceFullName} to ${destinationFullName}`
    </ParamField>

    <ParamField body="user_data" type="object">
      User defined data that can be attached to the object. See the [User Data](/reference/user-data) page for details.
    </ParamField>

    ## Example

    <CodeGroup>
      ```json Request theme={null}
      // POST /p2p
      {
          "source": "acon_XXXXX",
          "destination": "acon_YYYYY",
          "amount_in_cents": 2000,
          "description": "Thanks for your help!"
      }
      ```

      ```json Response theme={null}
      {
          "id": "p2p_XXXXX",
          "status": "created",
          "source": "acon_XXXXX",
          "destination": "acon_YYYYY",
          "amount_in_cents": 2000,
          "description": "Thanks for your help!",
          "expires_at": "2024-11-12T20:32:49.075Z",
          "failed_commits": 0,
          "userdata": {},
          "created_at": "2024-11-12T20:22:49.075Z",
          "updated_at": "2024-11-12T20:22:49.075Z"
      }
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Commit">
    <Card icon="square-star" iconType="solid" color="#86B74B">
      **`POST`  /p2p/:id/commit**<br />
      Execute P2P payment. Requires verification code sent to the source account connection's verified mobile device. Include an [**idempotency key**](/reference/idempotency) header to make the request idempotent.
    </Card>

    ## Path Parameters

    <ParamField path="id" type="string" required="true">
      The ID of the P2P payment to commit.
    </ParamField>

    ## Body Parameters

    <ParamField body="code" type="string" required="true">
      Verification code sent to source account connection's verified mobile device.
    </ParamField>

    ## Example

    <CodeGroup>
      ```json Request theme={null}
      // POST /p2p/p2p_XXXXX/commit
      {
          "code": "123456"
      }
      ```

      ```json Response theme={null}
      {
          "id": "p2p_XXXXX",
          "status": "pending",
          "source": "acon_XXXXX",
          "destination": "acon_YYYYY",
          "amount_in_cents": 2000,
          "description": "Thanks for your help!",
          "expires_at": "2024-11-12T20:32:49.075Z",
          "failed_commits": 0,
          "userdata": {},
          "created_at": "2024-11-12T20:22:49.075Z",
          "updated_at": "2024-11-12T20:22:49.075Z"
      }
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Get">
    <Card icon="square-arrow-right" iconType="solid" color="#425BE0">
      **`GET`  /p2p/:id**<br />
      Get details of one of your P2P payments.
    </Card>

    ## Path Parameters

    <ParamField path="id" type="string" required="true">
      The ID of the P2P payment to retrieve.
    </ParamField>

    ## Example

    <CodeGroup>
      ```json Response theme={null}
      {
          "id": "p2p_XXXXX",
          "status": "created",
          "source": "acon_XXXXX",
          "destination": "acon_YYYYY",
          "amount_in_cents": 2000,
          "description": "Thanks for your help!",
          "expires_at": "2024-11-12T20:32:49.075Z",
          "failed_commits": 0,
          "userdata": {},
          "created_at": "2024-11-12T20:22:49.075Z",
          "updated_at": "2024-11-12T20:22:49.075Z",
      }
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Update">
    <Card icon="square-pen" iconType="solid" color="#F1E067">
      **`PUT`  /p2p/:id**<br />
      Update data associated with one of your enterprise's P2P payments. Since Manifest sends a verification message to the source account connection upon P2P creation, we do not let you update P2P fields that might materially change the nature of transaction.
    </Card>

    ## Path Parameters

    <ParamField path="id" type="string" required="true">
      The ID of the P2P payment to update.
    </ParamField>

    ## Body Parameters

    <ParamField body="user_data" type="object">
      User defined data that can be attached to the object. See the [User Data](/reference/user-data) page for details.
    </ParamField>

    ## Example

    <CodeGroup>
      ```json Request theme={null}
      // PUT /p2p/p2p_XXXXX
      {
        "userdata": {
          "key": "value"
        }
      }
      ```

      ```json Response theme={null}
      {
          "id": "p2p_XXXXX",
          "status": "created",
          "source": "acon_XXXXX",
          "destination": "acon_YYYYY",
          "amount_in_cents": 2000,
          "description": "Thanks for your help!",
          "expires_at": "2024-11-12T20:32:49.075Z",
          "failed_commits": 0,
          "userdata": {
              "key": "value"
          },
          "created_at": "2024-11-12T20:22:49.075Z",
          "updated_at": "2024-11-12T20:22:49.075Z",
      }
      ```
    </CodeGroup>
  </Tab>

  <Tab title="List">
    <Card icon="square-list" iconType="solid" color="#BDE1CD">
      **`GET`  /p2p**<br />
      List all P2P payments created by your enterprise.
    </Card>

    ## Query Parameters

    <ParamField query="page" type="integer">
      The page number to return. Default is 1.
    </ParamField>

    <ParamField query="page_size" type="integer">
      The number of items to return per page. Default is 10.
    </ParamField>

    ## Example

    <CodeGroup>
      ```json Response theme={null}
      {
          "data": [
              {
                  "id": "p2p_XXXXX",
                  "status": "created",
                  "source": "acon_YYYYY",
                  "destination": "acon_XXXXX",
                  "amount_in_cents": 2000,
                  "description": "Thanks for your help!",
                  "expires_at": "2024-11-12T20:32:49.075Z",
                  "failed_commits": 0,
                  "userdata": {},
                  "created_at": "2024-11-12T20:22:49.075Z",
                  "updated_at": "2024-11-12T20:22:49.075Z",
              },
              {
                  "id": "p2p_YYYYY",
                  "status": "sent",
                  "source": "acon_XXXXX",
                  "destination": "acon_YYYYY",
                  "amount_in_cents": 2000,
                  "description": "Session",
                  "expires_at": "2024-11-12T20:32:49.075Z",
                  "failed_commits": 0,
                  "userdata": {},
                  "created_at": "2024-11-12T20:22:49.075Z",
                  "updated_at": "2024-11-12T20:22:49.075Z",
              },
              {
                  "id": "p2p_ZZZZZ",
                  "status": "created",
                  "source": "acon_XXXXX",
                  "destination": "acon_ZZZZZ",
                  "amount_in_cents": 2000,
                  "description": "Thanks for your help!",
                  "expires_at": "2024-11-12T20:32:49.075Z",
                  "failed_commits": 0,
                  "userdata": {},
                  "created_at": "2024-11-12T20:22:49.075Z",
                  "updated_at": "2024-11-12T20:22:49.075Z",
              },
          ],
          "pagination": {
              "page": 1,
              "page_size": 10,
              "total": 3
          }
      }
      ```
    </CodeGroup>
  </Tab>

  <Tab title="List For Account Connection">
    <Card icon="square-list" iconType="solid" color="#BDE1CD">
      **`GET`  /account-connection/:id/p2p**<br />
      List all P2P payments to/from a specific account connection.
    </Card>

    ## Path Parameters

    <ParamField path="id" type="string" required="true">
      The ID of the Account Connection to list P2P payments for.
    </ParamField>

    ## Query Parameters

    <ParamField query="page" type="integer">
      The page number to return. Default is 1.
    </ParamField>

    <ParamField query="page_size" type="integer">
      The number of items to return per page. Default is 10.
    </ParamField>

    ## Example

    <CodeGroup>
      ```json Response theme={null}
      {
          "data": [
              {
                  "id": "p2p_XXXXX",
                  "status": "created",
                  "source": "acon_YYYYY",
                  "destination": "acon_XXXXX",
                  "amount_in_cents": 2000,
                  "description": "Thanks for your help!",
                  "expires_at": "2024-11-12T20:32:49.075Z",
                  "failed_commits": 0,
                  "userdata": {},
                  "created_at": "2024-11-12T20:22:49.075Z",
                  "updated_at": "2024-11-12T20:22:49.075Z",
              },
              {
                  "id": "p2p_YYYYY",
                  "status": "sent",
                  "source": "acon_XXXXX",
                  "destination": "acon_YYYYY",
                  "amount_in_cents": 2000,
                  "description": "Session",
                  "expires_at": "2024-11-12T20:32:49.075Z",
                  "failed_commits": 0,
                  "userdata": {},
                  "created_at": "2024-11-12T20:22:49.075Z",
                  "updated_at": "2024-11-12T20:22:49.075Z",
              },
              {
                  "id": "p2p_ZZZZZ",
                  "status": "created",
                  "source": "acon_XXXXX",
                  "destination": "acon_ZZZZZ",
                  "amount_in_cents": 2000,
                  "description": "Thanks for your help!",
                  "expires_at": "2024-11-12T20:32:49.075Z",
                  "failed_commits": 0,
                  "userdata": {},
                  "created_at": "2024-11-12T20:22:49.075Z",
                  "updated_at": "2024-11-12T20:22:49.075Z",
              },
          ],
          "pagination": {
              "page": 1,
              "page_size": 10,
              "total": 3
          }
      }
      ```
    </CodeGroup>
  </Tab>

  <Tab title="List For Peers">
    <Card icon="square-list" iconType="solid" color="#BDE1CD">
      **`GET`  /account-connection/:id/p2p/:peer\_id**<br />
      List all P2P between two specific account connections.
    </Card>

    ## Path Parameters

    <ParamField path="id" type="string" required="true">
      Account Connection ID
    </ParamField>

    <ParamField path="peer_id" type="string" required="true">
      Peer Account Connection ID
    </ParamField>

    ## Query Parameters

    <ParamField query="page" type="integer">
      The page number to return. Default is 1.
    </ParamField>

    <ParamField query="page_size" type="integer">
      The number of items to return per page. Default is 10.
    </ParamField>

    ## Example

    <CodeGroup>
      ```json Response theme={null}
      {
          "data": [
              {
                  "id": "p2p_XXXXX",
                  "status": "created",
                  "source": "acon_YYYYY",
                  "destination": "acon_XXXXX",
                  "amount_in_cents": 2000,
                  "description": "Thanks for your help!",
                  "expires_at": "2024-11-12T20:32:49.075Z",
                  "failed_commits": 0,
                  "userdata": {},
                  "created_at": "2024-11-12T20:22:49.075Z",
                  "updated_at": "2024-11-12T20:22:49.075Z",
              },
              {
                  "id": "p2p_YYYYY",
                  "status": "sent",
                  "source": "acon_XXXXX",
                  "destination": "acon_YYYYY",
                  "amount_in_cents": 2000,
                  "description": "Session",
                  "expires_at": "2024-11-12T20:32:49.075Z",
                  "failed_commits": 0,
                  "userdata": {},
                  "created_at": "2024-11-12T20:22:49.075Z",
                  "updated_at": "2024-11-12T20:22:49.075Z",
              }
          ],
          "pagination": {
              "page": 1,
              "page_size": 10,
              "total": 2
          }
      }
      ```
    </CodeGroup>
  </Tab>
</Tabs>

***

# Properties

<ParamField path="id" type="string">
  Identifier for this payout.
</ParamField>

<ParamField path="source" type="string">
  ID of Account Connection sending money.
</ParamField>

<ParamField path="destination" type="string">
  ID of Account Connection receiving money.
</ParamField>

<ParamField path="amount_in_cents" type="number">
  Amount in cents, e.g. \$1.00 would be the number 100.
</ParamField>

<ParamField path="description" type="string">
  Description of payout. (Visible to creators.) Default value: `Payment from ${sourceFullName} to ${destinationFullName}`
</ParamField>

<ParamField path="status" type="string">
  Status of payout. One of:

  | Status    | Description                                                                                                                                                          |
  | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `created` | Initial status after object creation. Requires [Commit P2P](#methods) method to be executed.                                                                         |
  | `pending` | P2P has been committed, but payment is not complete.                                                                                                                 |
  | `sent`    | The payment was completed and the amount is now available in the destination account.                                                                                |
  | `error`   | The payment encountered an error during processing. The reasons a payment might be set to error include non-sufficient funds, suspected fraud, or failed validation. |
</ParamField>

<ParamField path="exprires_at" type="date">
  When the P2P expires, set to 10 minutes after object creation. Formatted as [ISO 8601 date/time string](https://www.w3.org/TR/NOTE-datetime).
</ParamField>

<ParamField path="failed_commits" type="number">
  Count of failed commit attempts. Once a P2P has failed 3 times, it instantly expires.
</ParamField>

<ParamField path="user_data" type="object">
  User defined data that can be attached to the object. See the [User Data](/reference/user-data) page for details.
</ParamField>
