---
title: "サーバーサイド API"
description: "サブスクリプション管理のための Adapty サーバーサイド API を使ってみましょう。"
---

:::tip
AI コーディングエージェントを使っていますか？[バックエンドからサブスクリプションアクセスを確認・付与する](server-side-api-with-ai)に、一つのページにまとめたエンドツーエンドのレシピがあります。
:::

この API を使うと、以下のことができます：
1. ユーザーのサブスクリプション状態を確認する。
2. アクセスレベルでユーザーのサブスクリプションを有効化する。
3. ユーザー属性を取得する。
4. ユーザー属性を設定する。
5. ペイウォール設定を取得・更新する。

  <img src="/assets/shared/img/server.webp"
  style={{
    border: '1px solid #727272', /* border width and color */
    width: '700px', /* image width */
    display: 'block', /* for alignment */
    margin: '0 auto' /* center alignment */
  }}
/>

<p> </p>

:::note

サブスクリプションイベントを追跡するには、Adapty の [Webhook](webhook) 連携を利用するか、既存のサービスと直接連携してください。
:::

## ウェブとモバイル間でサブスクライバーを同期する場合 \{#case-1-sync-subscribers-between-web-and-mobile\}
StripeやChargeBeeなどのWeb決済プロバイダーを使用している場合、サブスクリプションユーザーを簡単に同期できます。手順は以下のとおりです：

1. <InlineTooltip tooltip="各ユーザーに一意のIDを割り当てる">[iOS](identifying-users)、[Android](android-identifying-users)、[React Native](react-native-identifying-users)、[Flutter](flutter-identifying-users)、[Unity](unity-identifying-users)</InlineTooltip>
2. APIを使用して[サブスクリプションのステータスを確認する](api-adapty/operations/getProfile)。
3. ユーザーがフリーミアムプランの場合、Webサイトにペイウォールを表示する。
4. 決済が完了したら、APIを通じてAdaptyの[サブスクリプションステータスを更新する](api-adapty/operations/setTransaction)。
5. サブスクリプションユーザーはモバイルアプリと自動的に同期されます。
## Case 2: サブスクリプションを付与する \{#case-2-grant-a-subscription\}

:::note
セキュリティ上の理由から、SDK を使ってサブスクリプションを付与することはできません。
:::

Google Play や App Store 以外のプラットフォーム（独自のオンラインストア、Amazon Appstore、Microsoft Store など）で販売している場合は、アクセス権の付与とアナリティクスでのトランザクション追跡を行うために、それらのトランザクションを Adapty と同期する必要があります。
1. <InlineTooltip tooltip="各ユーザーに固有のIDを割り当てる">[iOS](identifying-users)、[Android](android-identifying-users)、[React Native](react-native-identifying-users)、[Flutter](flutter-identifying-users)、[Unity](unity-identifying-users)</InlineTooltip>
2. [Adapty ダッシュボードでプロダクトのカスタムストアを設定する](custom-store)。
3. [Set transaction](api-adapty/operations/setTransaction) API リクエストを使用して、トランザクションを Adapty に同期する。
## ケース3: アクセスレベルを付与する \{#case-3-grant-an-access-level\}

7日間の無料トライアルプロモーションを実施していて、プラットフォーム間で一貫したエクスペリエンスを提供したいとします。モバイルアプリと同期するには:

1. <InlineTooltip tooltip="各ユーザーに一意のIDを割り当てる">[iOS](identifying-users)、[Android](android-identifying-users)、[React Native](react-native-identifying-users)、[Flutter](flutter-identifying-users)、[Unity](unity-identifying-users)</InlineTooltip>。
2. APIを使用して、7日間の[プレミアムアクセスを付与](api-adapty/operations/grantAccessLevel)します。
7日間が経過しても購読しないユーザーは、無料プランにダウングレードされます。
## ケース4: ユーザーのプロパティとカスタム属性を同期する \{#case-4-sync-users-properties-and-custom-attributes\}

言語学習アプリで学習した単語数など、ユーザー独自のカスタム属性がある場合も同期できます。

1. <InlineTooltip tooltip="各ユーザーに一意のIDを割り当てる">[iOS](identifying-users)、[Android](android-identifying-users)、[React Native](react-native-identifying-users)、[Flutter](flutter-identifying-users)、[Unity](unity-identifying-users)</InlineTooltip>。
2. APIまたはSDKで[属性を更新](api-adapty/operations/updateProfile)する。
これらのカスタム属性を使用して、セグメントを作成したり A/B テストを実行したりできます。
## ケース5: ペイウォール設定を管理する \{#case-5-manage-paywall-configurations\}

アプリを再デプロイすることなく、ペイウォールの外観や動作を動的に変更するために、[ペイウォールのリモートコンフィグを更新](api-adapty/operations/updatePaywall)できます。

---

**次のステップ:**
- [サーバーサイド API の認証](ss-authorization)に進む
- リクエスト:
  - [プロファイルを取得する](api-adapty/operations/getProfile)
  - [プロファイルを作成する](api-adapty/operations/createProfile)
  - [プロファイルを更新する](api-adapty/operations/updateProfile)
  - [プロファイルを削除する](api-adapty/operations/deleteProfile)
  - [アクセスレベルを付与する](api-adapty/operations/grantAccessLevel)
  - [アクセスレベルを取り消す](api-adapty/operations/revokeAccessLevel)
  - [トランザクションを設定する](api-adapty/operations/setTransaction)
  - [購入を検証し、顧客にアクセスレベルを付与し、トランザクション履歴をインポートする](api-adapty/operations/validateStripePurchase)
  - [インテグレーション識別子を追加する](api-adapty/operations/setIntegrationIdentifiers)
  - [ペイウォールを取得する](api-adapty/operations/getPaywall)
  - [ペイウォール一覧を取得する](api-adapty/operations/listPaywalls)
  - [ペイウォールを更新する](api-adapty/operations/updatePaywall)