> For the complete documentation index, see [llms.txt](https://docs.reveel.id/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reveel.id/api-references/transactions-old.md).

# Transactions - old

Here is the complete **Transactions API** page for Reveel PayID. It includes detailed request/response formats, error cases, and a parameter reference table.

***

### Parameter Reference

| Field            | Type      | Required               | Description                                                      |
| ---------------- | --------- | ---------------------- | ---------------------------------------------------------------- |
| `userId`         | string    | Yes                    | Sender’s user ID                                                 |
| `recipientPayId` | string    | Required\*             | PayID of the recipient (optional if `walletAddress` is provided) |
| `walletAddress`  | string    | Required\*             | Recipient's wallet address (alternative to PayID)                |
| `amount`         | number    | Yes                    | Amount to send                                                   |
| `token`          | string    | Yes                    | Token symbol (e.g. ETH, USDC)                                    |
| `network`        | string    | Yes                    | Network symbol (e.g. ETH, POL, BNB)                              |
| `message`        | string    | Optional               | Optional message                                                 |
| `privateKey`     | string    | Yes (in test endpoint) | Sender's private key for testing submission                      |
| `transaction`    | object    | Yes (in test endpoint) | Raw transaction object for signing                               |
| `confirmed`      | boolean   | Yes (webhook)          | Whether the tx is confirmed                                      |
| `txs`            | object\[] | Yes (webhook)          | Array of transaction metadata                                    |
| `page`           | number    | Optional               | Page number (for activity pagination)                            |
| `pageSize`       | number    | Optional               | Items per page (pagination)                                      |

### 1. Initialize Transaction

&#x20;`POST /transact/init-transaction`\
**Authentication:** Required

**Description**

Initializes a payment transaction for a user. The API computes routing logic, swap requirements, fees, and returns all data needed to sign and broadcast the transaction.

**Request Body**

```json
{
  "userId": "user-id",
  "recipientPayId": "username",        // Optional
  "walletAddress": "0x123abc...",      // Optional
  "amount": 1.5,
  "token": "ETH",
  "network": "ETH",
  "message": "Payment for services"    // Optional
}
```

> Note: Either `recipientPayId` or `walletAddress` must be provided.

**Success Response — `200 OK`**

```json
{
  "success": true,
  "message": "Transaction initialized successfully",
  "data": {
    "amount": 1.5,
    "token": "ETH",
    "network": "ETH",
    "tx": {
      "to": "0xrecipient...",
      "data": "0x6572b...",
      "value": "1500000000000000000",
      "chainId": "1"
    },
    "fees": {
      "applicationFee": null,
      "protocolFee": null,
      "bridgeFee": null
    }
  }
}
```

**Error Responses**

| HTTP Code                   | Description                                                 |
| --------------------------- | ----------------------------------------------------------- |
| `400 Bad Request`           | Missing fields, invalid types, unsupported token or network |
| `404 Not Found`             | PayID or wallet not found                                   |
| `500 Internal Server Error` | Transaction setup failed                                    |

Example:

```json
{
  "success": false,
  "message": "Unsupported token or network combination",
  "error": "Token ETH is not supported on network XYZ"
}
```

***

### 2. Transaction Webhook

&#x20;`POST /transact/txn-webhook`\
**Authentication:** None\
**Description:** Receives real-time transaction confirmations (from Moralis or equivalent).

**Request Body**

```json
{
  "confirmed": true,
  "chainId": "1",
  "txs": [
    {
      "hash": "0xtxhash...",
      "gas": "21000",
      "input": "0xinput...",
      "fromAddress": "0xsender...",
      "toAddress": "0xrecipient...",
      "value": "1000000000000000000",
      "triggered_by": ["0xsender..."]
    }
  ]
}
```

**Success Response — `200 OK`**

```json
{
  "ok": true
}
```

**Error Responses**

| HTTP Code                   | Description                                                        |
| --------------------------- | ------------------------------------------------------------------ |
| `200 OK`                    | If payload is invalid, returns `success: false` with error message |
| `500 Internal Server Error` | Unexpected error during processing                                 |

***

### 3. Get User Activity

`GET /transact/get-activity`\
**Authentication:** Required

**Query Parameters**

* `userId` (string, required)
* `page` (number, optional, default: 1)
* `pageSize` (number, optional, default: 10)

**Success Response — `200 OK`**

```json
{
  "success": true,
  "data": {
    "activities": [
      {
        "id": "activity-id",
        "hash": "0xtxhash...",
        "confirmed": true,
        "message": "Payment for services",
        "amount": "1.5",
        "senderId": "sender-user-id",
        "receiverId": "receiver-user-id",
        "walletAddress": "0xwallet...",
        "routeId": "route-id",
        "incomingNetwork": "ETH",
        "incomingToken": "ETH",
        "swapNetwork": "POL",
        "swapToken": "USDC",
        "applicationFee": "0.01",
        "bridgeFee": "0.02",
        "protocolFee": "0.005",
        "totalFee": "0.035",
        "createdAt": "2023-01-01T00:00:00.000Z",
        "updatedAt": "2023-01-01T00:00:00.000Z"
      }
    ],
    "pagination": {
      "totalCount": 45,
      "totalPages": 5,
      "currentPage": 1,
      "pageSize": 10
    }
  }
}
```

**Error Responses**

| HTTP Code                   | Description             |
| --------------------------- | ----------------------- |
| `400 Bad Request`           | Missing `userId`        |
| `401 Unauthorized`          | Invalid/missing API key |
| `500 Internal Server Error` | Data fetch failed       |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.reveel.id/api-references/transactions-old.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
