openapi: 3.1.0 info: title: Adapty 服务端 API version: 1.0.0 servers: - url: https://api.adapty.io description: 生产服务器 paths: /api/v2/server-side-api/profile/: post: summary: 创建用户画像 description: 在 Adapty 中创建应用的新终端用户。 operationId: createProfile tags: - Profile security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 - name: adapty-profile-id in: header required: false schema: type: string description: 您系统中用户画像的唯一 ID。如果您正在处理匿名用户画像,这是最佳选择。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 - name: adapty-platform in: header required: false schema: type: string description: 安装了您应用的用户设备平台 responses: '200': description: 用户画像创建成功 content: application/json: schema: $ref: '#/components/schemas/ProfileResponse' example: data: app_id: 14c3d623-2f3a-455a-aa86-ef83dff6913b profile_id: 3286abd3-48b0-4e9c-a5f6-ac0a006804a6 customer_user_id: jane.doe@example.com total_revenue_usd: 0 segment_hash: 8f45947bad31ab0c timestamp: 1736425645861 custom_attributes: - key: favourite_sport value: yoga access_levels: [] subscriptions: [] non_subscriptions: [] '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - source: non_field_errors errors: - Authentication credentials were not provided. error_code: not_authenticated status_code: 401 '500': description: 服务器内部错误 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ProfileRequest' example: first_name: Jane last_name: Doe gender: f email: jane.doe@example.com phone_number: '+1234567890' birthday: '2000-12-31' ip_country: FR store_country: US store: app_store analytics_disabled: true custom_attributes: - key: favourite_sport value: yoga installation_meta: device_id: 3fa85f64-5717-4562-b3fc-2c963f66afa6 device: string locale: en os: string platform: iOS timezone: Europe/Rome user_agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Mobile/15E148 Safari/604.1 idfa: EA7583CD-A667-48BC-B806-42ECB2B48333 idfv: E9D48DA5-3930-4B41-8521-D953AECD2F33 advertising_id: '' android_id: '' android_app_set_id: '' get: summary: 获取用户画像 description: 检索应用现有终端用户的详细信息。 operationId: getProfile tags: - Profile security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 - name: adapty-profile-id in: header required: false schema: type: string description: 您系统中用户画像的唯一 ID。如果您正在处理匿名用户画像,这是最佳选择。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 responses: '200': description: 用户画像获取成功 content: application/json: schema: $ref: '#/components/schemas/ProfileResponse' example: data: app_id: 14c3d333-2f3a-455a-aa86-ef83dff6913b profile_id: d8533a10-bcce-4e33-8c9d-88b05ac56559 customer_user_id: 77B14FB4-FD2A-4D38-AA3A-4C433F79863C total_revenue_usd: 9.99 segment_hash: fdaeef7f8aaa33c9 timestamp: 1733324566777 custom_attributes: - key: favourite_sport value: yoga access_levels: - access_level_id: premium store: app_store store_product_id: unlimited.9999 store_base_plan_id: null store_transaction_id: '2000000335013007' store_original_transaction_id: '2000000335013007' offer: null starts_at: null purchased_at: '2024-12-24T10:50:23+00:00' originally_purchased_at: '2024-12-24T10:50:23+00:00' expires_at: null renewal_cancelled_at: '2025-01-05T13:27:47.461425+00:00' billing_issue_detected_at: null is_in_grace_period: false cancellation_reason: null subscriptions: - store: app_store store_product_id: unlimited.9999 store_base_plan_id: null store_transaction_id: '2000000815013007' store_original_transaction_id: '2000000815013007' offer: null environment: Sandbox purchased_at: '2024-12-24T10:50:23+00:00' originally_purchased_at: '2024-12-24T10:50:23+00:00' expires_at: null renewal_cancelled_at: null billing_issue_detected_at: null is_in_grace_period: false cancellation_reason: null non_subscriptions: - purchase_id: 7a5f9a7d-e236-33e6-96d8-53a3c59c5562 store: app_store store_product_id: 1year.premium store_base_plan_id: null store_transaction_id: '30002109551456' store_original_transaction_id: '30002109551456' purchased_at: '2022-10-12T09:42:50+00:00' environment: Production is_refund: false is_consumable: false '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - source: non_field_errors errors: - Authentication credentials were not provided. error_code: not_authenticated status_code: 401 '404': description: 用户画像未找到 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - source: null errors: - Profile not found error_code: profile_does_not_exist status_code: 404 '500': description: 服务器内部错误 patch: summary: 更新用户画像 description: 更新用户画像信息 operationId: updateProfile tags: - Profile security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 - name: adapty-profile-id in: header required: false schema: type: string description: 您系统中用户画像的唯一 ID。如果您正在处理匿名用户画像,这是最佳选择。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 responses: '200': description: 用户画像更新成功 content: application/json: schema: $ref: '#/components/schemas/ProfileResponse' '400': description: 请求无效 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: 用户画像未找到 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: 服务器内部错误 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ProfileRequest' delete: summary: 删除用户画像 description: 删除用户画像 operationId: deleteProfile tags: - Profile security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 - name: adapty-profile-id in: header required: false schema: type: string description: 您系统中用户画像的唯一 ID。如果您正在处理匿名用户画像,这是最佳选择。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 responses: '204': description: 用户画像删除成功 '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: 用户画像未找到 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: 服务器内部错误 /api/v2/server-side-api/purchase/set/transaction/: post: summary: 设置交易 description: | 在 Adapty 中为您应用的最终用户创建新交易并提供访问等级。通过此方法创建的交易将出现在您的分析报告和事件动态中,并将发送至所有集成渠道。 **更新现有订阅:** 若要在不生成新的 `subscription_renewed` 事件的情况下更新 `billing_issue_detected_at` 或 `renew_status_changed_at`,请在相同的 `store_original_transaction_id` 下重用现有的 `store_transaction_id`。提交任何新的 `store_transaction_id` 将被视为新交易并触发 `subscription_renewed` 事件。 operationId: setTransaction tags: - Purchase security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 - name: adapty-profile-id in: header required: false schema: type: string description: 您系统中用户画像的唯一 ID。如果您使用匿名用户画像,此为最佳选择。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 responses: '200': description: 交易记录成功 content: application/json: schema: $ref: '#/components/schemas/ProfileResponse' '400': description: 请求无效 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: 未找到用户画像 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: 服务器内部错误 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/TransactionDTORequest' examples: one_time_purchase: summary: 一次性购买示例 value: purchase_type: one_time_purchase store: app_store environment: Production store_product_id: premium_lifetime store_transaction_id: '1000000123456789' store_original_transaction_id: '1000000123456789' is_family_shared: false price: country: US currency: USD value: 9.99 purchased_at: '2024-01-15T10:30:00Z' variation_id: variation_123 offer: null refunded_at: null cancellation_reason: null subscription: summary: 订阅示例 value: purchase_type: subscription store: app_store environment: Production store_product_id: premium_monthly store_transaction_id: '1000000123456789' store_original_transaction_id: '1000000123456789' is_family_shared: false price: country: US currency: USD value: 4.99 purchased_at: '2024-01-15T10:30:00Z' originally_purchased_at: '2024-01-15T10:30:00Z' expires_at: '2024-02-15T10:30:00Z' renew_status: true renew_status_changed_at: null billing_issue_detected_at: null grace_period_expires_at: null variation_id: variation_123 offer: category: introductory type: free_trial id: trial_offer_123 refunded_at: null cancellation_reason: null /api/v2/server-side-api/purchase/profile/grant/access-level/: post: summary: 授予访问等级 description: 无需提供交易信息即可为您的终端用户提供访问等级。当您为推荐或其他与产品相关的事件提供奖励时,此功能非常实用。通过此方法提供的访问等级不会反映在您的数据分析中。它仅会发送至 webhook 集成,且仅在此情况下才会出现在事件动态中。 operationId: grantAccessLevel tags: - Purchase security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 - name: adapty-profile-id in: header required: false schema: type: string description: 您系统中用户画像的唯一 ID。如果您使用匿名用户画像,此为最佳选项。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 responses: '200': description: 访问等级授予成功 content: application/json: schema: $ref: '#/components/schemas/ProfileResponse' '400': description: 请求无效 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: 用户画像未找到 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: 服务器内部错误 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/GrantAccessRequest' examples: immediate_grant: summary: 立即授予访问权限 value: access_level_id: premium scheduled_grant: summary: 授予具有开始和结束日期的访问权限 value: access_level_id: premium starts_at: '2024-01-01T00:00:00Z' expires_at: '2024-12-31T23:59:59Z' lifetime_grant: summary: 授予永久授权 value: access_level_id: premium starts_at: '2024-01-01T00:00:00Z' /api/v2/server-side-api/purchase/profile/revoke/access-level/: post: summary: 撤销访问等级 description: 从 Adapty 中移除应用终端用户的访问等级。 operationId: revokeAccessLevel tags: - Purchase security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 或 `adapty-profile-id` 必须提供其中之一。 - name: adapty-profile-id in: header required: false schema: type: string description: 您系统中用户画像的唯一 ID。如果您使用的是匿名用户画像,建议优先使用此参数。`adapty-customer-user-id` 或 `adapty-profile-id` 必须提供其中之一。 responses: '200': description: 访问等级已成功撤销 content: application/json: schema: $ref: '#/components/schemas/ProfileResponse' '400': description: 请求无效 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: 未找到用户画像 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: 服务器内部错误 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/RevokeAccessRequest' examples: immediate_revoke: summary: 立即撤销访问等级 value: access_level_id: premium scheduled_revoke: summary: 定时撤销访问等级 value: access_level_id: premium revoke_at: '2024-12-31T23:59:59Z' /api/v2/server-side-api/purchase/profile/refund-saver/settings/: get: summary: 获取退款保护设置 description: 获取该用户的退款保护偏好设置——Adapty 应要求应用商店拒绝还是批准其退款请求。该偏好设置为一个统一值,同时适用于 App Store 和 Google Play。此外,还可获取该用户的数据共享偏好设置——用户是否同意与 Apple 共享其数据。同意选项仅适用于 App Store。 operationId: getRefundSaverSettings tags: - Refund Saver security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 或 `adapty-profile-id` 必须提供其中之一。 - name: adapty-profile-id in: header required: false schema: type: string format: uuid description: 您系统中用户画像的唯一 ID。如果您正在处理匿名用户画像,此为最佳选择。`adapty-customer-user-id` 或 `adapty-profile-id` 必须提供其中之一。 responses: '200': description: 设置获取成功 content: application/json: schema: $ref: '#/components/schemas/RefundSaverSettingsResponse' example: profile_id: e5aab402-b1bd-4039-b632-57a91ebc0779 settings: consent: true custom_preference: no_preference '400': description: 请求错误 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' examples: profile_does_not_exist: summary: 用户画像不存在 value: errors: - Profile does not exist error_code: profile_does_not_exist status_code: 400 '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - Invalid API key error_code: unauthorized status_code: 401 '500': description: 服务器内部错误 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' post: summary: 设置退款保护设置 description: 为用户单独设置退款偏好,并记录用户是否同意共享其数据。该偏好设置为一个统一值,同时适用于 App Store 和 Google Play。同意选项仅适用于 App Store。每个应用商店还具有应用级别的默认偏好设置,您可以在 Adapty 看板中为所有用户更改该设置。如需为特定用户调整偏好设置,请使用看板、Adapty SDK 或服务端 API。 operationId: setRefundSaverSettings tags: - Refund Saver security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 或 `adapty-profile-id` 必须提供其中之一。 - name: adapty-profile-id in: header required: false schema: type: string format: uuid description: 您系统中用户画像的唯一 ID。如果您正在处理匿名用户画像,此为最佳选择。`adapty-customer-user-id` 或 `adapty-profile-id` 必须提供其中之一。 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/RefundSaverSettingsRequest' example: custom_preference: grant consent: true responses: '200': description: 设置更新成功 content: application/json: schema: $ref: '#/components/schemas/RefundSaverSettingsResponse' example: profile_id: e5aab402-b1bd-4039-b632-57a91ebc0779 settings: consent: true custom_preference: grant '400': description: 请求错误 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' examples: profile_does_not_exist: summary: 用户画像不存在 value: errors: - Profile does not exist error_code: profile_does_not_exist status_code: 400 validation_error: summary: 验证错误 value: errors: - Profile refund saver settings must have either consent or custom_preference or both error_code: validation_error status_code: 400 '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - Invalid API key error_code: unauthorized status_code: 401 '500': description: 服务器内部错误 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' /api/v1/sdk/purchase/stripe/token/validate/: post: summary: 验证 Stripe 购买 description: | 使用提供的 Stripe 令牌,通过 Adapty 看板中应用设置里的 Stripe 凭据验证购买。 如果购买有效,则将交易历史从 Stripe 导入到 Adapty 中具有指定 customer_user_id 的用户画像。 如果之前不存在该 customer_user_id 的用户画像,则会自动创建。 系统会同步生成用户画像事件,导入的交易记录将计入 MTR。 operationId: validateStripePurchase tags: - Stripe security: - apikeyAuth: [] requestBody: required: true content: application/vnd.api+json: schema: $ref: '#/components/schemas/StripeValidationRequest' example: data: type: stripe_receipt_validation_result attributes: customer_user_id: stripe_token: responses: '200': description: 购买验证成功 content: application/vnd.api+json: schema: $ref: '#/components/schemas/StripeValidationResponse' example: data: null '400': description: 请求无效 content: application/vnd.api+json: schema: $ref: '#/components/schemas/StripeErrorResponse' example: errors: - detail: none is not an allowed value source: pointer: /data/attributes/stripe_token status: '400' '401': description: 未授权 content: application/vnd.api+json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: 服务器内部错误 content: application/vnd.api+json: schema: $ref: '#/components/schemas/ErrorResponse' /api/v2/server-side-api/purchase/paddle/token/validate/: post: summary: 验证 Paddle 购买 description: | 使用 Adapty 看板应用设置中 Paddle 的凭据,通过提供的 Paddle 令牌验证购买。 如果购买有效,则将交易历史记录从 Paddle 导入到 Adapty 中具有指定 customer_user_id 的用户画像。 如果之前不存在具有此 customer_user_id 的用户画像,则将创建一个新的用户画像。 operationId: validatePaddlePurchase tags: - Paddle security: - apikeyAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PaddleValidationRequest' example: customer_user_id: paddle_token: live_7d279f61a3339fed520f7cd8c08 responses: '200': description: 购买验证成功 content: application/json: schema: $ref: '#/components/schemas/ProfileResponse' example: data: app_id: 14c3d623-2f3a-455a-aa86-ef83dff6913b profile_id: 3286abd3-48b0-4e9c-a5f6-ac0a006804a6 customer_user_id: Jane.doe@example.com total_revenue_usd: 0 segment_hash: 8f45947bad31ab0c timestamp: 1736436751469 custom_attributes: - key: favourite_sport value: yoga access_levels: [] subscriptions: - purchase_id: 5a7ab471-2299-45f7-ad69-1d395c1256e3 store: app_store store_product_id: 1year.premium store_base_plan_id: null store_transaction_id: '30002109551456' store_original_transaction_id: '30002109551456' purchased_at: '2022-10-12T09:42:50+00:00' environment: Production is_refund: false is_consumable: false non_subscriptions: [] '400': description: 请求无效 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' examples: no_products_found: summary: 未找到产品 value: errors: - No products found error_code: no_products_found status_code: 400 paddle_api_key_not_found: summary: 未找到 Paddle API 密钥 value: errors: - Paddle API key not found error_code: paddle_api_key_not_found status_code: 400 invalid_paddle_credentials_or_purchase_not_found: summary: Paddle 凭据无效或未找到购买记录 value: errors: - Invalid Paddle credentials or purchase not found error_code: invalid_paddle_credentials_or_purchase_not_found status_code: 400 '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - Invalid API key error_code: unauthorized status_code: 401 '500': description: 服务器内部错误 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' /api/v2/server-side-api/integration/profile/set/integration-identifiers/: get: summary: 获取集成标识符 description: 检索用户画像的集成标识符。 operationId: getIntegrationIdentifiers tags: - Integration security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 - name: adapty-profile-id in: header required: false schema: type: string format: uuid description: 您系统中用户画像的唯一 ID。如果您正在处理匿名用户画像,这是最佳选择。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 responses: '200': description: 集成标识符检索成功 content: application/json: schema: $ref: '#/components/schemas/IntegrationIdentifiersResponse' example: facebook_anonymous_id: XZ7EF7D15E-8FA1-49D8-B180-918EB333E42A amplitude_user_id: null amplitude_device_id: null mixpanel_user_id: 33w6yv5DPqVlyMVbjW31xvzJLtJ3 appmetrica_profile_id: null appmetrica_device_id: null one_signal_player_id: null one_signal_subscription_id: 333ed338-757d-466a-a672-ab92db196a1f pushwoosh_hwid: null firebase_app_instance_id: C333B35DF1DB418E99F7B815E9F5C549 airbridge_device_id: null appsflyer_id: 1741933337626-3179568 branch_id: null adjust_device_id: null tenjin_analytics_installation_id: null posthog_distinct_user_id: null '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - Invalid API key error_code: unauthorized status_code: 401 '404': description: 用户画像未找到 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - Profile not found error_code: profile_not_found status_code: 404 '500': description: 服务器内部错误 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' post: summary: 设置集成标识符 description: 向用户画像添加集成标识符。 operationId: setIntegrationIdentifiers tags: - Integration security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 - name: adapty-profile-id in: header required: false schema: type: string format: uuid description: 您系统中用户画像的唯一 ID。如果您正在处理匿名用户画像,这是最佳选择。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/IntegrationIdentifiersRequest' example: pushwoosh_hwid: example_pushwoosh_hwid mixpanel_user_id: example_mixpanel_user_id facebook_anonymous_id: example_facebook_anonymous_id firebase_app_instance_id: example_firebase_app_instance_id amplitude_user_id: example_amplitude_user_id amplitude_device_id: example_amplitude_device_id appmetrica_device_id: example_appmetrica_device_id appmetrica_profile_id: example_appmetrica_profile_id one_signal_subscription_id: example_one_signal_subscription_id one_signal_player_id: example_one_signal_player_id branch_id: example_branch_id appsflyer_id: example_appsflyer_id adjust_device_id: example_adjust_device_id airbridge_device_id: example_airbridge_device_id tenjin_analytics_installation_id: example_tenjin_analytics_installation_id posthog_distinct_user_id: example_posthog_distinct_user_id responses: '200': description: 集成标识符设置成功。响应体为空。 '400': description: 请求错误 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - At least one integration identifier must be provided. error_code: validation_error status_code: 400 '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - Invalid API key error_code: unauthorized status_code: 401 '404': description: 用户画像未找到 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - Profile not found error_code: profile_not_found status_code: 404 '500': description: 服务器内部错误 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' /api/v2/server-side-api/paywalls/: get: summary: 获取付费墙列表 description: 检索您应用中的付费墙列表。 operationId: listPaywalls tags: - Paywalls security: - apikeyAuth: [] parameters: - name: page[number] in: query required: false schema: type: integer minimum: 1 default: 1 description: 分页页码 - name: page[size] in: query required: false schema: type: integer minimum: 1 maximum: 100 default: 20 description: 每页条目数量 responses: '200': description: 付费墙获取成功 content: application/json: schema: $ref: '#/components/schemas/PaywallListResponse' example: data: - title: LlkTlizT paywall_id: fd891d4f-5906-45b9-97c1-13cc3dc665df use_paywall_builder: false use_paywall_builder_legacy: false updated_at: '2025-07-08T07:27:06.754527+00:00' created_at: '2025-07-08T07:27:06.754541+00:00' state: live is_deleted: false web_purchase_url: null products: - product_id: b95e9e51-a056-4eb6-9cf7-b75d139e7c3c title: mFUQPcJQ product_set: uncategorised offer: null - title: Premium Subscription paywall_id: a1cf7850-1bb8-4151-8336-a4e588730c55 use_paywall_builder: true use_paywall_builder_legacy: false updated_at: '2025-07-28T08:15:13.722680+00:00' created_at: '2025-07-25T13:40:01.789853+00:00' state: live is_deleted: false web_purchase_url: https://example.com/purchase products: - product_id: b136422f-8153-402a-afbb-986929c68f6a title: Premium Monthly product_set: uncategorised offer: product_offer_id: e31a4296-f250-4faf-ac80-3cc93c2da8f5 title: Free Trial meta: pagination: count: 365 page: 1 pages: 183 '400': description: 请求无效 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - source: page_size errors: - Invalid page_size parameter. Must be between 1 and 100. error_code: validation_error status_code: 400 '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - Invalid API key error_code: unauthorized status_code: 401 '500': description: 服务器内部错误 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' /api/v2/server-side-api/paywalls/{paywall_id}/: get: summary: 获取付费墙 description: 检索应用中的特定付费墙。 operationId: getPaywall tags: - Paywalls security: - apikeyAuth: [] parameters: - name: paywall_id in: path required: true schema: type: string format: uuid description: 要检索的付费墙的唯一标识符 responses: '200': description: 付费墙检索成功 content: application/json: schema: $ref: '#/components/schemas/PaywallResponse' example: title: Premium Subscription paywall_id: fd891d4f-5906-45b9-97c1-13cc3dc665df use_paywall_builder: true use_paywall_builder_legacy: false updated_at: '2025-07-30T11:13:58.798Z' created_at: '2025-07-30T11:13:58.798Z' state: live is_deleted: false web_purchase_url: https://example.com/purchase products: - product_id: b95e9e51-a056-4eb6-9cf7-b75d139e7c3c title: Premium Monthly product_set: uncategorised offer: product_offer_id: e31a4296-f250-4faf-ac80-3cc93c2da8f5 title: Free Trial remote_configs: - locale: en data: '{"title":"Premium Features","subtitle":"Unlock all premium content"}' main_screenshot: image_id: 123456 url: https://public-media.adapty.io/public/screenshot.jpg '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - Invalid API key error_code: unauthorized status_code: 401 '404': description: 付费墙未找到 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - source: null errors: - Paywall not found error_code: paywall_does_not_exist status_code: 404 '500': description: 服务器内部错误 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' put: summary: 更新付费墙 description: | 更新特定付费墙的远程配置。此端点允许您修改远程配置值,以便自定义付费墙的外观和行为。 **重要提示:** 如果您更新远程配置,将覆盖所有现有的远程配置!如果需要保留现有的远程配置,请先获取该付费墙,然后从中复制 remote_configs,并在更新请求中仅修改您需要更改的对象。 operationId: updatePaywall tags: - Paywalls security: - apikeyAuth: [] parameters: - name: paywall_id in: path required: true schema: type: string format: uuid description: 要更新的付费墙的唯一标识符 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PaywallUpdateRequest' example: remote_configs: - locale: en data: '{"title":"Premium Features","subtitle":"Unlock all premium content"}' responses: '200': description: 付费墙更新成功 content: application/json: schema: $ref: '#/components/schemas/PaywallResponse' example: title: Premium Subscription paywall_id: fd891d4f-5906-45b9-97c1-13cc3dc665df use_paywall_builder: true use_paywall_builder_legacy: false updated_at: '2025-07-30T11:13:58.798Z' created_at: '2025-07-30T11:13:58.798Z' state: live is_deleted: false web_purchase_url: https://example.com/purchase products: - product_id: b95e9e51-a056-4eb6-9cf7-b75d139e7c3c title: Premium Monthly product_set: uncategorised offer: product_offer_id: e31a4296-f250-4faf-ac80-3cc93c2da8f5 title: Free Trial remote_configs: - locale: en data: '{"title":"Premium Features","subtitle":"Unlock all premium content"}' main_screenshot: image_id: 123456 url: https://public-media.adapty.io/public/screenshot.jpg '400': description: 错误请求 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - source: remote_configs errors: - At least one field must be provided error_code: validation_error status_code: 400 '401': description: 未授权 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - Invalid API key error_code: unauthorized status_code: 401 '404': description: 付费墙未找到 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - source: null errors: - Paywall not found error_code: paywall_does_not_exist status_code: 404 '500': description: 服务器内部错误 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' /api/v2/server-side-api/vc/transactions/: post: summary: 创建虚拟货币交易 description: | 在单个原子事务中为用户画像的一种或多种虚拟货币进行增减操作。使用正数 `amount` 表示增加(授予),负数 `amount` 表示减少(消耗)。所有条目同时生效——若任一条目失败,则全部不生效。 每种货币代码在单次请求中只能出现一次。通过此端点增加的余额始终为永久有效余额。 若要在虚拟货币数据分析中使用该交易,请使用 `operation` 和 `feature` 对其进行标记。所有标记字段均为可选项:仅包含 `items` 和 `metadata` 的请求将以 `operation: null` 保存。 operationId: createVirtualCurrencyTransaction tags: - Virtual Currency security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 - name: adapty-profile-id in: header required: false schema: type: string description: 您系统中用户画像的唯一 ID。如果您使用的是匿名用户画像,建议优先使用此字段。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 - name: Idempotency-Key in: header required: false schema: type: string format: uuid description: | 使请求具有幂等性的 UUID v4。如果您使用相同的密钥重试请求,Adapty 将返回原始交易的结果,而不会再次更改余额。必须是有效的 UUID v4。 密钥的记忆时间最长为一小时,且仅限于单个用户画像。超过该时间窗口后,使用相同密钥的请求将被视为新交易——因此请使用该密钥安全地重试调用,而非用于长期去重授予操作。 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/VirtualCurrencyTransactionRequest' examples: debit: summary: 在某个功能上消耗(扣除)一种货币 value: items: - currency_code: COINS amount: -10 operation: spend feature: power_up.extra_life customer_placement_id: level-complete reference_id: session_7781 credit: summary: 作为奖励授予(增加)一种货币 value: items: - currency_code: COINS amount: 500 operation: reward feature: welcome store_purchase_credit: summary: 为后端处理的购买充值金币 value: items: - currency_code: COINS amount: 500 operation: top_up store: app_store store_transaction_id: '2000001218103228' multi_currency: summary: 同时扣除两种货币 value: items: - currency_code: GOLD amount: -50 - currency_code: SILVER amount: -200 conversion: summary: 将一种货币兑换为另一种货币 value: items: - currency_code: SILVER amount: -100 - currency_code: GOLD amount: 10 operation: exchange responses: '201': description: 交易已创建。响应体为已创建的交易,格式与交易历史记录中的条目相同,并附有交易后的余额。 content: application/json: schema: $ref: '#/components/schemas/VirtualCurrencyTransactionResponse' example: transaction_id: 019a7c3e-5b2a-7c1d-9e4f-0a1b2c3d4e5f transaction_type: api_transaction items: - currency_code: COINS amount: -10 balance_after: 90 metadata: null operation: spend feature: power_up.extra_life customer_placement_id: level-complete reference_id: session_7781 is_sandbox: false store: null store_transaction_id: null created_at: '2026-11-12T10:00:00.123Z' response_created_at: 1794477600123 balances: - code: COINS name: Coins balance: 90 held: 0 available: 90 '400': description: | 请求无效。`error_code` 字段标识原因: - `validation_error` — 请求体或请求头无效。例如,标记字段格式错误、`items` 为空或超过 20 个条目、`amount` 为 0 或超出 int32 范围、货币代码重复、`metadata` 不符合约束条件,或未发送 `adapty-profile-id` 也未发送 `adapty-customer-user-id`。`errors[].source` 指明了出错字段。对于跨多个字段的检查(例如发送了 `store` 但未发送 `store_transaction_id`),`source` 为空字符串。 - `parse_error` — 请求体不是有效的 JSON。 - `idempotency_key_invalid` — `Idempotency-Key` 不是 UUID v4。 - `unknown_currency` — 该货币未在应用中配置。 - `unknown_store` — `store` 是一个未在应用中配置的自定义商店。 - `insufficient_balance` — 扣除金额超过可用余额。 - `balance_overflow` — 增加金额将导致余额超出 int32 范围。 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' examples: validation_error: summary: 无效的 feature 格式 value: errors: - source: feature errors: - String should match pattern '^[a-zA-Z0-9_]{1,32}(\.[a-zA-Z0-9_]{1,32})?$' error_code: validation_error status_code: 400 store_pair: summary: 发送了 store 但未发送 store_transaction_id value: errors: - source: '' errors: - Value error, store and store_transaction_id must be sent together error_code: validation_error status_code: 400 insufficient_balance: summary: 余额不足 value: errors: - source: currency_code errors: - Insufficient balance for currency COINS error_code: insufficient_balance status_code: 400 '401': description: 未授权。API 密钥缺失或无效(`error_code` 为 `not_authenticated`)。 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: 未找到用户画像(`error_code` 为 `profile_does_not_exist`)。 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '409': description: | 冲突。使用相同 `Idempotency-Key` 的请求仍在处理中(`error_code` 为 `idempotency_in_flight`)。请在 `Retry-After` 响应头指定的时间间隔后重试。 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - source: null errors: - A similar request is being processed. error_code: idempotency_in_flight status_code: 409 '429': description: | 请求过于频繁。超出了每个应用或全局的速率限制(`error_code` 为 `rate_limited`)。默认限制为每个应用每分钟 600 次请求,全局每分钟 6000 次请求。 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: 服务器内部错误 get: summary: 列出虚拟货币交易记录 description: | 返回用户画像的虚拟货币交易历史记录,按最新优先排序。结果使用游标分页:当响应中包含非空的 `pagination.next_cursor` 时,将其作为 `cursor` 查询参数传回以获取下一页。 operationId: listVirtualCurrencyTransactions tags: - Virtual Currency security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 - name: adapty-profile-id in: header required: false schema: type: string description: 您系统中用户画像的唯一 ID。如果您使用的是匿名用户画像,建议优先使用此字段。`adapty-customer-user-id` 或 `adapty-profile-id` 二者必填其一。 - name: currency_code in: query required: false schema: type: string description: 将历史记录筛选为单一虚拟货币代码。 - name: cursor in: query required: false schema: type: string description: 在上一次响应中作为 `pagination.next_cursor` 返回的不透明分页游标。省略此参数以获取第一页。 - name: limit in: query required: false schema: type: integer default: 50 minimum: 1 maximum: 100 description: 每页返回的最大交易数量。默认为 50。 responses: '200': description: 交易历史记录返回成功 content: application/json: schema: $ref: '#/components/schemas/VirtualCurrencyTransactionsHistoryResponse' example: data: - transaction_id: 0190e8a4-1c2b-7def-8abc-2c1a4b6d8e90 transaction_type: api_transaction items: - currency_code: COINS amount: 500 balance_after: 12950 metadata: null operation: reward feature: daily_bonus customer_placement_id: home-screen reference_id: null is_sandbox: false store: null store_transaction_id: null created_at: '2026-05-23T10:30:00Z' - transaction_id: 0190e7b2-9a44-7c10-bb31-7d2e9f0a1c55 transaction_type: store_purchase items: - currency_code: COINS amount: 1000 balance_after: 12450 metadata: null operation: top_up feature: null customer_placement_id: null reference_id: null is_sandbox: false store: app_store store_transaction_id: '2000001218103228' created_at: '2026-05-22T18:05:12Z' - transaction_id: 0190e5c0-3f18-7b9a-9e6d-44a1c8b27e03 transaction_type: subscription_renewal items: - currency_code: GEMS amount: 200 balance_after: 3280 metadata: null operation: top_up feature: null customer_placement_id: null reference_id: null is_sandbox: false store: play_store store_transaction_id: GPA.3345-1234-5678-90123 created_at: '2026-05-20T09:00:00Z' pagination: next_cursor: MjAyNi0wNS0yMFQwOTowMDowMFowMTkwZTVjMC0zZjE4LTdiOWEtOWU2ZC00NGExYzhiMjdlMDM= '400': description: | 请求无效。`error_code` 字段标识原因: - `validation_error` — `limit` 超出 1–100 范围,或未发送 `adapty-profile-id` 也未发送 `adapty-customer-user-id`。 - `invalid_cursor` — `cursor` 值无法解析。 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: 未授权。API 密钥缺失或无效(`error_code` 为 `not_authenticated`)。 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: 未找到用户画像(`error_code` 为 `profile_does_not_exist`)。 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: 服务器内部错误 /api/v2/server-side-api/vc/balances/: get: summary: 列出虚拟货币余额 description: | 返回某个用户画像中每种虚拟货币的当前余额。如果应用没有虚拟货币,`data` 为空数组。 operationId: listVirtualCurrencyBalances tags: - Virtual Currency security: - apikeyAuth: [] parameters: - name: adapty-customer-user-id in: header required: false schema: type: string description: 您系统中客户的唯一 ID。`adapty-customer-user-id` 和 `adapty-profile-id` 二者必填其一。 - name: adapty-profile-id in: header required: false schema: type: string description: 您系统中用户画像的唯一 ID。如果您正在处理匿名用户画像,这是最佳选择。`adapty-customer-user-id` 和 `adapty-profile-id` 二者必填其一。 responses: '200': description: 余额返回成功 content: application/json: schema: $ref: '#/components/schemas/VirtualCurrencyBalanceListResponse' example: response_created_at: 1779791400000 data: - code: COINS name: Gold Coins balance: 12450 held: 0 available: 12450 - code: GEMS name: Gems balance: 3280 held: 0 available: 3280 - code: ENERGY name: Energy balance: 840 held: 0 available: 840 '400': description: 请求无效。未发送 `adapty-profile-id` 或 `adapty-customer-user-id`(`error_code` 为 `validation_error`)。 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: 未授权。API 密钥缺失或无效(`error_code` 为 `not_authenticated`)。 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: 用户画像未找到(`error_code` 为 `profile_does_not_exist`)。 content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: 服务器内部错误 components: securitySchemes: apikeyAuth: type: apiKey name: Authorization in: header default: Api-Key {Your secret API key} description: | API 请求必须通过您的密钥进行身份验证,将其作为 **Authorization** 请求头, 值为 `Api-Key {your_secret_api_key}`,例如 `Api-Key secret_live_...`。 请在 Adapty 看板 -> **App Settings** -> **General** 标签页 -> **API keys** 部分找到此密钥。 requestBodies: DefaultJson: required: true content: application/json: schema: type: object schemas: ProfileRequest: type: object properties: first_name: type: string nullable: true description: 您的终端用户的名字 last_name: type: string nullable: true description: 您的终端用户的姓氏 gender: type: string nullable: true enum: - f - m - o description: 您的终端用户的性别 email: type: string nullable: true format: email description: 您的终端用户的电子邮件地址 phone_number: type: string nullable: true description: 您的终端用户的电话号码 birthday: type: string format: date nullable: true description: 您的终端用户的生日 ip_country: type: string nullable: true description: 终端用户所在国家/地区,使用两位字母的 ISO 3166-1 alpha-2 代码,例如 `FR` ip_v4_address: type: string nullable: true description: 终端用户的 IPv4 地址 store_country: type: string nullable: true description: 终端用户应用商店所在国家/地区,使用两位字母的 ISO 3166-1 alpha-2 代码,例如 `US` store: type: string nullable: true enum: - app_store - play_store - stripe - adapty - paddle description: 用户在您的应用中进行购买所使用的平台 store_account_token: type: string format: uuid nullable: true description: 商店账户令牌 att_status: type: integer nullable: true enum: - 0 - 1 - 2 - 3 description: Apple 应用跟踪透明度(ATT)状态(0=未确定,1=受限,2=已拒绝,3=已授权) analytics_disabled: type: boolean nullable: true description: 用于退出外部分析的选项 custom_attributes: type: array items: $ref: '#/components/schemas/CustomAttribute' description: 允许为用户画像设置最多 30 个自定义属性 installation_meta: $ref: '#/components/schemas/InstallationMeta' required: - installation_meta example: first_name: Jane last_name: Doe gender: f email: jane.doe@example.com phone_number: '+1234567890' birthday: '2000-12-31' ip_country: FR ip_v4_address: 192.168.1.1 store_country: US store: app_store store_account_token: 3fa85f64-5717-4562-b3fc-2c963f66afa6 att_status: 3 analytics_disabled: true custom_attributes: - key: favourite_sport value: yoga installation_meta: device_id: 3fa85f64-5717-4562-b3fc-2c963f66afa6 device: iPhone 15 Pro locale: en os: iOS 17.1 platform: iOS timezone: Europe/Rome user_agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Mobile/15E148 Safari/604.1 app_build: 1.0.0 app_version: 1.0.0 adapty_sdk_version: 2.0.0 idfa: EA7583CD-A667-48BC-B806-42ECB2B48333 idfv: E9D48DA5-3930-4B41-8521-D953AECD2F33 advertising_id: '' android_id: '' android_app_set_id: '' ProfileResponse: type: object properties: data: $ref: '#/components/schemas/Profile' required: - data Profile: type: object properties: app_id: type: string format: uuid description: 您的应用程序的内部 ID profile_id: type: string format: uuid description: Adapty 用户画像 ID customer_user_id: type: string nullable: true description: 您的系统中该用户的 ID total_revenue_usd: type: number format: float description: 一个浮点数值,表示该用户画像所产生的以美元计算的总收入 segment_hash: type: string description: 内部参数 timestamp: type: integer format: int64 description: 响应时间(毫秒),用于解决竞态条件 custom_attributes: type: array items: $ref: '#/components/schemas/CustomAttribute' description: 每个用户画像最多允许设置 30 个自定义属性 access_levels: type: array items: $ref: '#/components/schemas/AccessLevel' description: 访问等级对象数组。如果用户没有任何访问等级,则为空数组 subscriptions: type: array items: $ref: '#/components/schemas/Subscription' description: 订阅对象数组。如果用户没有任何订阅,则为空数组 non_subscriptions: type: array items: $ref: '#/components/schemas/NonSubscription' description: 一次性购买对象数组。如果用户没有任何购买记录,则为空数组 required: - app_id - profile_id - customer_user_id - total_revenue_usd - segment_hash - timestamp - custom_attributes - access_levels - subscriptions - non_subscriptions CustomAttribute: type: object properties: key: type: string maxLength: 30 description: 键必须是不超过 30 个字符的字符串。只允许使用字母、数字、破折号、点和下划线 value: oneOf: - type: string - type: number description: 属性值不得超过 50 个字符。值只允许使用字符串和浮点数 required: - key - value InstallationMeta: type: object properties: device_id: type: string format: uuid description: 唯一设备标识符 device: type: string nullable: true description: 设备信息 locale: type: string nullable: true description: 设备语言区域 os: type: string nullable: true description: 操作系统信息 platform: type: string nullable: true enum: - iOS - macOS - iPadOS - Android - visionOS - web description: 平台(iOS、Android 等) timezone: type: string nullable: true description: 设备时区 user_agent: type: string nullable: true description: 用户代理字符串 app_build: type: string nullable: true description: 应用构建版本 app_version: type: string nullable: true description: 应用版本 adapty_sdk_version: type: string nullable: true description: Adapty SDK 版本 idfa: type: string nullable: true description: iOS 广告主标识符 idfv: type: string nullable: true description: iOS 供应商标识符 advertising_id: type: string nullable: true description: Android 广告 ID android_id: type: string nullable: true description: Android 设备 ID android_app_set_id: type: string nullable: true description: Android 应用集 ID required: - device_id AccessLevel: type: object properties: access_level_id: type: string description: 访问等级标识符 store: type: string description: 购买访问等级的商店 store_product_id: type: string description: 商店中的产品 ID。对于 App Store 12 个月承诺计划,ID 以 `:monthly` 结尾。 store_base_plan_id: type: string nullable: true description: 商店中的基础方案 ID store_transaction_id: type: string description: 商店中的交易 ID store_original_transaction_id: type: string description: 商店中的原始交易 ID offer: allOf: - $ref: '#/components/schemas/OfferDTO' nullable: true description: 优惠详情(如果应用了促销活动或新用户优惠) starts_at: type: string format: date-time nullable: true description: 访问等级的生效时间 purchased_at: type: string format: date-time description: 访问等级的购买时间 originally_purchased_at: type: string format: date-time description: 访问等级的最初购买时间 expires_at: type: string format: date-time nullable: true description: 访问等级的到期时间 renewal_cancelled_at: type: string format: date-time nullable: true description: 续订取消的时间 billing_issue_detected_at: type: string format: date-time nullable: true description: 检测到账单问题的时间 is_in_grace_period: type: boolean description: 访问等级是否处于宽限期 cancellation_reason: type: string nullable: true description: 取消原因 Subscription: type: object properties: store: type: string description: 购买订阅的商店 store_product_id: type: string description: 商店中的产品 ID。对于 App Store 12 个月承诺计划,ID 以 `:monthly` 结尾。 store_base_plan_id: type: string nullable: true description: 商店中的基础方案 ID store_transaction_id: type: string description: 商店中的交易 ID store_original_transaction_id: type: string description: 商店中的原始交易 ID offer: allOf: - $ref: '#/components/schemas/OfferDTO' nullable: true description: 优惠详情(如果应用了促销活动或新用户优惠) environment: type: string description: 环境(沙盒、生产) purchased_at: type: string format: date-time description: 订阅的购买时间 originally_purchased_at: type: string format: date-time description: 订阅的原始购买时间 expires_at: type: string format: date-time nullable: true description: 订阅的到期时间 renewal_cancelled_at: type: string format: date-time nullable: true description: 续订取消的时间。对于 12 个月承诺计划,订阅者取消后该字段保持为 `null`,因为每月付款仍将继续。请改用 `commitment.will_renew`。 billing_issue_detected_at: type: string format: date-time nullable: true description: 检测到账单问题的时间 is_in_grace_period: type: boolean description: 订阅是否处于宽限期 cancellation_reason: type: string nullable: true description: 取消原因 commitment: allOf: - $ref: '#/components/schemas/SubscriptionCommitment' nullable: true description: App Store 承诺计划的 12 个月承诺详情。其他订阅不设置此字段。 SubscriptionCommitment: type: object properties: will_renew: type: boolean nullable: true description: 本承诺期结束后是否开始新的12个月承诺期。订阅者取消后为 `false`,但每月付款将持续至 `expires_at`。 billing_period_number: type: integer nullable: true description: 当前承诺期内的月付款编号,从1开始 total_billing_periods: type: integer nullable: true description: 承诺期内的月付款总次数 expires_at: type: string format: date-time nullable: true description: 承诺期的结束时间。订阅本身的 `expires_at` 为当前已付费月份的截止时间。 NonSubscription: type: object properties: purchase_id: type: string format: uuid description: 唯一购买标识符 store: type: string description: 购买所在的商店 store_product_id: type: string description: 商店中的产品 ID store_base_plan_id: type: string nullable: true description: 商店中的基础方案 ID store_transaction_id: type: string description: 商店中的交易 ID store_original_transaction_id: type: string description: 商店中的原始交易 ID purchased_at: type: string format: date-time description: 购买时间 environment: type: string description: 环境(沙盒、生产) is_refund: type: boolean description: 是否为退款 is_consumable: type: boolean description: 是否为消耗型商品 ErrorResponse: type: object properties: errors: type: array items: type: object properties: source: type: string nullable: true description: 错误来源 errors: type: array items: type: string description: 错误消息数组 error_code: type: string description: 简短错误名称 status_code: type: integer description: HTTP 状态码 required: - errors - error_code - status_code TransactionDTORequest: oneOf: - $ref: '#/components/schemas/OneTimePurchaseDTO' - $ref: '#/components/schemas/SubscriptionDTO' discriminator: propertyName: purchase_type OneTimePurchaseDTO: type: object title: One-time Purchase description: 一次性购买的交易数据 properties: purchase_type: type: string enum: - one_time_purchase description: 购买类型 store: type: string description: 发生购买的商店。常见值包括 `app_store`、`play_store`、`stripe`、`paddle` 或任意自定义商店标识符 environment: type: string enum: - Production - Sandbox default: Production description: 发生购买的环境 store_product_id: type: string description: 商店中的产品 ID store_transaction_id: type: string maxLength: 50 description: 商店中的交易 ID。最多 50 个字符。PayPal 及某些自定义商店的交易 ID 可能超过此限制——请在提交前对值进行截断或哈希处理,否则请求将失败。 store_original_transaction_id: type: string description: 商店中的原始交易 ID is_family_shared: type: boolean default: false description: 该购买是否为家庭共享 price: $ref: '#/components/schemas/PriceDTO' purchased_at: type: string format: date-time description: 购买发生的时间 variation_id: type: string nullable: true description: 用于 A/B 测试的实验变体 ID offer: $ref: '#/components/schemas/OfferDTO' nullable: true refunded_at: type: string format: date-time nullable: true description: 退款发生的时间 cancellation_reason: type: string enum: - billing_error - cancelled_by_developer - new_subscription_replace - price_increase - product_was_not_available - refund - unknown - upgraded - voluntarily_cancelled - adapty_revoked nullable: true description: 取消原因 required: - purchase_type - store - store_product_id - store_transaction_id - store_original_transaction_id - price - purchased_at SubscriptionDTO: type: object title: Subscription description: 订阅购买的交易数据 properties: purchase_type: type: string enum: - subscription description: 购买类型 store: type: string description: 发生购买的商店。常见值包括 `app_store`、`play_store`、`stripe`、`paddle` 或任意自定义商店标识符 environment: type: string enum: - Production - Sandbox default: Production description: 发生购买的环境 store_product_id: type: string description: 商店中的产品 ID store_transaction_id: type: string maxLength: 50 description: 商店中的交易 ID。最多 50 个字符。PayPal 及部分自定义商店的交易 ID 可能超出此限制——提交前请对值进行截断或哈希处理,否则请求将失败。 store_original_transaction_id: type: string description: 商店中的原始交易 ID is_family_shared: type: boolean default: false description: 该购买是否为家庭共享 price: $ref: '#/components/schemas/PriceDTO' purchased_at: type: string format: date-time description: 购买发生的时间 variation_id: type: string nullable: true description: A/B 测试的实验变体 ID offer: $ref: '#/components/schemas/OfferDTO' nullable: true refunded_at: type: string format: date-time nullable: true description: 购买退款的时间 cancellation_reason: type: string enum: - billing_error - cancelled_by_developer - new_subscription_replace - price_increase - product_was_not_available - refund - unknown - upgraded - voluntarily_cancelled - adapty_revoked nullable: true description: 取消原因 originally_purchased_at: type: string format: date-time description: 订阅最初购买的时间 expires_at: type: string format: date-time description: 订阅到期的时间 renew_status: type: boolean description: 订阅是否将自动续期 renew_status_changed_at: type: string format: date-time nullable: true description: 续期状态变更的时间 billing_issue_detected_at: type: string format: date-time nullable: true description: 检测到账单问题的时间 grace_period_expires_at: type: string format: date-time nullable: true description: 宽限期到期的时间 required: - purchase_type - store - store_product_id - store_transaction_id - store_original_transaction_id - price - purchased_at - originally_purchased_at - expires_at - renew_status PriceDTO: type: object properties: country: type: string description: ISO 3166-1 alpha-2 格式的国家代码,例如 `US` currency: type: string description: ISO 4217 格式的货币代码,例如 `USD` value: type: number format: float description: 价格值 required: - country - currency - value OfferDTO: type: object 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 description: 优惠类型 id: type: string nullable: true description: 优惠 ID required: - category - type GrantAccessRequest: type: object properties: access_level_id: type: string description: 在访问等级页面中配置的付费访问等级 ID starts_at: type: string format: date-time nullable: true description: 访问等级生效的日期时间,可以是未来的时间。默认值为 null。 expires_at: type: string format: date-time nullable: true description: 访问等级到期的日期时间,可以是过去的时间,也可以为 null(表示永久授权)。默认值为 null。 required: - access_level_id RevokeAccessRequest: type: object properties: access_level_id: type: string description: 在访问等级页面中配置的付费访问等级 ID revoke_at: type: string format: date-time nullable: true description: 指定访问等级的到期时间。若要立即撤销访问权限,请省略此字段或将其设置为 null。默认值为 null。 required: - access_level_id RefundSaverSettingsRequest: type: object properties: custom_preference: type: string enum: - grant - grant_prorated - no_preference - decline nullable: true description: | 单独为该用户设置退款偏好。该设置适用于用户在 App Store 和 Google Play 上的退款请求。Google 在退款审核时仅接受拒绝、批准或无偏好,因此当此值为 `grant_prorated` 时,Adapty 会向 Google Play 发送无偏好。 - `grant`:批准每一个退款请求 - `grant_prorated`:按用户尚未使用的购买部分批准退款 - `no_preference`:不提供任何建议 - `decline`:拒绝每一个退款请求 consent: type: boolean nullable: true description: | 记录用户是否同意共享其数据。该同意仅适用于 App Store。 - `true` 表示当您收到应用内退款请求时,您可以向 Apple 提供有关该用户的信息 example: custom_preference: grant consent: true RefundSaverSettingsResponse: type: object properties: profile_id: type: string format: uuid description: 客户用户画像 ID settings: type: object properties: consent: type: boolean description: 定义用户是否同意与 Apple 共享其数据(仅限 App Store) custom_preference: type: string enum: - grant - grant_prorated - no_preference - decline description: 退款偏好设置 description: 用户的退款保护设置 required: - profile_id - settings StripeValidationRequest: type: object properties: data: type: object properties: type: type: string enum: - stripe_receipt_validation_result description: 资源类型 attributes: type: object properties: customer_user_id: type: string description: 您的用户在您系统中的 ID stripe_token: type: string description: | 代表唯一购买行为的 Stripe 对象令牌。 可以是 Stripe 订阅令牌(sub_XXX)或支付意图令牌(pi_XXX) required: - customer_user_id - stripe_token required: - type - attributes required: - data StripeValidationResponse: type: object properties: data: type: object nullable: true description: 响应数据(验证成功时为 null) required: - data StripeErrorResponse: type: object properties: errors: type: array items: type: object properties: detail: type: string description: 有关错误的描述性信息 source: type: object properties: pointer: type: string description: 引用请求文档中导致问题的确切位置 required: - pointer status: type: string description: HTTP 状态码 required: - detail - source - status required: - errors PaddleValidationRequest: type: object properties: customer_user_id: type: string description: 您系统中的用户 ID paddle_token: type: string description: | 代表唯一购买的 Paddle 对象的令牌。 可以是交易 ID(txn_...)或订阅 ID(sub_...) required: - customer_user_id - paddle_token IntegrationIdentifiersRequest: type: object properties: adjust_device_id: type: string nullable: true description: 用户在 Adjust 集成中的网络用户 ID airbridge_device_id: type: string nullable: true description: 用户设备在 Airbridge 集成中的 ID amplitude_device_id: type: string nullable: true description: 用户设备在 Amplitude 集成中的 ID amplitude_user_id: type: string nullable: true description: 用户在 Amplitude 集成中的 ID appmetrica_device_id: type: string nullable: true description: 用户设备在 AppMetrica 集成中的 ID appmetrica_profile_id: type: string nullable: true description: 用户在 AppMetrica 集成中的 ID appsflyer_id: type: string nullable: true description: 用户在 AppsFlyer 集成中的网络用户 ID branch_id: type: string nullable: true description: 用户应用在 Branch 集成中的 Branch Key facebook_anonymous_id: type: string nullable: true description: 用户在 Facebook Ads 集成中的 ID firebase_app_instance_id: type: string nullable: true description: 用户在 Firebase 集成中的 ID mixpanel_user_id: type: string nullable: true description: 用户在 Mixpanel 集成中的 ID one_signal_player_id: type: string nullable: true description: 用户在 OneSignal 集成中的 ID(旧版标识符) one_signal_subscription_id: type: string nullable: true description: 用户在 OneSignal 集成中的 ID(推荐标识符) posthog_distinct_user_id: type: string nullable: true description: 用户在 PostHog 集成中的 ID pushwoosh_hwid: type: string nullable: true description: 用户设备在 Pushwoosh 集成中的 ID tenjin_analytics_installation_id: type: string nullable: true description: 用户设备在 Tenjin 集成中的 ID description: 至少须提供一个集成标识符 IntegrationIdentifiersResponse: type: object properties: adjust_device_id: type: string nullable: true description: 用户在 Adjust 集成中的网络用户 ID airbridge_device_id: type: string nullable: true description: 用户设备在 Airbridge 集成中的 ID amplitude_device_id: type: string nullable: true description: 用户设备在 Amplitude 集成中的 ID amplitude_user_id: type: string nullable: true description: 用户在 Amplitude 集成中的 ID appmetrica_device_id: type: string nullable: true description: 用户设备在 AppMetrica 集成中的 ID appmetrica_profile_id: type: string nullable: true description: 用户在 AppMetrica 集成中的 ID appsflyer_id: type: string nullable: true description: 用户在 AppsFlyer 集成中的网络用户 ID branch_id: type: string nullable: true description: 用户应用在 Branch 集成中的 Branch Key facebook_anonymous_id: type: string nullable: true description: 用户在 Facebook Ads 集成中的 ID firebase_app_instance_id: type: string nullable: true description: 用户在 Firebase 集成中的 ID mixpanel_user_id: type: string nullable: true description: 用户在 Mixpanel 集成中的 ID one_signal_player_id: type: string nullable: true description: 用户在 OneSignal 集成中的 ID(旧版标识符) one_signal_subscription_id: type: string nullable: true description: 用户在 OneSignal 集成中的 ID(推荐标识符) posthog_distinct_user_id: type: string nullable: true description: 用户在 PostHog 集成中的 ID pushwoosh_hwid: type: string nullable: true description: 用户设备在 Pushwoosh 集成中的 ID tenjin_analytics_installation_id: type: string nullable: true description: 用户设备在 Tenjin 集成中的 ID PaywallUpdateRequest: type: object properties: remote_configs: type: array items: type: object properties: locale: type: string description: 远程配置的语言区域(例如,"en"、"es"、"fr") data: type: string description: 包含远程配置数据的 JSON 字符串 required: - locale - data description: 要更新的 RemoteConfig 对象数组 required: - remote_configs description: 至少需要提供一个字段 PaywallResponse: type: object properties: title: type: string description: 付费墙的名称,与您在 Adapty 看板中定义的名称一致 paywall_id: type: string format: uuid description: 付费墙的唯一标识符 use_paywall_builder: type: boolean description: 该付费墙是否使用付费墙编辑工具 use_paywall_builder_legacy: type: boolean description: 该付费墙是否使用旧版付费墙编辑工具 updated_at: type: string format: date-time description: 付费墙最后更新时间戳 created_at: type: string format: date-time description: 付费墙创建时间戳 state: type: string enum: - draft - live - inactive - archived description: 付费墙的当前状态 is_deleted: type: boolean description: 付费墙是否被标记为已删除 web_purchase_url: type: string format: uri nullable: true description: 网页购买链接(如适用) products: type: array items: type: object properties: product_id: type: string format: uuid description: 产品的唯一标识符 title: type: string description: 产品的标题 product_set: type: string enum: - weekly - monthly - trimonthly - semiannual - annual - lifetime - uncategorised - nonsubscriptions - two_months - consumable description: 产品集分类 offer: type: object nullable: true properties: product_offer_id: type: string format: uuid description: 产品优惠的唯一标识符 title: type: string description: 优惠的标题 required: - product_offer_id - title required: - product_id - title - product_set - offer description: 包含产品信息的产品对象数组 remote_configs: type: array items: type: object properties: locale: type: string description: 远程配置所对应的语言区域 data: type: string description: 包含远程配置数据的 JSON 字符串 required: - locale - data description: 包含语言区域与数据的远程配置对象数组 main_screenshot: type: object nullable: true properties: image_id: type: integer description: 图片的唯一标识符 url: type: string format: uri description: 图片的 URL required: - image_id - url description: 包含 image_id 和 url 的主截图对象 required: - title - paywall_id - use_paywall_builder - use_paywall_builder_legacy - updated_at - created_at - state - is_deleted - products PaywallListResponse: type: object properties: data: type: array items: $ref: '#/components/schemas/PaywallListItem' description: 付费墙对象数组 meta: type: object properties: pagination: type: object properties: count: type: integer description: 付费墙总数 page: type: integer description: 当前页码 pages: type: integer description: 总页数 required: - count - page - pages required: - pagination required: - data - meta PaywallListItem: type: object properties: title: type: string description: 付费墙的名称,在您的 Adapty 看板中定义 paywall_id: type: string format: uuid description: 付费墙的唯一标识符 use_paywall_builder: type: boolean description: 该付费墙是否使用付费墙编辑工具 use_paywall_builder_legacy: type: boolean description: 该付费墙是否使用旧版付费墙编辑工具 updated_at: type: string format: date-time description: 付费墙最后更新的时间戳 created_at: type: string format: date-time description: 付费墙创建的时间戳 state: type: string enum: - draft - live - inactive - archived description: 付费墙的当前状态 is_deleted: type: boolean description: 付费墙是否已被标记为删除 web_purchase_url: type: string format: uri nullable: true description: 网页购买链接(如适用) products: type: array items: type: object properties: product_id: type: string format: uuid description: 产品的唯一标识符 title: type: string description: 产品的名称 product_set: type: string enum: - weekly - monthly - trimonthly - semiannual - annual - lifetime - uncategorised - nonsubscriptions - two_months - consumable description: 产品集分类 offer: type: object nullable: true properties: product_offer_id: type: string format: uuid description: 产品优惠的唯一标识符 title: type: string description: 优惠的名称 required: - product_offer_id - title required: - product_id - title - product_set - offer description: 包含付费墙产品信息的产品对象数组 required: - title - paywall_id - use_paywall_builder - use_paywall_builder_legacy - updated_at - created_at - state - is_deleted - products PaywallObject: type: object description: | 付费墙代表您应用中的一个变现屏幕。它包含有关 付费墙配置、产品和远程配置的信息。 properties: title: type: string description: 付费墙的名称,与您在 Adapty 看板中定义的名称一致 paywall_id: type: string format: uuid description: 付费墙的唯一标识符 use_paywall_builder: type: boolean description: 付费墙是否使用付费墙编辑工具 use_paywall_builder_legacy: type: boolean description: 付费墙是否使用旧版付费墙编辑工具 updated_at: type: string format: date-time description: 付费墙最后更新的时间戳 created_at: type: string format: date-time description: 付费墙创建时的时间戳 state: type: string enum: - draft - live - inactive - archived description: 付费墙的当前状态 is_deleted: type: boolean description: 付费墙是否被标记为已删除 web_purchase_url: type: string format: uri nullable: true description: 网页购买的 URL(如适用) products: type: array items: $ref: '#/components/schemas/ProductObject' description: 此付费墙中可用的产品数组 remote_configs: type: array items: $ref: '#/components/schemas/RemoteConfigObject' description: 不同语言区域的远程配置数组 main_screenshot: type: object nullable: true properties: image_id: type: integer description: 图片的唯一标识符 url: type: string format: uri description: 图片的 URL required: - image_id - url description: 包含 image_id 和 url 的主截图对象 required: - title - paywall_id - use_paywall_builder - use_paywall_builder_legacy - updated_at - created_at - state - is_deleted - products ProductObject: type: object description: | 产品代表应用中的一个可购买项目。它可以是订阅或 一次性购买产品。 properties: product_id: type: string format: uuid description: 产品的唯一标识符 title: type: string description: 产品的标题 product_set: type: string description: 产品集分类 offer: type: object nullable: true properties: product_offer_id: type: string format: uuid description: 产品优惠的唯一标识符 title: type: string description: 优惠的标题 required: - product_offer_id - title description: 产品优惠信息 required: - product_id - title - product_set - offer RemoteConfigObject: type: object description: | 远程配置包含付费墙的特定语言环境配置数据。 这使您可以为不同语言自定义付费墙的外观和行为。 properties: locale: type: string description: 远程配置的语言环境(例如:"en"、"es"、"fr") data: type: string description: 包含远程配置数据的 JSON 字符串 required: - locale - data IntegrationIdentifiersObject: type: object description: | 集成标识符包含来自各种第三方服务的用户 ID。 这些 ID 用于在不同的分析和营销平台之间同步用户数据。 properties: adjust_device_id: type: string nullable: true description: 用户在 Adjust 集成中的网络用户 ID airbridge_device_id: type: string nullable: true description: 用户设备在 Airbridge 集成中的 ID amplitude_device_id: type: string nullable: true description: 用户设备在 Amplitude 集成中的 ID amplitude_user_id: type: string nullable: true description: 用户在 Amplitude 集成中的 ID appmetrica_device_id: type: string nullable: true description: 用户设备在 AppMetrica 集成中的 ID appmetrica_profile_id: type: string nullable: true description: 用户在 AppMetrica 集成中的 ID appsflyer_id: type: string nullable: true description: 用户在 AppsFlyer 集成中的网络用户 ID branch_id: type: string nullable: true description: 用户应用在 Branch 集成中的 Branch Key facebook_anonymous_id: type: string nullable: true description: 用户在 Facebook Ads 集成中的 ID firebase_app_instance_id: type: string nullable: true description: 用户在 Firebase 集成中的 ID mixpanel_user_id: type: string nullable: true description: 用户在 Mixpanel 集成中的 ID one_signal_player_id: type: string nullable: true description: 用户在 OneSignal 集成中的 ID(旧版标识符) one_signal_subscription_id: type: string nullable: true description: 用户在 OneSignal 集成中的 ID(推荐标识符) posthog_distinct_user_id: type: string nullable: true description: 用户在 PostHog 集成中的 ID pushwoosh_hwid: type: string nullable: true description: 用户设备在 Pushwoosh 集成中的 ID tenjin_analytics_installation_id: type: string nullable: true description: 用户设备在 Tenjin 集成中的 ID RefundSaverSettingsObject: type: object description: | 退款保护设置包含用户处理退款请求的偏好设置。 这包括数据共享同意及自定义退款偏好。 properties: consent: type: boolean description: 定义用户是否同意共享其数据 custom_preference: type: string enum: - grant - grant_prorated - no_preference - decline description: 退款偏好 required: - consent - custom_preference ErrorObject: type: object description: | 错误对象表示一个 API 错误响应。它包含有关 出错原因及修复方法的信息。 properties: errors: type: array items: type: object properties: source: type: string nullable: true description: 导致错误的字段或参数 errors: type: array items: type: string description: 错误消息数组 required: - errors description: 错误详情数组 error_code: type: string description: 机器可读的错误代码 status_code: type: integer description: HTTP 状态码 required: - errors - error_code - status_code PaginationObject: type: object description: | 列表端点的分页元数据。包含有关当前页面和结果总数的信息。 properties: count: type: integer description: 项目总数 page: type: integer description: 当前页码 pages: type: integer description: 总页数 required: - count - page - pages VirtualCurrencyTransactionRequest: type: object description: 创建虚拟货币交易的请求体。 properties: items: type: array minItems: 1 maxItems: 20 description: 以原子方式应用的余额调整。每个货币代码只能出现一次。 items: $ref: '#/components/schemas/VirtualCurrencyBalanceAdjustment' metadata: type: object nullable: true additionalProperties: type: string description: | 随交易一起存储的可选键值对。最多 5 个键。每个键需匹配 `^[a-z0-9_]{1,30}$`,每个值最多 200 个字符。 operation: type: string enum: - top_up - refund - spend - spend_reversal - reward - reward_reversal - exchange - expiry - migration - adjustment description: | 交易的类型。大多数集成只需要四个值:`spend`、`spend_reversal`、`reward`、`reward_reversal`。如果省略,交易将被保存并以 `operation: null` 返回。 各值含义:`top_up` — 因购买、订阅或试用而充入的货币;`refund` — 因退款而扣回的货币;`spend` — 用于功能或内容消耗的货币;`spend_reversal` — 因操作失败(如生成失败)而退回的货币;`reward` — 奖励、赠送或客服补偿;`reward_reversal` — 被收回的奖励;`exchange` — 在一笔交易中进行的货币兑换,items 中含有符号相反的条目;`expiry` — 已过期的货币;`migration` — 从您自有系统迁移的余额;`adjustment` — 应用内经济体系之外的技术性余额修正。 feature: type: string description: | 货币被消耗或发放的用途。一个单词,可选带一个点分子类型,必须匹配 `^[a-zA-Z0-9_]{1,32}(\.[a-zA-Z0-9_]{1,32})?$`。按原样存储,区分大小写。请勿编码价格、等级、版本或实验变体。示例:`power_up.extra_life`。 customer_placement_id: type: string description: | 应用中发生该操作的页面或版位的 ID。这是您自己的 ID,而非 Adapty 版位 ID。必须匹配 `^[a-zA-Z0-9_.-]{1,128}$`。按原样存储。示例:`onboarding-step-3`。 reference_id: type: string description: | 您系统中关联对象的 ID,例如某次生成、奖励或支持工单。1–128 个字符;包含控制字符、BIDI 字符或零宽字符将被拒绝。请勿在此存储个人数据。示例:`ticket_48213`。 is_sandbox: type: boolean default: false description: 在测试时发放货币时设置为 `true`。 store: type: string description: | 该交易所关联购买的商店:`app_store`、`play_store`、`stripe`、`paddle`,或在应用中配置的自定义商店 ID。最多 30 个字符。如果该购买在商店中发生退款,通过此引用充入的货币将被扣回。请与 `store_transaction_id` 一同发送。 store_transaction_id: type: string description: | 该购买的商店交易 ID。最多 50 个字符。仅作为引用使用:Adapty 不会验证其是否存在或唯一。请与 `store` 一同发送。 required: - items VirtualCurrencyBalanceAdjustment: type: object properties: currency_code: type: string description: 要调整的虚拟货币代码。 amount: type: integer format: int32 description: | 要应用的金额。正值表示充入(授予)货币;负值表示扣除(消费)货币。不能为零。 required: - currency_code - amount VirtualCurrencyTransactionResponse: description: 已创建的交易,格式与交易历史记录中的条目相同,并附带交易后余额。 allOf: - $ref: '#/components/schemas/VirtualCurrencyTransactionsHistoryItem' - type: object properties: response_created_at: type: integer format: int64 description: 响应生成的时间,以毫秒为单位的 Unix 时间戳。 balances: type: array description: | 本次请求所影响的每种货币在交易后的余额(每个 `items` 条目对应一条记录)。如需读取用户画像的完整余额列表,请使用 `GET /api/v2/server-side-api/vc/balances/`。 items: $ref: '#/components/schemas/VirtualCurrencyBalanceSnapshot' required: - response_created_at - balances VirtualCurrencyBalanceSnapshot: type: object properties: code: type: string description: 虚拟货币代码。 name: type: string description: 虚拟货币的显示名称。 balance: type: integer format: int32 minimum: 0 description: 总余额,包含当前持有的金额。 held: type: integer format: int32 minimum: 0 description: 所有有效持有金额的总和(已预留金额)。当前始终为 0。 available: type: integer format: int32 description: 可用于消费的余额,计算方式为 `balance - held`。 required: - code - name - balance - held - available VirtualCurrencyBalanceListResponse: type: object description: 用户画像所有虚拟货币的当前余额。 properties: response_created_at: type: integer format: int64 description: 响应生成的时间,以毫秒为单位的 Unix 时间戳。 data: type: array items: $ref: '#/components/schemas/VirtualCurrencyProfileBalanceItem' required: - response_created_at - data VirtualCurrencyProfileBalanceItem: type: object properties: code: type: string description: 应用内唯一的虚拟货币代码。由 ASCII 字母、数字和下划线组成。 name: type: string description: 虚拟货币的显示名称。 balance: type: integer format: int32 minimum: 0 description: 总余额,包含当前被冻结的金额。 held: type: integer format: int32 minimum: 0 description: 所有有效冻结金额的总和(已预留金额)。当前始终为 0。 available: type: integer format: int32 description: 可用于消费的余额,计算方式为 `balance - held`。 required: - code - name - balance - held - available VirtualCurrencyTransactionsHistoryResponse: type: object description: 用户画像的虚拟货币交易记录分页列表。 properties: data: type: array items: $ref: '#/components/schemas/VirtualCurrencyTransactionsHistoryItem' pagination: $ref: '#/components/schemas/VirtualCurrencyHistoryPagination' required: - data - pagination VirtualCurrencyTransactionsHistoryItem: type: object properties: transaction_id: type: string format: uuid description: 交易的唯一 ID。 transaction_type: type: string description: | 交易来源。可选值为 `store_purchase`、`subscription_renewal`、`trial_start`、`api_transaction`、`dashboard_transaction`、`refund` 或 `expiry`。 items: type: array description: 此次交易中记录的各币种余额变动。 items: $ref: '#/components/schemas/VirtualCurrencyBalanceChange' metadata: type: object nullable: true additionalProperties: type: string description: 与交易一同存储的键值对(如有)。 operation: type: string nullable: true enum: - top_up - refund - spend - spend_reversal - reward - reward_reversal - exchange - expiry - migration - adjustment description: | 交易所代表的操作类型。Adapty 会在其自身创建的交易上自动设置该字段:`store_purchase`、`subscription_renewal` 和 `trial_start` 对应 `top_up`,`refund` 对应 `refund`,`expiry` 对应 `expiry`。对于 `dashboard_transaction`,该值为团队成员在 Adapty 看板中调整余额时所选择的操作。对于 `api_transaction`,该值为您传入的值;若未传入则为 `null`。 feature: type: string nullable: true description: 您传入的币种消费用途或发放原因。由 Adapty 创建的交易上该值为 `null`。 customer_placement_id: type: string nullable: true description: 您传入的应用内页面或版位 ID。由 Adapty 创建的交易上该值为 `null`。 reference_id: type: string nullable: true description: 您传入的系统中相关对象的 ID。由 Adapty 创建的交易上该值为 `null`。 is_sandbox: type: boolean description: | 该交易是否为测试交易。对于由 Adapty 创建的交易,该值与对应商店购买的环境保持一致。对于 `api_transaction`,该值为您传入的值,默认为 `false`。 store: type: string nullable: true description: | 相关购买所在的商店。在 Adapty 根据商店事件(购买、续订、试用、退款)创建的交易以及携带购买引用的 `api_transaction` 上会设置该字段。 store_transaction_id: type: string nullable: true description: 相关购买的商店交易 ID。与 `store` 字段在相同交易上设置。 created_at: type: string format: date-time description: 交易记录的时间。 required: - transaction_id - transaction_type - items - operation - feature - customer_placement_id - reference_id - is_sandbox - store - store_transaction_id - created_at VirtualCurrencyBalanceChange: type: object properties: currency_code: type: string description: 虚拟货币代码。 amount: type: integer format: int32 description: 应用于余额的带符号变动量。正值为充值,负值为扣除。 balance_after: type: integer format: int32 minimum: 0 description: 本次交易应用后的货币余额。 required: - currency_code - amount - balance_after VirtualCurrencyHistoryPagination: type: object properties: next_cursor: type: string nullable: true description: | 下一页的不透明游标。将其作为 `cursor` 查询参数传递以获取更多结果。当没有更多页面时为 Null。 required: - next_cursor