# 仮想通貨トランザクションの一覧を取得する

> プロファイルの仮想通貨トランザクション履歴を新しい順に返します。結果はカーソルページネーションを使用します: レスポンスに `pagination.next_cursor` が null でない値で含まれている場合、それを `cursor` クエリパラメータとして渡すことで次のページを取得できます。

## OpenAPI

```yaml
/api-specs/adapty-api.yaml get /api/v2/server-side-api/vc/transactions/
openapi: 3.1.0
info:
  title: Adapty サーバーサイド API
  version: 1.0.0
servers:
  - url: https://api.adapty.io
    description: 本番サーバー
paths:
  /api/v2/server-side-api/vc/transactions/:
    get:
      summary: 仮想通貨トランザクションの一覧を取得する
      description: |
        プロファイルの仮想通貨トランザクション履歴を新しい順に返します。結果はカーソルページネーションを使用します: レスポンスに `pagination.next_cursor` が null でない値で含まれている場合、それを `cursor` クエリパラメータとして渡すことで次のページを取得できます。
      operationId: listVirtualCurrencyTransactions
      tags:
        - Virtual Currency
      security:
        - apikeyAuth: []
      parameters:
        - name: adapty-customer-user-id
          in: header
          required: false
          schema:
            type: string
          description: お客様のシステムにおける顧客の一意のID。`adapty-customer-user-id` または `adapty-profile-id` のいずれかが必須です。
        - name: adapty-profile-id
          in: header
          required: false
          schema:
            type: string
          description: お客様のシステムにおけるプロファイルの一意のID。匿名プロファイルを扱う場合に最適な選択肢です。`adapty-customer-user-id` または `adapty-profile-id` のいずれかが必須です。
        - name: currency_code
          in: query
          required: false
          schema:
            type: string
          description: 履歴を単一の仮想通貨コードでフィルタリングします。
        - name: cursor
          in: query
          required: false
          schema:
            type: string
          description: 前のレスポンスで `pagination.next_cursor` として返された不透明なページネーションカーソル。最初のページを取得するには省略してください。
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            default: 50
            minimum: 1
            maximum: 100
          description: 1ページあたりに返すトランザクションの最大件数。デフォルトは50件です。
      responses:
        "200":
          description: トランザクション履歴が正常に返されました
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VirtualCurrencyTransactionsHistoryResponse"
              example:
                data:
                  - transaction_id: 0190e8a4-1c2b-7def-8abc-2c1a4b6d8e90
                    transaction_type: api_transaction
                    items:
                      - currency_code: COINS
                        amount: 500
                        balance_after: 12950
                    metadata:
                      reason: promo_bonus
                    created_at: "2026-05-23T10:30:00Z"
                  - transaction_id: 0190e7b2-9a44-7c10-bb31-7d2e9f0a1c55
                    transaction_type: store_purchase
                    items:
                      - currency_code: COINS
                        amount: 1000
                        balance_after: 12450
                    created_at: "2026-05-22T18:05:12Z"
                  - transaction_id: 0190e5c0-3f18-7b9a-9e6d-44a1c8b27e03
                    transaction_type: subscription_renewal
                    items:
                      - currency_code: GEMS
                        amount: 200
                        balance_after: 3280
                    created_at: "2026-05-20T09:00:00Z"
                pagination:
                  next_cursor: MjAyNi0wNS0yMFQwOTowMDowMFowMTkwZTVjMC0zZjE4LTdiOWEtOWU2ZC00NGExYzhiMjdlMDM=
        "400":
          description: 不正なリクエスト。`cursor` の値が無効です（`error_code` は `invalid_cursor`）。
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "401":
          description: 認証エラー。APIキーが見つからないか無効です。
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: 禁止。このアプリでは仮想通貨のServer APIが有効になっていません。
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: プロファイルが見つかりません。
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "500":
          description: 内部サーバーエラー
components:
  schemas:
    VirtualCurrencyTransactionsHistoryResponse:
      type: object
      description: プロファイルの仮想通貨トランザクション履歴のページネーションリスト。
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/VirtualCurrencyTransactionsHistoryItem"
        pagination:
          $ref: "#/components/schemas/VirtualCurrencyHistoryPagination"
      required:
        - data
        - pagination
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              source:
                type: string
                nullable: true
                description: エラーの発生源
              errors:
                type: array
                items:
                  type: string
                description: エラーメッセージの配列
        error_code:
          type: string
          description: エラーの短い名称
        status_code:
          type: integer
          description: HTTPステータスコード
      required:
        - errors
        - error_code
        - status_code
    VirtualCurrencyTransactionsHistoryItem:
      type: object
      properties:
        transaction_id:
          type: string
          format: uuid
          description: トランザクションの一意のID。
        transaction_type:
          type: string
          description: |
            トランザクションのソース。`store_purchase`、`subscription_renewal`、`trial_start`、`api_transaction`、`dashboard_transaction`、`refund`、または `expiry` のいずれか。
        items:
          type: array
          description: このトランザクションに記録された通貨ごとの残高変動。
          items:
            $ref: "#/components/schemas/VirtualCurrencyBalanceChange"
        metadata:
          type: object
          nullable: true
          additionalProperties:
            type: string
          description: トランザクションに保存されたキーと値のペア（存在する場合）。
        created_at:
          type: string
          format: date-time
          description: トランザクションが記録された日時。
      required:
        - transaction_id
        - transaction_type
        - items
        - created_at
    VirtualCurrencyHistoryPagination:
      type: object
      properties:
        next_cursor:
          type: string
          nullable: true
          description: |
            次のページのための不透明なカーソルです。さらに結果を取得するには、`cursor` クエリパラメータとして渡してください。これ以上ページがない場合は null になります。
      required:
        - next_cursor
    VirtualCurrencyBalanceChange:
      type: object
      properties:
        currency_code:
          type: string
          description: バーチャル通貨コード。
        amount:
          type: integer
          format: int32
          description: 残高に適用された符号付き変化量。正の値はクレジット、負の値はデビットを表します。
        balance_after:
          type: integer
          format: int32
          minimum: 0
          description: このトランザクション適用後の通貨残高。
      required:
        - currency_code
        - amount
        - balance_after
  securitySchemes:
    apikeyAuth:
      type: apiKey
      name: Authorization
      in: header
      default: Api-Key {Your secret API key}
      description: |
        APIリクエストは、シークレットAPIキーを **Authorization** ヘッダーに `Api-Key {your_secret_api_key}` の形式で設定することで認証されます。例えば、`Api-Key secret_live_...` のように指定します。このキーは Adapty ダッシュボード -> **App Settings** -> **General** タブ -> **API keys** セクションで確認できます。
```
