💵

【Shopify.dev和訳】Apps/App billing/Reporting

2021/11/26に公開約14,400字

この記事について

この記事は、Apps/App billing/Reportingの記事を和訳したものです。

記事内で使用する画像は、公式ドキュメント内の画像を引用して使用させていただいております。

Shopify アプリのご紹介

Shopify アプリである、「商品ページ発売予告アプリ | リテリア Coming Soon」は、商品ページを買えない状態のまま、発売日時の予告をすることができるアプリです。Shopify で Coming Soon 機能を実現することができます。

https://apps.shopify.com/shopify-application-314?locale=ja&from=daniel

Shopify アプリである、「らくらく日本語フォント設定|リテリア Font Picker」は、ノーコードで日本語フォントを使用できるアプリです。日本語フォントを導入することでブランドを演出することができます。

https://apps.shopify.com/font-picker-1?locale=ja&from=daniel

アプリの課金・収益のデータを報告する

アプリの収益を報告し、取引に関するデータを取得するには、2 つの方法があります。

Partner Dashboard でのアプリ料金の表示

アプリ課金の概要ページでは、View financialsを持つストアオーナーおよびスタッフが、1 回限りのアプリ課金、アプリ使用料、およびアプリ購読の詳細を Partner Dashboard で確認できます。

特定のマーチャントストアのアプリ課金を確認したい場合は、ストアのページからアプリ課金の詳細を確認することができます。特定の支払いに関連するアプリ料金を確認したい場合は、「支払い」ページからアプリ料金の詳細を表示できます。また、アプリの概要ページのアプリ履歴テーブルからアプリ課金の詳細を表示することもできます。

アプリ課金の詳細表示

