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

# Transactions

View transaction history, stats, and export data

Transactions represent completed or in-progress payments through your payment links and checkout sessions. The transactions API is read-only -- transactions are created automatically when customers pay through your checkout flow.

Transaction amounts are stored in the token's smallest unit (e.g., 6 decimals for USDC). The `amount_usd` field provides the USD equivalent at the time of the transaction.

## The Transaction object

**id**

Unique identifier for the transaction (e.g., `tx_abc123`).

**status**

Current status of the transaction. One of: `pending`, `confirming`, `completed`, `failed`.

**amount**

Transaction amount in the token's smallest unit.

**amount_usd**

USD equivalent of the transaction amount at the time of payment.

**token_address**

Contract address of the received token.

**chain_id**

Chain ID where the payment was received.

**tx_hash**

On-chain transaction hash. Null while `pending`.

**payer_address**

Wallet address of the payer.

**recipient_address**

Wallet address that received the payment.

**customer_id**

Associated customer ID, if the payer is a known customer.

**payment_link_id**

Payment link that originated this transaction.

**session_id**

Checkout session that originated this transaction.

**source_chain_id**

If the payer paid from a different chain, this is the chain they paid from.

**source_token_address**

If the payer paid with a different token, this is the token they paid with.

**source_amount**

The amount the payer sent (before swap/bridge), in the source token's smallest unit.

**fee_amount**

Platform fee amount in the received token's smallest unit.

**form_data**

Custom form data submitted by the customer during checkout.

**shipping_address**

Shipping address provided by the customer.
  **shipping address fields**

**name** Recipient name.
    **line1** Address line 1.
    **line2** Address line 2.
    **city** City.
    **state** State or province.
    **postal_code** Postal or ZIP code.
    **country** Two-letter country code.

**shipping_option**

Selected shipping option.
  **shipping option fields**

**id** Shipping option ID.
    **name** Shipping option name.
    **amount** Shipping cost.

**metadata**

Metadata from the checkout session.

**created_at**

ISO 8601 timestamp when the transaction was initiated.

**confirmed_at**

ISO 8601 timestamp when the transaction reached `confirming` status.

**completed_at**

ISO 8601 timestamp when the transaction reached `completed` status.

### Transaction statuses

| Status | Description |
|--------|-------------|
| `pending` | Transaction initiated, waiting for on-chain submission. |
| `confirming` | Transaction submitted on-chain, waiting for block confirmations. |
| `completed` | Transaction confirmed and payment received by the recipient. |
| `failed` | Transaction failed due to revert, timeout, or insufficient funds. |

---

## List transactions

Retrieve a paginated list of transactions with optional filters.

Filter by status: `pending`, `confirming`, `completed`, `failed`.

Filter by customer ID.

Filter by payment link ID.

Filter transactions created on or after this ISO 8601 date (e.g., `2026-01-01`).

Filter transactions created on or before this ISO 8601 date (e.g., `2026-02-28`).

Page number for pagination.

Number of results per page (max 100).

```bash cURL
curl -X GET "https://platform-api.anyspend.com/api/v1/transactions?status=completed&from=2026-02-01&to=2026-02-28&page=1&limit=20" \
  -H "Authorization: Bearer asp_xxx"
```

```typescript SDK
import { AnySpendPlatformClient } from "@b3dotfun/sdk/anyspend/platform";

const platform = new AnySpendPlatformClient(process.env.ANYSPEND_API_KEY!);

const { data, pagination } = await platform.transactions.list({
  status: "completed",
  from: "2026-02-01",
  to: "2026-02-28",
  page: 1,
  limit: 20,
});
```

**Response**

```json
    {
      "data": [
        {
          "id": "tx_abc123",
          "status": "completed",
          "amount": "50000000",
          "amount_usd": "50.00",
          "token_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
          "chain_id": 1,
          "tx_hash": "0x9f8e7d6c5b4a3f2e1d0c9b8a7f6e5d4c3b2a1f0e",
          "payer_address": "0xaabb1234ccdd5678eeff9900aabb1234ccdd5678",
          "recipient_address": "0x1234567890abcdef1234567890abcdef12345678",
          "customer_id": "cust_abc123",
          "payment_link_id": "pl_abc123",
          "session_id": "cs_sess001",
          "source_chain_id": 8453,
          "source_token_address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "source_amount": "50000000",
          "fee_amount": "500000",
          "form_data": {
            "company_name": "Acme Inc."
          },
          "shipping_address": null,
          "shipping_option": null,
          "metadata": null,
          "created_at": "2026-02-25T08:15:00Z",
          "confirmed_at": "2026-02-25T08:15:45Z",
          "completed_at": "2026-02-25T08:16:30Z"
        }
      ],
      "pagination": {
        "page": 1,
        "limit": 20,
        "total": 156,
        "total_pages": 8,
        "has_more": true
      }
    }
    ```

