Loading...
Loading...
Compare original and translation side by side
purchases.subscriptionsv2.getpurchases.products.getCustomerInfoapp_user_idCustomerInfoEntitlementVerificationMode.INFORMATIONAL.ENFORCEDpurchases.subscriptionsv2.getpurchases.products.getCustomerInfoapp_user_idCustomerInfoEntitlementVerificationMode.INFORMATIONAL.ENFORCED| Use case | Mechanism | Notes |
|---|---|---|
| React to purchase, renewal, cancellation | Webhook receiver | RevenueCat posts normalized events; your server updates its own DB. |
| Check current entitlement for a user | | Secret API key in |
| Grant promotional access (support, refunds, comps) | | Server side only. |
| Revoke promotional access | | Server side only. |
| Set subscriber attributes from server side data | | Useful for CRM fields the SDK does not know. |
| Bulk data export | RevenueCat data export | Scheduled exports to your warehouse. |
linkedPurchaseToken| 使用场景 | 机制 | 说明 |
|---|---|---|
| 响应购买、续订、取消操作 | Webhook接收器 | RevenueCat会提交标准化事件;你的服务器更新自身数据库。 |
| 检查用户当前的权益 | | 在 |
| 授予推广访问权限(支持、退款、赠送) | | 仅支持服务器端调用。 |
| 撤销推广访问权限 | | 仅支持服务器端调用。 |
| 从服务器端数据设置订阅者属性 | | 适用于SDK无法获取的CRM字段。 |
| 批量数据导出 | RevenueCat数据导出 | 定期导出数据到你的数据仓库。 |
linkedPurchaseTokenGET https://api.revenuecat.com/v1/subscribers/{app_user_id}
Authorization: Bearer sk_...
X-Platform: androidCustomerInfoGET https://api.revenuecat.com/v1/subscribers/{app_user_id}
Authorization: Bearer sk_...
X-Platform: androidCustomerInfoPOST https://api.revenuecat.com/v1/subscribers/{app_user_id}/entitlements/{entitlement_id}/promotional
Authorization: Bearer sk_...
Content-Type: application/json
{"duration": "monthly"}durationdailythree_dayweeklymonthlytwo_monththree_monthsix_monthyearlylifetimePOST https://api.revenuecat.com/v1/subscribers/{app_user_id}/entitlements/{entitlement_id}/promotional
Authorization: Bearer sk_...
Content-Type: application/json
{"duration": "monthly"}durationdailythree_dayweeklymonthlytwo_monththree_monthsix_monthyearlylifetimeval response = client.get("https://api.revenuecat.com/v1/subscribers/$appUserId") {
header("Authorization", "Bearer ${System.getenv("RC_SECRET_KEY")}")
header("X-Platform", "android")
}val response = client.get("https://api.revenuecat.com/v1/subscribers/$appUserId") {
header("Authorization", "Bearer ${System.getenv("RC_SECRET_KEY")}")
header("X-Platform", "android")
}| Key | Where it lives | What it can do |
|---|---|---|
| Android public SDK key | Embedded in the Android app | Post purchases, fetch |
| Secret API key | Server environment variable only | Read any subscriber, grant or revoke promotionals, set attributes, bulk operations. |
| 密钥类型 | 存储位置 | 权限 |
|---|---|---|
| Android公开SDK密钥 | 嵌入在Android应用中 | 提交购买请求、获取当前用户的 |
| 密钥API密钥 | 仅存储在服务器环境变量中 | 读取任意订阅者信息、授予或撤销推广权限、设置属性、批量操作。 |
post("/revenuecat/webhook") {
val auth = call.request.header("Authorization")
require(auth == "Bearer ${System.getenv("RC_WEBHOOK_SECRET")}")
val event = call.receive<RevenueCatEvent>()
when (event.type) {
"INITIAL_PURCHASE", "RENEWAL" -> grantAccess(event.appUserId, event.entitlements)
"CANCELLATION", "EXPIRATION" -> scheduleRevocation(event.appUserId)
}
call.respond(HttpStatusCode.OK)
}post("/revenuecat/webhook") {
val auth = call.request.header("Authorization")
require(auth == "Bearer ${System.getenv("RC_WEBHOOK_SECRET")}")
val event = call.receive<RevenueCatEvent>()
when (event.type) {
"INITIAL_PURCHASE", "RENEWAL" -> grantAccess(event.appUserId, event.entitlements)
"CANCELLATION", "EXPIRATION" -> scheduleRevocation(event.appUserId)
}
call.respond(HttpStatusCode.OK)
}CustomerInfo.entitlements.activeCustomerInfo.entitlements.active