Using Rovenue with AI & LLMs
Machine-readable docs endpoints, copy-paste context primers, and tips for integrating Rovenue with coding assistants and AI agents.
Rovenue's documentation is structured so that LLMs and coding agents can consume it directly — no scraping required. Every page is available as raw markdown, and the whole site is indexed in a single flat file. Use these endpoints to give an AI assistant full context before asking it to write Rovenue integration code.
LLM-ready endpoints
The docs site exposes three machine-readable endpoints following the llmstxt.org convention:
| Endpoint | Contents |
|---|---|
/llms.txt | A concise index of all docs pages — titles, paths, and one-line summaries. |
/llms-full.txt | The entire documentation as a single concatenated markdown file. Paste it or fetch it for full context. |
/llms.mdx/docs/<path>/content.md | Any single page as raw markdown. Example: /llms.mdx/docs/guides/configuring/content.md. |
These endpoints can be:
- Pasted directly into ChatGPT, Claude, or any other chat interface.
- Fetched by an agent using an HTTP GET — no authentication required.
- Embedded in a RAG pipeline as a continuously up-to-date source.
For quick questions about a specific area (e.g. purchases or identity), use the per-page endpoint (/llms.mdx/docs/<path>/content.md) to keep context small. For broad integration questions, use /llms-full.txt.
Copy-paste context primer
Paste the following block into any LLM before asking it to write Rovenue integration code. It covers the complete SDK surface in a compact form and links to the full docs for detail.
# Rovenue SDK — context primer
## Package names
- React Native: @rovenue/react-native-sdk
- Swift: import Rovenue (package url: https://github.com/broverse/rovenue-ios)
- Kotlin: import dev.rovenue.sdk.Rovenue (artifact: io.rovenue:sdk:0.33.0, repository: https://maven.broverse.ai with includeGroup io.rovenue)
## Configuration
- Public API key prefix: rov_pk_live_ (Production) or rov_pk_test_ (Sandbox; debug builds only — a release build fails configure with a SandboxKeyInRelease error)
- baseUrl: OPTIONAL — defaults to the hosted endpoint https://api.rovenue.io. Only pass it when self-hosting; the host must use https:// (plain http:// is accepted only for localhost in local dev).
- Call configure() once at app start, before any other SDK call.
RN: Rovenue.configure({ apiKey: 'rov_pk_test_...' })
Swift: Rovenue.configure(apiKey: "rov_pk_test_...")
Kotlin: Rovenue.configure(apiKey = "rov_pk_test_...", appVersion = ...)
- Self-hosting override:
RN: Rovenue.configure({ apiKey: 'rov_pk_test_...', baseUrl: 'https://api.acme.com' })
Swift: Rovenue.configure(apiKey: "rov_pk_test_...", baseUrl: "https://api.acme.com")
Kotlin: Rovenue.configure(apiKey = "rov_pk_test_...", baseUrl = "https://api.acme.com", appVersion = ...)
## Core methods (TypeScript names; Swift/Kotlin mirror with idiomatic casing)
configure(config) — initialise SDK (call once)
currentUser() — returns User { rovenueId, appUserId }
identify(appUserId, identityToken) — bind your backend user id (optimistic local + background server bind);
identityToken comes from YOUR backend (POST /v1/identity-tokens with the
secret key, 15 min) — never put the secret key in the app
Web: await identify(appUserId, { identityToken }) — a server call
logOut() — mint fresh rovenueId, clear appUserId and caches
entitlement(id) — Entitlement | null for a given entitlement id
entitlementsAll() — Entitlement[] all active entitlements
refreshEntitlements() — force network refresh of entitlements
virtualCurrencies() — Record<string,number> — all virtual-currency balances (cache read)
virtualCurrency(code) — number — balance for a single currency code (0 if absent)
refreshVirtualCurrencies() — force network refresh of virtual-currency balances
getOfferings() — Offerings { current, all } — fetch products from dashboard
purchase(pkg) — Promise<PurchaseResult> — native store sheet + server validation
restorePurchases() — re-validate all prior transactions (e.g. after reinstall)
getAppAccountToken() — Apple appAccountToken derived from rovenueId
setForeground(bool) — manual override only; the SDK observes the app lifecycle itself
shutdown() — stop all background work (call only at full app teardown)
setLogHandler(fn) — receive structured SDK log entries
addChangeListener(cb) — subscribe to ChangeEvent; returns unsubscribe fn (RN/TS)
Swift: Rovenue.shared.changes AsyncStream<ChangeEvent>
Kotlin: Rovenue.shared.changes SharedFlow<ChangeEvent>
## Virtual currency writes (SERVER-SIDE ONLY)
Granting, spending and reversing are server-side operations — there is NO client-side spend method. All take Authorization: Bearer <rov_sk_live_...>.
Spend: POST /v1/virtual-currencies/:appUserId/:code/transactions Body: { "amount": 5, "referenceId": "...", "referenceType": "ai_generation", "description": "AI generation" }
Grant: POST /v1/virtual-currencies/:appUserId/:code/grants Body: { "amount": 50, "referenceId": "...", "referenceType": "support", "description": "..." } — recorded as BONUS
Reverse: POST /v1/virtual-currencies/:appUserId/:code/transactions/:referenceId/reverse (no body; URL-encode referenceId) — gives one spend back in full as REFUND; idempotent; 404 if no spend has that referenceId
List: GET /v1/virtual-currencies/:appUserId/transactions?code=&limit=&cursor= — newest first; { transactions, nextCursor }
amount is a POSITIVE integer. referenceId is REQUIRED on spend and grant and is the idempotency key: same referenceId + amount + referenceType writes once; a different amount or referenceType under the same referenceId is 409 REFERENCE_CONFLICT. A spend above the balance is 409 INSUFFICIENT_CREDITS. Branch on error.code.
## React Native hooks
useCurrentUser() — User | null
useEntitlement(id) — Entitlement | null
useEntitlements() — Entitlement[]
useVirtualCurrencies() — Record<string, number>
useVirtualCurrency(code) — number (0 if absent)
## Key types
type RovenueConfig = { apiKey: string; baseUrl?: string; debug?: boolean; appVersion?: string }
type User = { rovenueId: string; appUserId: string | null }
type Entitlement = { id: string; isActive: boolean; productIdentifier: string; store: string; expiresIso?: string }
type Offerings = { current: Offering | null; all: Record<string, Offering> }
type Offering = { identifier: string; isDefault: boolean; packages: Package[] }
type Package = { identifier: string; product: StoreProduct }
type StoreProduct = { id: string; type: ProductType; displayName: string; priceString: string | null; price: number | null; currencyCode: string | null }
type PurchaseResult = { entitlements: Entitlement[]; virtualCurrencies: Record<string,number>; productId: string; storeTransactionId: string }
type ChangeEvent = 'EntitlementsChanged' | 'IdentityChanged' | 'VirtualCurrenciesChanged'
type ProductType = 'subscription' | 'consumable' | 'non_consumable' | 'non_renewing_subscription'
## Identity model
- rovenueId: permanent per-install id (prefix rov_); always present, never changes.
- appUserId: your backend user id; null until identify() is called.
- identify(appUserId, identityToken) binds the anonymous rovenueId to your user and transfers any entitlements.
- The identityToken is minted by your backend for the signed-in user only; a refused token throws IdentityTokenInvalid (identify again with a fresh token).
- logOut() mints a fresh anonymous rovenueId and clears all caches.
## Platform integrations
- iOS: SDK drives StoreKit 2; receipt chain-validated against Apple Root CA G3.
- Android: SDK drives Play Billing 6; receipt validated against Google Play Developer API.
- Server-side: all receipts validated by Rovenue backend — never trust the client.
## Full docs
https://docs.rovenue.io/llms-full.txt — complete documentation as a single markdown file.Tips for AI-assisted integration
Keep these facts in mind when prompting an LLM to write Rovenue code:
- Use an opaque
appUserId. Pass your backend's internal user ID — not an email address or any PII. TheappUserIdis sent to the Rovenue server and stored as-is. - Call
configureexactly once. Place it inApp.tsx(React Native),AppDelegate(Swift), orApplication.onCreate(Kotlin). It must run before any hook or SDK method. - Call
identifyafter login, with a token from your backend. Once your auth flow resolves with a user ID, fetch an identity token from your backend (which mints it withPOST /v1/identity-tokensand the secret key) and callidentify(userId, identityToken). This binds the current anonymous subscriber to your user and transfers their entitlements. Never embed the secret key in the app. See Identity verification. - Call
logOuton sign-out. This mints a fresh anonymousrovenueIdso the next user who logs in starts with a clean slate. - Handle
PurchaseCancelledandPurchasePendinggracefully. These are not errors — they are normal user flows. Do not show an error dialog for either.
See Identifying Users for the full identity model, including the server-side transfer flow. See Processing Purchases for the complete error type reference.