Quickstart

Install an SDK, model a product, and validate your first purchase.

This guide takes you from zero to a validated purchase. It should take about 15 minutes.

1. Get your API keys#

Every workspace has two kinds of keys:

KeyPrefixUsed by
Publishablepk_live_… / pk_test_…Client SDKs (safe to ship)
Secretcsk_sk_…Your backend, the CLI, and the MCP server

Find them under Settings → API keys in the dashboard, or read more in Authentication.

2. Install the SDK#

swift
// In Xcode: File → Add Packages…
// https://github.com/cashsdk/cashsdk-ios
import CashSDK
kotlin
// build.gradle.kts
dependencies {
  implementation("com.cashsdk:cashsdk-android:1.0.0")
}
bash
npm install @cashsdk/react-native
bash
flutter pub add cashsdk
bash
npm install @cashsdk/web

3. Configure on launch#

Initialize CashSDK once, as early as possible, with your publishable key.

swift
import CashSDK

CashSDK.configure(apiKey: "pk_live_...")
kotlin
import com.cashsdk.CashSDK

CashSDK.configure(apiKey = "pk_live_...")
ts
import { CashSDK } from "@cashsdk/react-native";

CashSDK.configure({ apiKey: "pk_live_..." });

4. Create a product#

Model a subscription in the dashboard, or create one from the terminal with the CLI:

bash
cashsdk catalog add \
  --product pro_monthly \
  --entitlement pro \
  --type subscription

5. Show a paywall and purchase#

Fetch offerings, present your paywall, and complete a purchase. CashSDK handles the native store interaction and validates the receipt server-side.

swift
let offering = try await CashSDK.offerings()
let result = try await CashSDK.purchase(offering.monthly)

if result.entitlements["pro"]?.isActive == true {
  unlockPro()
}
kotlin
val offering = CashSDK.offerings()
val result = CashSDK.purchase(offering.monthly)

if (result.entitlements["pro"]?.isActive == true) {
  unlockPro()
}

6. Verify server-side (optional)#

Your backend can check entitlements or validate a receipt directly:

bash
curl https://api.cashsdk.com/v1/receipts/validate \
  -H "Authorization: Bearer csk_sk_..." \
  -H "Content-Type: application/json" \
  -d '{ "platform": "apple", "receipt": "MII...", "app_user_id": "u_812" }'

Next steps#