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

# Economy

> Economy v2 인벤토리 항목, 컬렉션 및 트랜잭션을 검사 및 수정하고, 일괄 인벤토리 작업을 실행합니다.

`playfab economy inventory`로 컬렉션, 트랜잭션 기록, 일괄 인벤토리 작업을 포함한 PlayFab Economy v2
인벤토리를 읽고 변경합니다.

인벤토리 명령은 `--entity-id`와 `--entity-type`을 모두 전달하지 않으면 호출하는 엔터티를 대상으로 합니다.
플레이어의 경우 마스터 플레이어 계정 ID가 아니라 타이틀 플레이어 계정 ID를
`--entity-type title_player_account`와 함께 전달하세요.
[`playfab player account get`](https://docs.xbox.com/ko/tools/xbox-cli/commands/playfab/player)은 이 ID를
`UserInfo.TitleInfo.TitlePlayerAccount.Id`로 반환합니다. `--collection-id`는 `default`가 아닌 인벤토리
컬렉션을 선택합니다.

`operation execute`는 `--confirm`(`--yes`, `-y`)을 전달하지 않으면 터미널에서도 `Delete` 작업이 포함된
일괄 처리를 거부합니다. 다른 인벤토리 변경은 묻지 않고 실행됩니다.
[안전 및 파괴적 작업](https://docs.xbox.com/ko/tools/xbox-cli/safety.md)을 참조하세요.

## 인벤토리 항목

| 명령 | PlayFab API 경로 | 옵션 |
| - | - | - |
| `playfab economy inventory list` | `/Inventory/GetInventoryItems` | 선택적 `--entity-id`, `--entity-type`, `--collection-id`, `--limit`, `--continuation-token`, `--filter`. |
| `playfab economy inventory add` | `/Inventory/AddInventoryItems` | 선택적 `--entity-id`, `--entity-type`, `--collection-id`, `--idempotency-id`. 항목은 선택적 `--stack-id`와 함께 `--item-id`로 지정하거나, `--item`으로 `InventoryItemReference` JSON 개체를 지정합니다. `--amount`는 수량을 설정합니다. |

* `inventory list`는 `--limit`개 항목(기본값 10개)의 한 페이지를 반환합니다. 다음 페이지를 가져오려면
  응답의 연속 토큰을 `--continuation-token`으로 전달하세요.
* `--filter`는 항목 속성 `type`, `id`, `stackId`에 대한 OData 필터입니다.
* `inventory add`는 변경된 인벤토리가 아니라 `ETag`, `IdempotencyId` 및 기록한 `TransactionIds`를
  반환합니다. 결과를 보려면 `inventory list`를 실행하세요.

## 인벤토리 컬렉션

| 명령 | PlayFab API 경로 | 옵션 |
| - | - | - |
| `playfab economy inventory collection list` | `/Inventory/GetInventoryCollectionIds` | 선택적 `--entity-id`, `--entity-type`, `--limit`, `--continuation-token`. |

## 인벤토리 작업

| 명령 | PlayFab API 경로 | 옵션 |
| - | - | - |
| `playfab economy inventory operation execute` | `/Inventory/ExecuteInventoryOperations` | 선택적 `--entity-id`, `--entity-type`, `--collection-id`, `--idempotency-id`. 작업은 JSON 배열로 지정하며, `--operations` 또는 `--operations-file` 중 정확히 하나를 사용합니다. |
| `playfab economy inventory operation status` | `/Inventory/GetInventoryOperationStatus` | `--operation-token`(필수), 항목을 준 엔터티의 `--entity-id` 및 `--entity-type`, 선택적 `--collection-id`. |

`operation execute`는 일괄 처리를 하나의 트랜잭션으로 실행합니다. `inventory add`와 마찬가지로 전체 일괄
처리에 대한 `ETag`, `IdempotencyId`, `TransactionIds`를 반환합니다. 수행된 작업을 보려면 `inventory list`
또는 `inventory transaction list`를 실행하세요.

`operation status`는 요청이 반환될 때 완료되지 않은 인벤토리 전송을 확인합니다. `TransferInventoryItems`와
`ExecuteTransferOperations`는 `OperationStatus`가 `InProgress`인 동안 `OperationToken`을 반환합니다. 해당
토큰을 전달하고, 전송의 `GivingEntity`를 `--entity-id`와 `--entity-type`으로 전달하세요. CLI에는 이러한 전송
API에 대한 명령이 없으므로 [`playfab api`](https://docs.xbox.com/ko/tools/xbox-cli/commands/playfab/api)로 호출하세요. 트랜잭션
ID는 작업 토큰이 아니며, PlayFab은 트랜잭션 ID를 `Bad OperationToken.`으로 거부합니다.

## 인벤토리 트랜잭션

| 명령 | PlayFab API 경로 | 옵션 |
| - | - | - |
| `playfab economy inventory transaction list` | `/Inventory/GetTransactionHistory` | 선택적 `--entity-id`, `--entity-type`, `--collection-id`, `--limit`, `--continuation-token`, `--filter`, `--order-by`. |

`--filter`는 `timestamp`, `transactionid`, `apiname`, `operationtype`을 참조할 수 있습니다.
`--order-by`는 `timestamp asc` 또는 `timestamp desc`를 허용합니다.

## 테이블 출력

다음 명령은 `--output table`을 허용하며, `inventory add`와 `operation execute`는 허용하지 않습니다.
[테이블 출력](https://docs.xbox.com/ko/tools/xbox-cli/commands.md#table-output)을 참조하세요.

| 명령 | 열 |
| - | - |
| `playfab economy inventory list` | `ID`, `TYPE`, `STACK`, `AMOUNT` |
| `playfab economy inventory collection list` | `COLLECTION ID` |
| `playfab economy inventory transaction list` | `TRANSACTION ID`, `TIMESTAMP`, `API`, `OPERATION` |
| `playfab economy inventory operation status` | `STATUS` |

테이블에는 연속 토큰이 표시되지 않으므로, 첫 페이지 이후로 페이지를 넘기려면 JSON 출력을 사용하세요.

```bash theme={null}
xbox --playfab-title-id ABC123 playfab economy inventory list --entity-id TITLEPLAYER123 --entity-type title_player_account --output table
```

```text theme={null}
ID                                    TYPE      STACK    AMOUNT
------------------------------------  --------  -------  ------
11111111-2222-3333-4444-555555555555  currency  default  500
22222222-3333-4444-5555-666666666666  bundle    default  1
```

## 예제

플레이어 한 명의 인벤토리, 컬렉션 및 트랜잭션 기록을 읽습니다.

```bash theme={null}
xbox --playfab-title-id ABC123 playfab economy inventory list --entity-id TITLEPLAYER123 --entity-type title_player_account --limit 50 --data-only --output json-compact
xbox --playfab-title-id ABC123 playfab economy inventory collection list --entity-id TITLEPLAYER123 --entity-type title_player_account
xbox --playfab-title-id ABC123 playfab economy inventory transaction list --entity-id TITLEPLAYER123 --entity-type title_player_account --order-by "timestamp desc"
```

플레이어의 인벤토리에 항목 하나를 추가합니다.

```bash theme={null}
xbox --playfab-title-id ABC123 playfab economy inventory add --entity-id TITLEPLAYER123 --entity-type title_player_account --item-id 11111111-2222-3333-4444-555555555555 --amount 1 --idempotency-id 22222222-3333-4444-5555-666666666666
```

`ops.json`의 인벤토리 작업 일괄 처리를 실행합니다.

```bash theme={null}
xbox --playfab-title-id ABC123 playfab economy inventory operation execute --entity-id TITLEPLAYER123 --entity-type title_player_account --operations-file ops.json --idempotency-id 33333333-4444-5555-6666-777777777777
```

`ops.json`에 `Delete` 작업이 포함되어 있으면 `--confirm`을 추가합니다.

```bash theme={null}
xbox --playfab-title-id ABC123 playfab economy inventory operation execute --entity-id TITLEPLAYER123 --entity-type title_player_account --operations-file ops.json --confirm
```

`"OperationStatus": "InProgress"`를 반환한 전송을, 해당 응답의 `OperationToken`과 항목을 준 플레이어를
사용하여 확인합니다.

```bash theme={null}
xbox --playfab-title-id ABC123 playfab economy inventory operation status --entity-id TITLEPLAYER123 --entity-type title_player_account --operation-token OPERATIONTOKEN123
```


## Related topics

- [상점(Legacy Economy)](https://docs.xbox.com/ko/services/playfab/economy-monetization/economy/stores/index.md)
- [Economy V2 제한](https://docs.xbox.com/ko/services/playfab/economy-monetization/economy-v2/limits.md)
- [Economy v2 개요](https://docs.xbox.com/ko/services/playfab/economy-monetization/economy-v2/overview.md)
- [Economy v2 구독](https://docs.xbox.com/ko/services/playfab/economy-monetization/economy-v2/catalog/subscriptions.md)
- [Economy v2 번들](https://docs.xbox.com/ko/services/playfab/economy-monetization/economy-v2/catalog/bundles.md)
