在 AppStore Connect API 中设置 IAP 消耗品的价格

问题描述 投票:0回答:1

我正在尝试使用 AppStore Connect API 为应用内购买创建和配置简单的定价。

我想要什么

  • 我使用

    POST v2/inAppPurchases

    成功创建了 IAP
  • 现在我想模拟以捷克克朗货币为基础设置价格。基本上我想在 UI 中复制这些操作

    • UI 中的第 1 步 - 单击 IAP 详细信息添加定价
    • UI 第 2 步 - 基准国家:捷克共和国 (CZK),价格:Kč 99.00
    • UI 中的第 3 步 - 我单击“下一步”,然后单击“确认”。我对货币兑换为其他货币非常满意,所以我不想改变任何东西。
  • 这就是最终结果在 UI 中的样子

我尝试了什么

所以我遵循了官方的AppStore Connect 文档

  • 我首先使用
    POST v2/inAppPurchases
    创建 IAP。我记得返回的 IAP ID。
  • 现在我使用 GET /v2/inAppPurchases/{id}/pricePoints 找到
    价格点
    并获取其 ID。
  • 现在我打电话给
    POST /v1/inAppPurchasePriceSchedules
    ,我正在快速遵循文档,但它不起作用。回复是抱怨
    startDate
    endDate
    以及一些时间表,但我不知道这些字段应该包含什么。我尝试将其设置为空值或某些日期,但这不是 API 所期望的。

我的要求

{
    "data": {
        "type": "inAppPurchasePriceSchedules",
        "relationships": {
            "baseTerritory": {
                "data": {
                    "id": "CZE",
                    "type": "territories"
                }
            },
            "inAppPurchase": {
                "data": {
                    "id": "6477355320",
                    "type": "inAppPurchases"
                }
            },
            "manualPrices": {
                "data": [
                    {
                        "id": "eyJzIjoiNjQ3NzM1NTMyMCIsInQiOiJDWkUiLCJwIjoiMTAwNTEifQ",
                        "type": "inAppPurchasePrices"
                    }
                ]
            }
        }
    },
    "included": [
        {
            "id": "eyJzIjoiNjQ3NzM1NTMyMCIsInQiOiJDWkUiLCJwIjoiMTAwNTEifQ",
            "type": "inAppPurchasePrices",
            "attributes": {
                "startDate": "2024-02-04",
                "endDate": "2024-02-05"
            },
            "relationships": {
                "inAppPurchasePricePoint": {
                    "data": {
                        "id": "eyJzIjoiNjQ3NzM1NTMyMCIsInQiOiJDWkUiLCJwIjoiMTAwNTEifQ",
                        "type": "inAppPurchasePricePoints"
                    }
                },
                "inAppPurchaseV2": {
                    "data": {
                        "id": "6477355320",
                        "type": "inAppPurchases"
                    }
                }
            }
        }
    ]
}

回应

HTTP 409
{
  "errors" : [ {
    "id" : "b42142d7-d656-45c6-ad3a-8a7f19ce6974",
    "status" : "409",
    "code" : "ENTITY_ERROR.INVALID_END_DATE",
    "title" : "There is a problem with the request entity",
    "detail" : "Entire timeline must be covered for CZE. Rightmost interval must not have an end date: [2024-02-04T00:00 - 2024-02-05T00:00]",
    "source" : {
      "pointer" : "/data/relationships/manualPrices/data/0/attributes/endDate"
    }
  } ]
}
in-app-purchase app-store-connect
1个回答
0
投票

好吧,那太愚蠢了。

我只是将

startDate
endDate
设置为
null
。由于某种原因我直到现在才尝试。它按我的预期工作。

© www.soinside.com 2019 - 2024. All rights reserved.