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

この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)インテグレーションを使用するか、既存のサービスと直接連携してください。

:::

## ケース1：WebとモバイルのサブスクライバーをSync \{#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. サブスクライバーはモバイルアプリと自動的に同期されます。

## ケース2：サブスクリプションを付与する \{#case-2-grant-a-subscription\}

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

独自のオンラインストア、Amazon Appstore、Microsoft Store、またはGoogle PlayやApp 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：ユーザーのプロパティとカスタム属性をSyncする \{#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)