rc-cancellations-pauses-winback
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCancellations, Pauses, and Winback
订阅取消、暂停与赢回
Detect cancellation, pause, and winback states on Android by reading . Most of these events are passive: your app observes them rather than initiates them. Open Google Play's manage screen with . Look up the pause resume date from the REST API.
CustomerInfomanagementURL通过读取在Android平台检测订阅的取消、暂停及赢回状态。这些事件大多是被动的:你的应用只需监听而非主动触发。使用打开Google Play的订阅管理界面,通过REST API查询暂停恢复日期。
CustomerInfomanagementURLPhase 1: Scope
阶段1:确定范围
Decide what state you need to surface to the user.
| State | Signal in CustomerInfo | Notes |
|---|---|---|
| Canceled, still has access | | Show "ends on [expirationDate]" |
| Billing issue (grace or hold) | | Payment failed, recovery in progress |
| Paused | | Resume date requires REST API |
| Active and renewing | | Normal state |
Backend win back campaign segmentation uses the webhook field (, , , ).
CANCELLATIONcancel_reasonUNSUBSCRIBEBILLING_ERRORDEVELOPER_INITIATEDPRICE_INCREASE决定需要向用户展示哪些状态。
| 状态 | CustomerInfo中的信号 | 说明 |
|---|---|---|
| 已取消但仍有访问权限 | | 显示“将于[expirationDate]到期” |
| 账单问题(宽限期或保留期) | | 支付失败,正在恢复中 |
| 已暂停 | | 恢复日期需通过REST API获取 |
| 活跃且自动续订 | | 正常状态 |
后端赢回活动的细分需使用 webhook的字段(可选值:、、、)。
CANCELLATIONcancel_reasonUNSUBSCRIBEBILLING_ERRORDEVELOPER_INITIATEDPRICE_INCREASEPhase 2: Prepare
阶段2:准备工作
Confirm you already have a fetched from or a listener. You do not need to call with . RevenueCat resolves pause state from the server side subscription state.
CustomerInfoPurchases.sharedInstance.getCustomerInfo(...)BillingClient.queryPurchasesAsyncsetIncludeSuspendedSubscriptions(true)Rules:
- is already
managementURL. Pass it straight to the Intent. Do not callUri?.Uri.parse(url.toString()) - Do not compute access manually from . Read
expirationDateandisActive.willRenew - Pause resume date is not in the SDK. Fetch it from in your backend.
/v1/subscribers/{app_user_id}
确认你已通过或监听器获取了。无需调用并设置。RevenueCat会从服务器端的订阅状态解析暂停状态。
Purchases.sharedInstance.getCustomerInfo(...)CustomerInfoBillingClient.queryPurchasesAsyncsetIncludeSuspendedSubscriptions(true)规则:
- 的类型已为
managementURL,可直接传递给Intent,无需调用Uri?。Uri.parse(url.toString()) - 不要通过手动计算访问权限,直接读取
expirationDate和isActive字段。willRenew - 暂停恢复日期不在SDK中,需从后端调用接口获取。
/v1/subscribers/{app_user_id}
Phase 3: Execute
阶段3:执行步骤
Detect cancellation with remaining access
检测已取消但仍有访问权限的状态
kotlin
val entitlement = customerInfo.entitlements["pro_access"]
if (entitlement?.unsubscribeDetectedAt != null && entitlement.isActive) {
entitlement.expirationDate?.let { expiry ->
showCancellationBanner(expiry)
}
}unsubscribeDetectedAtSUBSCRIPTION_CANCELEDisActivetruekotlin
val entitlement = customerInfo.entitlements["pro_access"]
if (entitlement?.unsubscribeDetectedAt != null && entitlement.isActive) {
entitlement.expirationDate?.let { expiry ->
showCancellationBanner(expiry)
}
}当RevenueCat收到 RTDN时,会设置字段。会保持直到计费周期结束。
SUBSCRIPTION_CANCELEDunsubscribeDetectedAtisActivetrueDetect pause
检测暂停状态
kotlin
val entitlement = customerInfo.entitlements["pro_access"]
val hasAccess = entitlement?.isActive == true
// When paused, isActive == false. Pause resume date is not in the SDK.kotlin
val entitlement = customerInfo.entitlements["pro_access"]
val hasAccess = entitlement?.isActive == true
// 暂停时,isActive == false。暂停恢复日期不在SDK中。Open the subscription management screen
打开订阅管理界面
kotlin
customerInfo.managementURL?.let { url ->
startActivity(Intent(Intent.ACTION_VIEW, url))
}managementURLUri?Uri.parse(url.toString())kotlin
customerInfo.managementURL?.let { url ->
startActivity(Intent(Intent.ACTION_VIEW, url))
}managementURLUri?Uri.parse(url.toString())Look up pause resume date via REST
通过REST API查询暂停恢复日期
From your backend, call the subscribers endpoint and read on the subscription:
paused_expiration_time_msbash
curl -H "Authorization: Bearer $RC_SECRET_API_KEY" \
https://api.revenuecat.com/v1/subscribers/$APP_USER_IDThe subscription object contains when paused. Expose this to your client through your own endpoint.
paused_expiration_time_ms在后端调用订阅者接口,读取订阅对象中的字段:
paused_expiration_time_msbash
curl -H "Authorization: Bearer $RC_SECRET_API_KEY" \
https://api.revenuecat.com/v1/subscribers/$APP_USER_ID当订阅处于暂停状态时,订阅对象会包含字段。可通过你自己的后端接口将该值暴露给客户端。
paused_expiration_time_msResubscribe before expiry
到期前重新订阅
Google's resubscribe before expiry flow fires . RevenueCat clears and sets . No extra code required, just re-read .
SUBSCRIPTION_RESTARTEDunsubscribeDetectedAtwillRenew = truecustomerInfoGoogle的到期前重新订阅流程会触发事件。RevenueCat会清除并设置。无需额外代码,只需重新读取即可。
SUBSCRIPTION_RESTARTEDunsubscribeDetectedAtwillRenew = truecustomerInfoResubscribe after expiry
到期后重新订阅
A resubscribe after expiry fires a webhook, not . Grant entitlement access on both events in your backend handler.
RENEWALINITIAL_PURCHASE到期后重新订阅会触发 webhook,而非。在后端处理程序中,需为这两个事件都授予权益访问权限。
RENEWALINITIAL_PURCHASEPhase 4: Verify
阶段4:验证
| Check | How |
|---|---|
| Cancellation banner shows | Cancel in Play Store, pull fresh |
| Management deep link opens | Tap the link, verify Play subscriptions screen opens for the correct product |
| Pause is reflected | Pause in Play Store sandbox, confirm |
| Pause resume date | Call |
| Win back accepted | Accept a Play configured win back offer, confirm the purchase surfaces as a normal subscription in |
| 检查项 | 验证方式 |
|---|---|
| 取消提示横幅显示 | 在Play Store中取消订阅,拉取最新的 |
| 管理深度链接打开 | 点击链接,验证Play订阅界面是否打开并显示正确的产品 |
| 暂停状态已同步 | 在Play Store沙盒环境中暂停订阅,确认 |
| 暂停恢复日期 | 调用 |
| 赢回优惠已接受 | 接受Play配置的赢回优惠,确认该购买在 |
Notes
注意事项
- Deferral and revocation are done through the Google Play Developer API (,
purchases.subscriptionsv2.defer) from your backend. RevenueCat processes the resulting RTDN and updatespurchases.subscriptionsv2.revokeautomatically.CustomerInfo - Win back campaigns need no SDK code. They are configured in Play Console or the RevenueCat dashboard.
- RevenueCat does not currently emit a dedicated pause webhook. Pause state appears in once the Google Play RTDN is processed.
CustomerInfo
- 延期和撤销操作需通过后端调用Google Play Developer API(、
purchases.subscriptionsv2.defer)完成。RevenueCat会处理生成的RTDN并自动更新purchases.subscriptionsv2.revoke。CustomerInfo - 赢回活动无需SDK代码,可在Play Console或RevenueCat控制台中配置。
- RevenueCat目前不会发送专门的暂停webhook。处理完Google Play的RTDN后,暂停状态会显示在中。
CustomerInfo