各アプリ課金の概要ページには、特定のアプリ課金に関する以下の詳細が表示されます。

  • アプリがインストールされているストアへのリンクを含む、マーチャント情報
  • マーチャントが請求されたアプリの名前(アプリへのリンクを含む
  • アプリ課金またはサブスクリプションのステータス
  • チャージに関連するマーチャントペイメントトランザクションのリスト

トランザクションの隣にある矢印をクリックすると、そのトランザクションの以下の詳細が表示されます。

  • Shopify のレベニューシェア料、処理手数料、アプリ開発者としての純利益の項目別リスト
  • アプリの課金を含むパートナーペイアウトへのリンク(保留中のペイアウトでは利用できません)

Image from Gyazo

定期的なアプリ課金や 1 回限りのアプリ課金の場合は、追加の詳細が概要ページに記載されています。

定期的に発生するアプリの課金に関する追加情報

継続的アプリ課金のアプリ課金概要ページには、以下の詳細が表示されます。

  • サブスクリプションの説明 "30 日ごとに 15 ドル "など
  • サブスクリプションの作成日
  • 定期的なアプリ課金のステータス(以下のいずれか)。
    • Pending(保留)。Pending:マーチャントがまだチャージを承認または拒否していない状態。
    • Accepted(承認済み):マーチャントがチャージを承認しました。マーチャントが課金を承認しました。これは、2021-01 より古い REST API バージョンでのみ利用可能です。
    • Activated: マーチャントのサブスクリプションは現在アクティブです。
    • Declined: マーチャントはチャージを拒否しました。
    • Cancelled: マーチャントまたは開発者がサブスクリプションをキャンセルしました。
    • Frozen:サブスクリプションは、ストアのサブスクリプションの未払いにより保留されています。購読料の支払いが再開されると、課金が再開されます。
    • Expired:マーチャントは 2 日以内にサブスクリプションを受け入れませんでした。

ワンタイムアプリ課金の詳細について

ワンタイムアプリ課金のアプリ課金概要ページには、以下の詳細が表示されます。

  • ワンタイムチャージの説明
  • 料金の作成日
  • 定期的なアプリ変更のステータス(以下のいずれか)。
    • Pending(保留)。マーチャントがまだチャージを承認または拒否していない状態。
    • Accepted(承認済み)。マーチャントがチャージを承認しました。これは 2021-01 より古い REST API バージョンでのみ有効です。
    • Activated: マーチャントのサブスクリプションは現在アクティブです。
    • Declined: マーチャントが課金を拒否しました。
    • Expired(期限切れ)。マーチャントは 2 日以内にサブスクリプションを受け入れませんでした。

ストアのページからアプリの課金を見る

  1. Partner Dashboard にログインします。
  2. Partner Dashboard の検索バーに、確認したいアプリ課金があるストアの名前を入力します。
  3. 検索結果で、ストアの名前をクリックします。
  4. 確認したいアプリ課金の横にある、「詳細」欄のリンクをクリックします。

ペイアウトページからアプリ課金を確認する

  1. Partner Dashboard にログインします。
  2. Payouts をクリックします。
  3. 確認したいアプリの課金があるペイアウトをクリックします。
  4. 確認したいアプリ課金の横にある、「タイプ」欄のリンクをクリックします。

App Overview(アプリの概要)ページからアプリの課金を確認する

  1. Partner Dashboard にログインします。
  2. Apps をクリックします。
  3. 確認したい課金のあるアプリの名前をクリックします。
  4. 最新のアプリ履歴表で、確認したいアプリ料金の横にある「詳細」列のリンクをクリックします。
  5. すべての履歴を表示をクリックすると、より多くの料金が記載された表が表示されます。

Admin API でトランザクションデータを照会する

以下のセクションの例を使用して、Billing API データに慣れることができます。

AppPurchase のクエリ

Billing API を使用すると、個々の購入を照会したり、複数の購入を照会したりできます。

複数の購入の問い合わせ

複数の購入を問い合わせるには、currentAppInstallation タイプを使用できます。firstまたはlastを使用して、返すべき購入数を指定できます。

query {
  currentAppInstallation {
    oneTimePurchases(first: 2) {
      edges {
        node {
          ... on AppPurchaseOneTime {
            price {
              amount
              currencyCode
            }
            createdAt
            id
            name
            status
            test
          }
        }
      }
    }
  }
}
json response
{
  "data": {
    "currentAppInstallation": {
      "oneTimePurchases": {
        "edges": [
          {
            "node": {
              "price": {
                "amount": "100.0",
                "currencyCode": "USD"
              },
              "createdAt": "2017-11-01T19:17:09Z",
              "id": "gid://shopify/AppPurchaseOneTime/5308422",
              "name": "Super Duper Expensive action",
              "status": "ACTIVE",
              "test": true
            }
          },
          {
            "node": {
              "price": {
                "amount": "100.0",
                "currencyCode": "USD"
              },
              "createdAt": "2017-11-02T18:22:00Z",
              "id": "gid://shopify/AppPurchaseOneTime/5701638",
              "name": "Another Super Duper Expensive action",
              "status": "EXPIRED",
              "test": true
            }
          }
        ]
      }
    }
  },
  ...
}

単一の購入を問い合わせる

単一の購入を照会するには、引数にアプリの購入 ID を渡してAppPurchaseOneTimeのノードを照会します。

query {
  node(id: "gid://shopify/AppPurchaseOneTime/5308422") {
    ... on AppPurchaseOneTime {
      price {
        amount
        currencyCode
      }
      createdAt
      id
      name
      status
      test
    }
  }
}
json response
{
  "data": {
    "node": {
      "price": {
        "amount": "100.0",
        "currencyCode": "USD"
      },
      "createdAt": "2017-11-01T19:17:09Z",
      "id": "gid://shopify/AppPurchaseOneTime/5308422",
      "name": "Super Duper Expensive action",
      "status": "ACTIVE",
      "test": true
    }
  },
  ...
}

AppSubscription の問い合わせ

Billing API を使用して、個々のサブスクリプションを照会することも、複数のサブスクリプションを照会することもできます。

複数のサブスクリプションの問い合わせ

複数のサブスクリプションをクエリするには、currentAppInstallation タイプを使用できます。firstまたはlastを使用して、返すサブスクリプションの数を指定できます。

query {
  currentAppInstallation {
    allSubscriptions(first: 2) {
      edges {
        node {
          lineItems {
            plan {
              pricingDetails {
                __typename
                ... on AppRecurringPricing {
                  price {
                    amount
                    currencyCode
                  }
                }
                ... on AppUsagePricing {
                  balanceUsed {
                    amount
                    currencyCode
                  }
                  cappedAmount {
                    amount
                    currencyCode
                  }
                }
              }
            }
          }
          createdAt
          id
          name
          status
          test
        }
      }
    }
  }
}
json response
{
  "data": {
    "currentAppInstallation": {
      "allSubscriptions": {
        "edges": [
          {
            "node": {
              "lineItems": [
                {
                  "plan": {
                    "pricingDetails": {
                      "__typename": "AppRecurringPricing",
                      "price": {
                        "amount": "4.99",
                        "currencyCode": "USD"
                      }
                    }
                  }
                },
                {
                  "plan": {
                    "pricingDetails": {
                      "__typename": "AppUsagePricing",
                      "balanceUsed": {
                        "amount": "0.0",
                        "currencyCode": "USD"
                      },
                      "cappedAmount": {
                        "amount": "100.0",
                        "currencyCode": "USD"
                      }
                    }
                  }
                }
              ],
              "createdAt": "2016-08-30T17:00:16Z",
              "id": "gid://shopify/AppSubscription/2816132",
              "name": "Gift Basket Plan",
              "status": "EXPIRED",
              "test": true
            }
          },
          {
            "node": {
              "lineItems": [
                {
                  "plan": {
                    "pricingDetails": {
                      "__typename": "AppRecurringPricing",
                      "price": {
                        "amount": "4.99",
                        "currencyCode": "USD"
                      }
                    }
                  }
                },
                {
                  "plan": {
                    "pricingDetails": {
                      "__typename": "AppUsagePricing",
                      "balanceUsed": {
                        "amount": "0.0",
                        "currencyCode": "USD"
                      },
                      "cappedAmount": {
                        "amount": "100.0",
                        "currencyCode": "USD"
                      }
                    }
                  }
                }
              ],
              "createdAt": "2016-09-21T19:42:43Z",
              "id": "gid://shopify/AppSubscription/2962896",
              "name": "Gift Basket Plan",
              "status": "EXPIRED",
              "test": true
            }
          }
        ]
      }
    }
  },
  ...
}

単一のサブスクリプションの問い合わせ

単一のサブスクリプションを照会するには、引数にアプリの購入 ID を渡してAppSubscriptionのノードを照会します。

query {
  node(id: "gid://shopify/AppPurchaseOneTime/5308422") {
    ... on AppPurchaseOneTime {
      price {
        amount
        currencyCode
      }
      createdAt
      id
      name
      status
      test
    }
  }
}
json response
{
  "data": {
    "node": {
      "price": {
        "amount": "100.0",
        "currencyCode": "USD"
      },
      "createdAt": "2017-11-01T19:17:09Z",
      "id": "gid://shopify/AppPurchaseOneTime/5308422",
      "name": "Super Duper Expensive action",
      "status": "ACTIVE",
      "test": true
    }
  },
  ...
}

AppUsageRecords の問い合わせ

AppUsageRecords を問い合わせるには、currentAppInstallation タイプを使用できます。useRecords は、allSubscriptions の lineItems フィールドから取得できます。firstまたはlastを使用して、返すレコードの数を指定できます。

query {
  currentAppInstallation {
    allSubscriptions(first: 2) {
      edges {
        node {
          id
          status
          lineItems {
            id
            usageRecords(first: 5) {
              edges {
                node {
                  id
                  description
                  createdAt
                  price {
                    amount
                    currencyCode
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
json response
{
  "data": {
    "currentAppInstallation": {
      "allSubscriptions": {
        "edges": [
          {
            "node": {
              "id": "gid://shopify/AppSubscription/2816132",
              "status": "EXPIRED",
              "lineItems": [
                {
                  "id": "gid://shopify/AppSubscriptionLineItem/2816132?v=1&index=0",
                  "usageRecords": {
                    "edges": []
                  }
                },
                {
                  "id": "gid://shopify/AppSubscriptionLineItem/2816132?v=1&index=1",
                  "usageRecords": {
                    "edges": []
                  }
                }
              ]
            }
          },
          {
            "node": {
              "id": "gid://shopify/AppSubscription/2962896",
              "status": "EXPIRED",
              "lineItems": [
                {
                  "id": "gid://shopify/AppSubscriptionLineItem/2962896?v=1&index=0",
                  "usageRecords": {
                    "edges": []
                  }
                },
                {
                  "id": "gid://shopify/AppSubscriptionLineItem/2962896?v=1&index=1",
                  "usageRecords": {
                    "edges": []
                  }
                }
              ]
            }
          }
        ]
      }
    }
  },
  ...
}

特定のサブスクリプションの AppUsageRecords のクエリ

特定のサブスクリプションのAppUsageRecordをクエリするには、引数にアプリのサブスクリプション ID を渡してAppSubscriptionのノードをクエリします。

query {
  node(id: "gid://shopify/AppSubscription/4019585080") {
    ... on AppSubscription {
      lineItems {
        usageRecords(first: 5) {
          edges {
            node {
              id
              description
              createdAt
              price {
                amount
                currencyCode
              }
            }
          }
        }
      }
    }
  }
}
json response
{
  "data": {
    "node": {
      "lineItems": [
        {
          "usageRecords": {
            "edges": [
              {
                "node": {
                  "id": "gid://shopify/AppUsageRecord/14518231",
                  "description": "Super Mega Plan 1000 emails",
                  "createdAt": "2019-05-30T16:03:31Z",
                  "price": {
                    "amount": "1.0",
                    "currencyCode": "USD"
                  }
                }
              }
            ]
          }
        }
      ]
    }
  },
  ...
}

ID による特定の AppUsageRecord の問い合わせ

特定のアプリ使用記録を照会するには、引数にアプリ使用記録の ID を渡して、AppUsageRecordのノードを照会します。

query {
  node(id: "gid://shopify/AppUsageRecord/14518231") {
    ... on AppUsageRecord {
      createdAt
      description
      id
      price {
        amount
        currencyCode
      }
    }
  }
}
json response
{
  "data": {
    "node": {
      "createdAt": "2019-05-30T16:03:31Z",
      "description": "Super Mega Plan 1000 emails",
      "id": "gid://shopify/AppUsageRecord/14518231",
      "price": {
        "amount": "1.0",
        "currencyCode": "USD"
      }
    }
  },
  ...
}

次のステップ

Shopify アプリのご紹介

Shopify アプリである、「商品ページ発売予告アプリ | リテリア Coming Soon」は、商品ページを買えない状態のまま、発売日時の予告をすることができるアプリです。Shopify で Coming Soon 機能を実現することができます。

https://apps.shopify.com/shopify-application-314?locale=ja&from=daniel

Shopify アプリである、「らくらく日本語フォント設定|リテリア Font Picker」は、ノーコードで日本語フォントを使用できるアプリです。日本語フォントを導入することでブランドを演出することができます。

https://apps.shopify.com/font-picker-1?locale=ja&from=daniel

Discussion

ログインするとコメントできます