# How to view transactions (https://developer.godaddy.com/en/docs/api-users/commerce/manage-orders-and-customers/transaction)

***

title: How to view transactions
description: Look up payment transaction history for a store — authorizations, captures, sales, refunds, and adjustments.
agentNotes:
permissions: \[]
scopes: \["commerce.transaction:read"]
idempotent: true
destructive: false
failureRecovery: "Safe to retry on any error. Transaction reads are idempotent."
related:
apis:

* title: "Transaction API reference"
  href: "/docs/references/rest/transactions/general-endpoints"
  guides:
* title: "Process an order"
  href: "/docs/api-users/commerce/manage-orders-and-customers"
* title: "Manage a store"
  href: "/docs/api-users/commerce/set-up-a-store"
  concepts:
* title: "About the Commerce API"
  href: "/docs/api-users/commerce"
* title: "Authentication"
  href: "/docs/api-users/auth"
* title: "Rate limits"
  href: "/docs/api-users/rate-limits"

***

## Overview

Transactions represent payment activity associated with orders: authorizations, captures, sales, refunds, and adjustments. The Transaction API is a read-only REST API under `v2` (this differs from the other Commerce REST endpoints which use `v1`).

## Prerequisites

The following prerequisites are required before you view transactions:

* a GoDaddy account with an active commerce store
* a [Personal Access Token (PAT)](https://developer.godaddy.com/docs/api-users/auth) with the `commerce.transaction:read` scope
* your `storeId`

  Go to [Your stores](https://developer.godaddy.com/docs/api-users/commerce#your-stores) to find your store ID.

## List transactions

`GET /v2/commerce/stores/{storeId}/transactions` retrieves all transactions for a store. The following optional query parameters narrow the results:

| Parameter         | Type     | Description                                       |
| ----------------- | -------- | ------------------------------------------------- |
| `page`            | integer  | Page number to retrieve (default: `1`)            |
| `pageSize`        | integer  | Results per page (default: `10`)                  |
| `totalRequired`   | boolean  | Include total count in the response               |
| `transactionIds`  | string   | Comma-separated transaction IDs to filter         |
| `updatedAtAfter`  | datetime | Filter transactions updated after this timestamp  |
| `updatedAtBefore` | datetime | Filter transactions updated before this timestamp |
| `sortBy`          | string   | Field to sort by (`updatedAt`)                    |
| `sortOrder`       | string   | Sort direction (`ASC` or `DESC`, default: `ASC`)  |

The following procedure lists the most recent 20 transactions.

1. Retrieve a page of transactions:

   ```bash tab="curl"
   curl -s "https://api.godaddy.com/v2/commerce/stores/${STORE_ID}/transactions?pageSize=20&sortOrder=DESC" \
     -H "Authorization: Bearer $GODADDY_PAT"
   ```

   ```js tab="Node"
   const token = process.env.GODADDY_PAT;
   const storeId = process.env.STORE_ID;

   const params = new URLSearchParams({ pageSize: "20", sortOrder: "DESC" });
   const res = await fetch(
     `https://api.godaddy.com/v2/commerce/stores/${storeId}/transactions?${params}`,
     { headers: { Authorization: `Bearer ${token}` } }
   );
   const data = await res.json();
   console.log(data);
   ```

   ```python tab="Python"
   import os, requests

   token = os.environ["GODADDY_PAT"]
   store_id = os.environ["STORE_ID"]

   res = requests.get(
       f"https://api.godaddy.com/v2/commerce/stores/{store_id}/transactions",
       params={"pageSize": 20, "sortOrder": "DESC"},
       headers={"Authorization": f"Bearer {token}"},
   )
   res.raise_for_status()
   print(res.json())
   ```

   ```go tab="Go"
   package main

   import (
       "encoding/json"
       "fmt"
       "net/http"
       "os"
   )

   func main() {
       token := os.Getenv("GODADDY_PAT")
       storeId := os.Getenv("STORE_ID")

       url := fmt.Sprintf(
           "https://api.godaddy.com/v2/commerce/stores/%s/transactions?pageSize=20&sortOrder=DESC",
           storeId,
       )
       req, _ := http.NewRequest("GET", url, nil)
       req.Header.Set("Authorization", "Bearer "+token)

       res, err := http.DefaultClient.Do(req)
       if err != nil { panic(err) }
       defer res.Body.Close()

       var result map[string]any
       json.NewDecoder(res.Body).Decode(&result)
       fmt.Println(result)
   }
   ```

2. Review the response including the paginated list of transactions:

   ```json
   {
     "items": [
       {
         "id": "<TRANSACTION_ID>",
         "orderId": "<ORDER_ID>",
         "type": "<TRANSACTION_TYPE>",
         "status": "<TRANSACTION_STATUS>",
         "amount": {
           "value": "<TRANSACTION_AMOUNT>",
           "currency": "<ISO_4217_CURRENCY_CODE>"
         },
         "createdAt": "<ISO8601_CREATED_TIMESTAMP>",
         "updatedAt": "<ISO8601_UPDATED_TIMESTAMP>"
       }
     ],
     "page": 1,
     "pageSize": 20
   }
   ```

## Get a transaction

`GET /v2/commerce/stores/{storeId}/transactions/{transactionId}` retrieves a single transaction by ID.

The following procedure reads a single transaction by ID.

* Retrieve a single transaction by its `id`:

  ```bash tab="curl"
  TRANSACTION_ID="<TRANSACTION_ID>"

  curl -s "https://api.godaddy.com/v2/commerce/stores/${STORE_ID}/transactions/${TRANSACTION_ID}" \
    -H "Authorization: Bearer $GODADDY_PAT"
  ```

  ```js tab="Node"
  const token = process.env.GODADDY_PAT;
  const storeId = process.env.STORE_ID;
  const transactionId = "<TRANSACTION_ID>";

  const res = await fetch(
    `https://api.godaddy.com/v2/commerce/stores/${storeId}/transactions/${transactionId}`,
    { headers: { Authorization: `Bearer ${token}` } }
  );
  const transaction = await res.json();
  console.log(transaction);
  ```

  ```python tab="Python"
  import os, requests

  token = os.environ["GODADDY_PAT"]
  store_id = os.environ["STORE_ID"]
  transaction_id = "<TRANSACTION_ID>"

  res = requests.get(
      f"https://api.godaddy.com/v2/commerce/stores/{store_id}/transactions/{transaction_id}",
      headers={"Authorization": f"Bearer {token}"},
  )
  res.raise_for_status()
  print(res.json())
  ```

  ```go tab="Go"
  package main

  import (
      "encoding/json"
      "fmt"
      "net/http"
      "os"
  )

  func main() {
      token := os.Getenv("GODADDY_PAT")
      storeId := os.Getenv("STORE_ID")
      transactionId := "<TRANSACTION_ID>"

      url := fmt.Sprintf("https://api.godaddy.com/v2/commerce/stores/%s/transactions/%s", storeId, transactionId)
      req, _ := http.NewRequest("GET", url, nil)
      req.Header.Set("Authorization", "Bearer "+token)

      res, err := http.DefaultClient.Do(req)
      if err != nil { panic(err) }
      defer res.Body.Close()

      var transaction map[string]any
      json.NewDecoder(res.Body).Decode(&transaction)
      fmt.Println(transaction)
  }
  ```

## Common errors

The following table lists common errors when viewing transactions, the most likely cause, and additional notes:

| Status | Most likely cause                                                                     | Note                                                                  |
| ------ | ------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `401`  | PAT is missing or expired.                                                            | Go to [Authentication](https://developer.godaddy.com/docs/api-users/auth) to generate a new token. |
| `403`  | Token doesn't include the `commerce.transaction:read` scope.                          |                                                                       |
| `404`  | Store ID or transaction ID doesn't exist or isn't accessible with the provided token. |                                                                       |
| `429`  | Rate limit exceeded.                                                                  | Honor the `Retry-After` header before retrying.                       |
