# ペイウォールを取得する

> 指定されたプレースメントからペイウォールを取得します。

## OpenAPI

```yaml
/api-specs/web-api.yaml post /api/v2/web-api/paywall/
openapi: 3.1.0
info:
  title: Adapty Web API
  version: 1.0.0
  description: |
    Adapty Web API を使用すると、Adapty のサブスクリプション管理プラットフォームを
    Web アプリケーションに統合できます。この API は、ペイウォールの取得、
    ペイウォール表示の記録、アトリビューションデータの追加などのエンドポイントを提供します。
servers:
  - url: https://api.adapty.io
    description: 本番サーバー
security:
  - apikeyAuth: []
paths:
  /api/v2/web-api/paywall/:
    post:
      summary: ペイウォールを取得する
      description: 指定されたプレースメントからペイウォールを取得します。
      operationId: getPaywall
      security:
        - apikeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GetPaywallRequest"
            examples:
              basic:
                summary: Basic paywall request
                value:
                  store: app_store
                  locale: en
                  placement_id: PaywallPlacementId
                  customer_user_id: user123
      responses:
        "200":
          description: 成功レスポンスにはペイウォールオブジェクトが含まれます。
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaywallResponse"
              examples:
                basic:
                  summary: Basic paywall response
                  value:
                    placement_id: onboarding
                    variation_id: d76feea0-c0cf-4942-bef5-84ed701fc6db
                    paywall_id: 9a93fe6f-9162-4dc0-b4b7-73079ed95c34
                    ab_test_name: 1 week + 1 month | apple picture
                    paywall_name: 1 week + 1 month | apple picture
                    products:
                      - title: 1 week
                        is_consumable: false
                        adapty_product_id: 1c3e03e1-9c43-4f94-aeb5-c7ae2f73d0c2
                        vendor_product_id: 1_week_apple
                        introductory_offer_eligibility: true
                        promotional_offer_eligibility: true
                        base_plan_id: null
                        offer: null
                      - title: 1 month
                        is_consumable: false
                        adapty_product_id: f4088450-45a8-4737-8db0-367e642d7dcb
                        vendor_product_id: 1_month_apple
                        introductory_offer_eligibility: true
                        promotional_offer_eligibility: true
                        base_plan_id: null
                        offer: null
                    remote_config:
                      lang: en
                      data: "{\"default_product_number\":1,\"features\":[\"#fresh\",\"#green\",\"#healthy1\"],\"soft_paywall\":false,\"image_url\":\"https://adapty.io/apple.png\"}"
        "400":
          description: リクエストが不正です
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ParseError"
        "401":
          description: 認証されていません
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UnauthorizedError"
        "404":
          description: 見つかりません
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VariationIdNotFoundError"
components:
  schemas:
    GetPaywallRequest:
      type: object
      required:
        - store
        - placement_id
      properties:
        store:
          type: string
          description: |
            プロダクトが購入されたストア。指定可能な値: `app_store`、`play_store`、`stripe`、またはカスタムストアの `Store ID`。
          example: app_store
        locale:
          type: string
          description: ペイウォールロケールの識別子。"-" 文字で区切られた 1 つ以上のサブタグで構成される言語コードを指定します。最初のサブタグは言語、2 番目のサブタグは地域を示します。
          example: en
        placement_id:
          type: string
          description: プレースメントの識別子。Adapty ダッシュボードでプレースメントを作成する際に指定した値です。
          example: PaywallPlacementId
        customer_user_id:
          type: string
          description: "`customer_user_id` または `profile_id` のいずれかが必須です。アプリでユーザーを識別するために使用するユーザー ID（例：ユーザーの UUID、メールアドレス、その他の ID）。"
          example: user123
        profile_id:
          type: string
          description: "`customer_user_id` または `profile_id` のいずれかが必須です。Adapty におけるユーザーの識別子。"
          example: 3286abd3-48b0-4e9c-a5f6-ac0a006804a6
    PaywallResponse:
      type: object
      required:
        - placement_id
        - variation_id
        - paywall_id
        - paywall_name
        - products
      properties:
        placement_id:
          type: string
          description: このペイウォールが表示されるプレースメントの ID。Adapty ダッシュボードでプレースメントを作成する際に設定した値です。
          example: onboarding
        variation_id:
          type: string
          format: uuid
          description: この特定のペイウォールに紐付けられた購入を追跡するためのバリエーション ID。
          example: d76feea0-c0cf-4942-bef5-84ed701fc6db
        paywall_id:
          type: string
          format: uuid
          description: ペイウォールの一意識別子。
          example: 9a93fe6f-9162-4dc0-b4b7-73079ed95c34
        ab_test_name:
          type: string
          description: 親 A/B テストの名前。
          example: 1 week + 1 month | apple picture
        paywall_name:
          type: string
          description: Adapty ダッシュボードで定義されたペイウォールの名前。
          example: 1 week + 1 month | apple picture
        products:
          type: array
          items:
            $ref: "#/components/schemas/Product"
          description: ペイウォールのプロダクト情報を含むプロダクトオブジェクトの配列。
        remote_config:
          $ref: "#/components/schemas/RemoteConfig"
          description: ペイウォールのリモートコンフィグ全体を含む RemoteConfig オブジェクト。
    ParseError:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              source:
                type: string
              errors:
                type: array
                items:
                  type: string
        error_code:
          type: string
        status_code:
          type: integer
    UnauthorizedError:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              source:
                type: string
              errors:
                type: array
                items:
                  type: string
        error_code:
          type: string
        status_code:
          type: integer
    VariationIdNotFoundError:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              source:
                type: string
              errors:
                type: array
                items:
                  type: string
        error_code:
          type: string
        status_code:
          type: integer
    Product:
      type: object
      required:
        - is_consumable
        - vendor_product_id
      properties:
        title:
          type: string
          description: Adapty ダッシュボードのプロダクトセクションに設定されたプロダクト名。
        is_consumable:
          type: boolean
          description: プロダクトが消耗型アイテムかどうかを示します。
        adapty_product_id:
          type: string
          format: uuid
          description: Adapty で使用される内部プロダクト ID。
        vendor_product_id:
          type: string
          description: アプリストアにおけるプロダクト ID。
        introductory_offer_eligibility:
          type: boolean
          description: ユーザーが iOS の初回オファーの対象かどうかを示します。
        promotional_offer_eligibility:
          type: boolean
          description: ユーザーがプロモーションオファーの対象かどうかを示します。
        base_plan_id:
          type: string
          nullable: true
          description: |
            Google Play のベースプラン ID、または Stripe の価格 ID。
            Google Play については [Base plan ID](https://support.google.com/googleplay/android-developer/answer/12154973)、
            Stripe については [price ID](https://docs.stripe.com/products-prices/how-products-and-prices-work#use-products-and-prices) を参照してください。
        offer:
          allOf:
            - $ref: "#/components/schemas/Offer"
          nullable: true
          description: JSON 形式の Offer オブジェクト。
    RemoteConfig:
      type: object
      required:
        - lang
        - data
      properties:
        lang:
          type: string
          description: |
            ペイウォールローカライズのロケールコード。ハイフン (-) で区切られた言語および地域サブタグを使用します。
            例：英語の場合は `en`、ブラジルポルトガル語の場合は `pt-br`。
          example: en
        data:
          type: string
          description: |
            ペイウォールのリモートコンフィグをシリアライズした JSON 文字列。
            Adapty ダッシュボードの特定のペイウォールの [Remote Config] タブで確認できます。
    Offer:
      type: object
      required:
        - category
        - type
      properties:
        category:
          type: string
          enum:
            - introductory
            - promotional
            - offer_code
            - win_back
          description: 適用されたオファーのカテゴリ。
        type:
          type: string
          enum:
            - free_trial
            - pay_as_you_go
            - pay_up_front
            - unknown
          description: アクティブなオファーの種別。null でない場合、現在のサブスクリプション期間にオファーが適用されていることを意味します。
        id:
          type: string
          nullable: true
          description: 適用されたオファーの ID。
  securitySchemes:
    apikeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: |
        API リクエストは、**Authorization** ヘッダーに公開 API キーを使用して認証する必要があります。
        値は `Api-Key {your_public_api_key}` の形式（例：`Api-Key public_live_...`）で指定します。
        このキーは Adapty ダッシュボード -> **App Settings** -> **General** タブ -> **API keys** セクションで確認できます。
```
