# ペイウォール表示を記録する

> Adapty はペイウォールのコンバージョンを計測するのに役立ちます。ただし、そのためには
> ペイウォールが表示されたタイミングを記録する必要があります。記録がなければ、購入した
> ユーザーしか把握できず、購入しなかったユーザーを見逃してしまいます。
> ペイウォール表示を記録するにはこのリクエストを使用してください。

## OpenAPI

```yaml
/api-specs/web-api.yaml post /api/v2/web-api/paywall/visit/
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/visit/:
    post:
      summary: ペイウォール表示を記録する
      description: |
        Adapty はペイウォールのコンバージョンを計測するのに役立ちます。ただし、そのためには
        ペイウォールが表示されたタイミングを記録する必要があります。記録がなければ、購入した
        ユーザーしか把握できず、購入しなかったユーザーを見逃してしまいます。
        ペイウォール表示を記録するにはこのリクエストを使用してください。
      operationId: recordPaywallView
      security:
        - apikeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RecordPaywallViewRequest"
            examples:
              basic:
                summary: Basic paywall view recording
                value:
                  visited_at: "2024-08-24T14:15:22Z"
                  store: app_store
                  variation_id: 00000000-0000-0000-0000-000000000000
                  customer_user_id: user123
      responses:
        "201":
          description: ペイウォール表示が正常に記録されました。
          content:
            application/json:
              schema:
                type: object
                description: レスポンスボディは空です
        "400":
          description: リクエストが不正です
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InvalidDateFormatError"
        "401":
          description: 認証されていません
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UnauthorizedError"
        "404":
          description: 見つかりません
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProfileNotFoundError"
components:
  schemas:
    RecordPaywallViewRequest:
      type: object
      required:
        - store
        - variation_id
      properties:
        customer_user_id:
          type: string
          description: お客様のシステムにおけるユーザーの識別子。`customer_user_id` または `profile_id` のいずれかが必須です。
          example: user123
        profile_id:
          type: string
          description: Adapty におけるユーザーの識別子。`customer_user_id` または `profile_id` のいずれかが必須です。
          example: 3286abd3-48b0-4e9c-a5f6-ac0a006804a6
        visited_at:
          type: string
          format: date-time
          description: ユーザーがペイウォールを開いた日時。
          example: "2024-08-24T14:15:22Z"
        store:
          type: string
          description: |
            プロダクトが購入されたストア。指定可能な値: `app_store`、`play_store`、`stripe`、またはカスタムストアの `Store ID`。
          example: app_store
        variation_id:
          type: string
          format: uuid
          description: 購入を特定のペイウォールに紐付けるために使用するバリエーション ID。
          example: 00000000-0000-0000-0000-000000000000
    InvalidDateFormatError:
      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
    ProfileNotFoundError:
      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
  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** セクションで確認できます。
```
