Shopify Order の決済方法を Shopify GraphQL API で取得する方法をご紹介します。
Shopify で利用された決済方法を Shopify API 経由で取得したいというのが本記事のテーマです。
決済方法の例)
Shopify Community で質問してみるとすぐに回答をいただけました。有り難い。
{
  order(id: "gid://shopify/Order/3928604967067") {
    paymentGatewayNames
    transactions(first:10) {
      id
      accountNumber
      formattedGateway
      paymentMethod
      paymentIcon {
        altText
      }
    }
  }
}
{
  "data": {
    "order": {
      "paymentGatewayNames": [
        "shopify_payments"
      ],
      "transactions": [
        {
          "id": "gid://shopify/OrderTransaction/4886496805019",
          "accountNumber": "•••• •••• •••• 1111",
          "formattedGateway": "Shopify Payments",
          "paymentMethod": "VISA",
          "paymentIcon": {
            "altText": "Visa"
          }
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 3,
      "actualQueryCost": 3,
      "throttleStatus": {
        "maximumAvailable": 2000,
        "currentlyAvailable": 1997,
        "restoreRate": 100
      }
    }
  }
}
以上、Shopify Order の決済方法を Shopify GraphQL API で取得したい、現場からお送りしました。