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

# Economy v2 真钱价格

> 在 PlayFab Economy v2 目录物品上配置 RealMoneyPriceDetails，为每个市场设置定价并跟踪来自 Apple、Google 和 Steam 的收入。

# 真钱价格

<Info>
  Economy v2 现已正式发布。如需支持和反馈，请访问 [PlayFab 论坛](https://community.playfab.com)。
</Info>

真钱价格允许你按每个市场为目录物品关联真实世界的货币值。目录物品上的 `RealMoneyPriceDetails` 属性为每个受支持的市场包含单独的价格字典。PlayFab 使用此数据来跟踪来自市场交易的收入。

## 概述

当玩家通过外部市场（Apple App Store、Google Play、Steam、Microsoft Store、Nintendo eShop、PlayStation Store）购买物品时，交易涉及真实世界的资金。通过在目录物品上设置 `RealMoneyPriceDetails`，PlayFab 可以：

* **跟踪** [marketplace\_transaction\_redeemed](/services/playfab/api-references/events/Inventory/marketplace-transaction-redeemed) 事件中来自市场兑换的**收入**。

## 格式

`RealMoneyPriceDetails` 是一个对象，为每个受支持的市场包含单独的价格字典：

| 属性                       | 类型                        | 描述                              |
| :----------------------- | :------------------------ | :------------------------------ |
| `AppleAppStorePrices`    | `Dictionary<string, int>` | 每种货币代码的 Apple App Store 价格金额。   |
| `GooglePlayPrices`       | `Dictionary<string, int>` | 每种货币代码的 Google Play 价格金额。       |
| `MicrosoftStorePrices`   | `Dictionary<string, int>` | 每种货币代码的 Microsoft Store 价格金额。   |
| `NintendoEShopPrices`    | `Dictionary<string, int>` | 每种货币代码的 Nintendo eShop 价格金额。    |
| `PlayStationStorePrices` | `Dictionary<string, int>` | 每种货币代码的 PlayStation Store 价格金额。 |
| `SteamPrices`            | `Dictionary<string, int>` | 每种货币代码的 Steam 价格金额。             |

每个字典都将三个字母的 [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) 货币代码映射到以**最小货币单位**（例如美元的美分）表示的价格。

<Note>
  目前仅支持**美元 (USD)** 作为货币代码。
</Note>

你只需要填充与你的游戏相关的市场属性。例如，如果你的游戏只在 Google Play 和 Apple App Store 上，则只需设置 `GooglePlayPrices` 和 `AppleAppStorePrices`。

### 价格示例

| 真实世界价格     | 字典值            |
| :--------- | :------------- |
| \$0.99 USD | `{"USD": 99}`  |
| \$1.39 USD | `{"USD": 139}` |
| \$4.99 USD | `{"USD": 499}` |
| \$9.99 USD | `{"USD": 999}` |

## 在目录物品上设置真钱价格

真钱价格通常设置在通过 `AlternateIds` 链接到外部市场产品的**捆绑包**上。当玩家兑换市场购买时，PlayFab 使用匹配目录捆绑包的 `RealMoneyPriceDetails` 值来记录收入。

### API

你可以在使用 `CreateDraftItem` 或 `UpdateDraftItem` 创建或更新目录物品时设置 `RealMoneyPriceDetails`：

```json theme={null}
{
  "Item": {
    "Type": "bundle",
    "Title": {
      "NEUTRAL": "Starter Pack"
    },
    "ItemReferences": [
      {
        "Id": "{{LaserSwordID}}",
        "Amount": 1
      },
      {
        "Id": "{{GoldCurrencyID}}",
        "Amount": 500
      }
    ],
    "RealMoneyPriceDetails": {
      "GooglePlayPrices": {
        "USD": 499
      },
      "AppleAppStorePrices": {
        "USD": 499
      },
      "SteamPrices": {
        "USD": 499
      }
    },
    "AlternateIds": [
      {
        "Type": "GooglePlay",
        "Value": "com.mygame.starterpack"
      },
      {
        "Type": "AppleAppStore",
        "Value": "com.mygame.starterpack"
      },
      {
        "Type": "Steam",
        "Value": "starterpack_001"
      }
    ]
  },
  "Publish": true
}
```

如果你的定价在各商店中有所不同，你也可以为每个市场设置不同的价格：

```json theme={null}
"RealMoneyPriceDetails": {
  "GooglePlayPrices": {
    "USD": 499
  },
  "AppleAppStorePrices": {
    "USD": 529
  },
  "MicrosoftStorePrices": {
    "USD": 499
  }
}
```

### Game Manager

1. 导航到 **Economy** > **Catalog (V2)**。
2. 在 **Bundles** 选项卡下，选择要编辑的捆绑包或创建一个新捆绑包。
3. 在 **Prices** 部分，为每个市场配置真钱价格。
4. 在 **Marketplace Mapping** 部分，将捆绑包链接到你的外部市场产品。

***

## 真钱价格在事件中的显示方式

当市场交易被兑换时，相应市场的价格会作为 `RealMoneyPrices` 包含在 [marketplace\_transaction\_redeemed](/services/playfab/api-references/events/Inventory/marketplace-transaction-redeemed) 事件中。例如，一次 Google Play 兑换：

```json theme={null}
{
  "Marketplace": "GooglePlay",
  "MarketplaceTransctionId": "GPA.1234-5678-9012-34567",
  "MarketplaceAlternateId": "com.mygame.starterpack",
  "Amount": 1,
  "ItemId": "{{BundleID}}",
  "ItemType": "bundle",
  "RealMoneyPrices": {
    "USD": 499
  }
}
```

然后可以将此事件数据用于：

* 通过 Insights Explorer 进行自定义分析查询

## 最佳做法

* **始终在市场捆绑包上设置 `RealMoneyPriceDetails`。** 这可确保准确的收入跟踪和分析。
* **使用最小货币单位。** 对于 USD，请提供以美分为单位的价格（例如，`499` 表示 \$4.99）。
* **仅填充你使用的市场。** 你不需要为每个市场设置价格——仅为你的游戏发布所在的市场设置。
* **保持价格与你的市场列表同步。** 当你在外部市场中更新价格时，请更新 `RealMoneyPriceDetails` 中相应的属性以保持准确的报告。
* **当价格不同时，按市场设置价格。** 如果你的游戏在各商店中定价不同，请使用按市场的属性来反映每个平台上的实际价格。

## 另请参阅

* [Economy v2 捆绑包](/services/playfab/economy-monetization/economy-v2/catalog/bundles)
* [商店](/services/playfab/economy-monetization/economy-v2/catalog/stores)
* [欺诈防范快速入门](/services/playfab/economy-monetization/economy-v2/fraud-prevention/quickstart)
* [市场集成](/services/playfab/economy-monetization/economy-v2/marketplace/marketplace-integrations/overview)
* [marketplace\_transaction\_redeemed 事件](/services/playfab/api-references/events/Inventory/marketplace-transaction-redeemed)