---

## Retrieve a transaction

The transaction ID (e.g., `tx_abc123`).

```bash cURL
curl -X GET "https://platform-api.anyspend.com/api/v1/transactions/tx_abc123" \
  -H "Authorization: Bearer asp_xxx"
```

```typescript SDK
const transaction = await platform.transactions.get("tx_abc123");
```

**Response**

Returns the full [Transaction object](#the-transaction-object).

---

## Get transaction stats

Retrieve aggregate statistics across all your transactions.

```bash cURL
curl -X GET "https://platform-api.anyspend.com/api/v1/transactions/stats" \
  -H "Authorization: Bearer asp_xxx"
```

```typescript SDK
const stats = await platform.transactions.stats();
```

**Response**

```json
    {
      "total_transactions": 1250,
      "completed_transactions": 1180,
      "failed_transactions": 45,
      "pending_transactions": 25,
      "total_volume_usd": "58750.00",
      "last_24h": {
        "transactions": 18,
        "completed": 17,
        "volume_usd": "920.00"
      },
      "status_breakdown": {
        "pending": 15,
        "confirming": 10,
        "completed": 1180,
        "failed": 45
      }
    }
    ```

---

## Export transactions

Export transaction data in CSV or JSON format. The response is streamed as a file download.

Export format. One of: `csv`, `json`.

Filter by status: `pending`, `confirming`, `completed`, `failed`.

Filter transactions created on or after this ISO 8601 date.

Filter transactions created on or before this ISO 8601 date.

Exports are limited to 50,000 records. For larger datasets, use date range filters to break exports into smaller chunks.

```bash cURL
# Export completed transactions for February 2026 as CSV
curl -X GET "https://platform-api.anyspend.com/api/v1/transactions/export?format=csv&status=completed&from=2026-02-01&to=2026-02-28" \
  -H "Authorization: Bearer asp_xxx" \
  -o transactions.csv

# Export as JSON
curl -X GET "https://platform-api.anyspend.com/api/v1/transactions/export?format=json&status=completed" \
  -H "Authorization: Bearer asp_xxx" \
  -o transactions.json
```

```typescript SDK
// Export as CSV stream
const csvStream = await platform.transactions.export({
  format: "csv",
  status: "completed",
  from: "2026-02-01",
  to: "2026-02-28",
});

// Export as JSON array
const transactions = await platform.transactions.export({
  format: "json",
  status: "completed",
});
```

**CSV Response**

```csv
    id,status,amount,amount_usd,token_address,chain_id,tx_hash,payer_address,recipient_address,customer_id,payment_link_id,created_at,completed_at
    tx_abc123,completed,50000000,50.00,0xA0b8...eB48,1,0x9f8e...1f0e,0xaabb...5678,0x1234...5678,cust_abc123,pl_abc123,2026-02-25T08:15:00Z,2026-02-25T08:16:30Z
    tx_def456,completed,25000000,25.00,0xA0b8...eB48,1,0x1a2b...3c4d,0xccdd...9012,0x1234...5678,cust_def456,pl_abc123,2026-02-24T12:00:00Z,2026-02-24T12:01:15Z
    ```
  **JSON Response**

```json
    {
      "data": [
        {
          "id": "tx_abc123",
          "status": "completed",
          "amount": "50000000",
          "amount_usd": "50.00",
          "token_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
          "chain_id": 1,
          "tx_hash": "0x9f8e7d6c5b4a3f2e1d0c9b8a7f6e5d4c3b2a1f0e",
          "payer_address": "0xaabb1234ccdd5678eeff9900aabb1234ccdd5678",
          "recipient_address": "0x1234567890abcdef1234567890abcdef12345678",
          "customer_id": "cust_abc123",
          "payment_link_id": "pl_abc123",
          "session_id": "cs_sess001",
          "created_at": "2026-02-25T08:15:00Z",
          "completed_at": "2026-02-25T08:16:30Z"
        }
      ],
      "total": 1180
    }
    ```