Move from raw StoreKit or Play Billing to BillDog
To move an app from raw StoreKit 2 or Google Play Billing to BillDog, verify your store credentials under Project Settings → Settings → Store Setup, create products with the same store product IDs, and import existing subscribers from your server with POST /v1/import-store-subscribers. Then point App Store Server Notifications and Play RTDN at the URLs the dashboard shows, and either replace your purchase code with BillDog.shared.purchase(package:) or keep it and call recordPurchase with finishTransactions: false.
Steps last checked against the SDK source on 16 Nov 2026.
What you'll build
- Existing App Store and Google Play subscribers recorded in BillDog and verified with the stores
- Store notifications reaching BillDog, so renewals, refunds and expiries stay current
- Purchases made by the BillDog SDK, or by your own code in observer mode
What you'll need
- A BillDog project (sign up) and an app that sells through StoreKit 2 or Play Billing today, without RevenueCat (moving from RevenueCat? Use Move from RevenueCat)
- Admin access to App Store Connect and Google Play Console
- If you have your own backend: the stored
originalTransactionId(App Store) andpurchaseToken(Play) for each subscriber
1. Choose a full move or observer mode
3 minSubscriptions belong to Apple and Google, so nobody buys again. What changes is who makes the purchase call, who finishes the transaction, and who keeps the record of access. There are two ways to run BillDog:
- Full move: the BillDog SDK makes purchases, records them on the server and then finishes (iOS) or acknowledges (Android) each one. You delete your own purchase, finish and acknowledge code.
- Observer mode: your StoreKit or Play Billing code keeps making purchases and finishing them. BillDog records each one and decides access. Set
finishTransactionstofalseand callrecordPurchaseafter each purchase. This is available in the native iOS and Android SDKs.
Never let two pieces of code finish the same transactions. With the default finishTransactions: true, BillDog finishes StoreKit transactions and acknowledges Play purchases itself. In Flutter and React Native, finishTransactions isn't exposed in 1.1.1-beta.5, so remove plugins such as in_app_purchase or react-native-iap from the purchase path and do the full move.
2. Connect the stores and recreate the catalog
10 minBillDog verifies every purchase with Apple or Google, so it needs your store credentials before anything else.
- Open Project Settings → Settings and choose the Store Setup tab. Fill in the Apple App Store card, including the In-App Purchase key, and the Google Play card with your Service Account JSON. The App Store setup and Google Play setup codelabs walk through each key.
- Open Monetization → Products and add each product with the App Store Product ID and Play Store Product ID you sell today. These are Apple's and Google's IDs, so they don't change.
- Open Monetization → Entitlements, create
premium(or whatever your app checks) and tick the products that unlock it under Product Mapping. A recorded purchase grants only the entitlements its product is mapped to. - Open Monetization → Offerings and Monetization → Placements if you'll show BillDog paywalls. The first paywall codelab covers both.
A purchase recorded before the store credentials are verified isn't lost. The SDK reports it as parked (STORE_CREDENTIALS_MISSING or STORE_UNPROVEN) and the server applies it once the credentials verify, but it grants no entitlement until then. Verify the credentials before you ship.
3. Bring existing subscribers across
8 minBillDog learns about existing subscribers in two ways. Use both.
- From the device: when
configureruns, the iOS and Android SDKs send BillDog every purchase StoreKit or Play holds on the device, without a prompt. They repeat this on foreground at most every five minutes and afterlogInorlogOut. A subscriber is picked up the first time they open the new version. - From your server: subscribers who don't update the app are only known to your backend. Import them with your secret key.
Post up to 500 subscribers per request to import-store-subscribers. App Store subscribers need an original_transaction_id (or transaction_id). Play subscribers need a purchase_token (or an order_id in the GPA. format). app_user_id is the ID you'll pass to logIn in the app. A sandbox secret key imports into sandbox, a production key into production. Public keys are refused with 403.
curl -X POST https://api.billdog.io/v1/import-store-subscribers \
-H "X-BillDog-API-Key: bd_secret_test_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"subscribers": [
{ "app_user_id": "user-123", "store": "app_store", "original_transaction_id": "2000000123456789" },
{ "app_user_id": "user-456", "store": "play_store", "purchase_token": "PLAY_PURCHASE_TOKEN", "product_id": "premium_monthly" }
]
}'- Each subscriber is looked up with the App Store Server API or the Play Developer API, so the expiry and renewal state come from the store.
- Each result is
imported,already_imported,pending(verification continues in the background) orskippedwith a reason. Posting the same subscriber again is safe. - Historic purchases fire no webhooks, journeys or virtual currency grants. A purchase that already has an owner in BillDog is never moved.
The Subscribers (CSV / JSON) card under Integration & Data → Import imports a contact list (profiles and channel preferences), not purchases. Use the endpoint above for subscriptions.
4. Point store notifications at BillDog
6 minOnce both store cards verify, each shows your project's own notification URL: App Store Server Notifications URL (Version 2) on the Apple card and RTDN push endpoint and audience on the Google Play card. Each project has its own URL.
- App Store: in App Store Connect, open your app, then General → App Information → App Store Server Notifications. Paste the BillDog URL into both the Production Server URL and the Sandbox Server URL, and choose Version 2 for each.
- Google Play: in Google Cloud, open the Pub/Sub topic your app uses for Real-time developer notifications and add a push subscription with the BillDog URL as the endpoint, authentication turned on, and Audience left blank (or set to the same URL).
App Store Connect sends to one production URL and one sandbox URL. If your own server receives App Store notifications today, it stops when you switch, and BillDog doesn't forward them. Move that server logic to BillDog webhooks first. On Google Play, every subscription on a topic gets every message, so your existing push subscription keeps working alongside BillDog's.
5. Switch the purchase code
12 minFull move. Install the SDK as in the iOS, Android, Flutter or React Native codelab. Then replace your purchase flow with a placement (register) or a direct call: BillDog.shared.purchase(package:) on iOS, BillDog.purchase(activity, pkg) on Android. Delete these from your own code, because the SDK now does them:
- iOS: your
Transaction.updatesloop and everytransaction.finish()call, plus any receipt checks your server did. - Android: your
BillingClientpurchase flow,acknowledgePurchaseandconsumeAsynccalls. - Access checks: replace them with
getCustomerInfoand the customer info stream. See Keep your app's purchase state current.
Call logIn with the same user IDs you used in the import, straight after configure, and keep a Restore Purchases button wired to restorePurchases().
Observer mode (iOS). Keep your StoreKit 2 code. Configure with finishTransactions: false and declare StoreKit 2, then pass each purchase result to recordPurchase before you finish the transaction yourself.
import StoreKit
import BillDogFull
enum Store {
// At launch
static func start() {
BillDog.shared.configure(config: BillDogConfig(
apiKey: "bd_public_test_YOUR_KEY",
finishTransactions: false,
hostStoreKitVersion: .storeKit2
))
}
// Your existing purchase call, with one line added
static func buy(_ product: StoreKit.Product) async throws {
let result = try await product.purchase()
// Nil for .pending and .userCancelled; throws for an unverified transaction
if let recording = try await BillDog.shared.recordPurchase(result) {
print("BillDog recording: \(recording.status)")
}
if case .success(.verified(let transaction)) = result {
await transaction.finish() // still your job in observer mode
}
}
}BillDog also listens to Transaction.updates in observer mode, so renewals and purchases from other devices are recorded without extra code. If you don't already set an appAccountToken, you can pass BillDog.shared.storeAccountToken (nil until fetched) as .appAccountToken(_:) to tie purchases to the BillDog customer.
Observer mode (Android). Configure with finishTransactions = false, then record each purchase from your PurchasesUpdatedListener before you acknowledge it yourself.
import android.app.Application
import android.util.Log
import com.android.billingclient.api.Purchase
import io.billdog.core.BillDog
import io.billdog.core.BillDogConfig
import io.billdog.core.evidence.StoreEvidence
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
val key = "bd_public_test_YOUR_KEY"
BillDog.configure(this, key, BillDogConfig(apiKey = key, finishTransactions = false))
}
}
// Call for each PURCHASED Purchase in your PurchasesUpdatedListener,
// then acknowledge it yourself as you do today.
fun recordWithBillDog(scope: CoroutineScope, purchase: Purchase, packageName: String) {
scope.launch {
val recording = BillDog.recordPurchase(
StoreEvidence.play(
purchaseToken = purchase.purchaseToken,
orderId = purchase.orderId,
productIds = purchase.products,
originalJson = purchase.originalJson,
signature = purchase.signature,
packageName = packageName,
)
)
Log.d("BillDog", "recorded=${recording.isKeptByServer} status=${recording.status}")
}
}In observer mode BillDog never finishes or acknowledges a purchase. Google refunds Play purchases that aren't acknowledged within three days, so keep your acknowledge call.
6. Verify before you ship
6 min- Switch the dashboard header to Sandbox. Buy with a sandbox tester (iOS, Android) and check that Audience → Customers shows the user with an active
premiumentitlement. - Under each store card in Store Setup, the notification URL should now read Last notification with a time, not No notification received yet. A sandbox purchase or renewal sends one.
- Install the old App Store or Play build, buy, then update to the new build and open it. The purchase should appear on that customer without any restore.
- Run the import with a production secret key close to release, and spot-check a few known subscribers by user ID in Audience → Customers.
- Ship with the live key (
bd_public_live_). Keep any server logic that still reads Play notifications running until most users are on the new version.