移动开发

rc-purchase-flow

revenuecat/ai-toolkit

Use this skill when implementing a RevenueCat purchase on Android. Covers awaitPurchase, PurchasesTransactionException, reading CustomerInfo entitlements to grant access, restoring purchases, and the six SDK managed steps that happen inside a single call.

  • 653 次安装
  • 76 星标
  • 收录于

安装命令

npx skills add https://github.com/revenuecat/ai-toolkit --skill rc-purchase-flow

SKILL.md

Purchase Flow

A RevenueCat purchase on Android is two lines of code. The SDK handles the billing params, the Play sheet, the purchase token round trip, server side verification, and acknowledgment. You decide which package to pass in and what to do with the returned entitlements.

Phase 1: Understand what awaitPurchase() does

One call to Purchases.sharedInstance.awaitPurchase(params) runs six steps under the hood. You do not write any of this.

Step What happens
1 Builds BillingFlowParams with the correct ProductDetailsParams from your Package
2 Calls BillingClient.launchBillingFlow() against the activity you passed
3 Suspends until the PurchasesUpdatedListener result arrives
4 If OK, posts the Play purchase token to the RevenueCat backend
5 Backend verifies via purchases.subscriptionsv2.get or purchases.products.get
6 SDK acknowledges (subs or non-consumables) or consumes (consumables) within the 3 day Google window

The call returns PurchaseResult(storeTransaction, customerInfo). Retriable failures are retried automatically.