添加客户时如何解决 `address.country` 的枚举值无效?

How to solve `not a valid enum value for `address.country` while adding the customer?

我正在将方块 api 与 golang 集成到我的软件中。但是当我使用以下 json 对象

发送添加客户请求时出现问题
{
  "given_name": "Sand Box Customer",
  "family_name": "This is a sandbox Family",
  "email_address": "sandbox@gmail.com",
  "address": {
    "address_line_1": "500 Electric Ave",
    "address_line_2": "Suite 600",
    "locality": "New York",
    "administrative_district_level_1": "NY",
    "postal_code": "10003",
    "country": "Australia"
  },
  "phone_number": "1-212-555-4240",
  "reference_id": "YOUR_REFERENCE_ID",
  "note": "a customer"
}

作为回应,它 returns 我有一个错误:-

{
  "errors": [
    {
      "category": "INVALID_REQUEST_ERROR",
      "code": "INVALID_ENUM_VALUE",
      "detail": "`Australia` is not a valid enum value for `address.country`.",
      "field": "address.country"
    }
  ]
}

为什么我会遇到这个错误,它支持 Australia 国家/地区,请参阅 link https://docs.connect.squareup.com/。我该如何解决这个错误?

文档 link:- https://docs.connect.squareup.com/get-started

根据他们的文档,您应该以 /ISO_3166-1_alpha-2 格式指定国家/地区。

参考文档

https://docs.connect.squareup.com/api/connect/v2#type-location .

您还可以从这里找到更多信息https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2