Back to Docs

Troubleshooting

Common setup issues and how to fix them. The b4xlib logs detailed validation info with a 🛡 prefix — check your B4X logs and your Analytics page for specifics.

Before you start

Most issues come from missing a setup step. Double-check these:

✓ App registered in the dashboard with the correct package name

✓ API key created and copied into your Initialize call

✓ At least one product or subscription added via AddProduct / AddSubscription

✓ For iOS: Apple Shared Secret uploaded (check for the green Status: Uploaded badge)

✓ For Android: Google Play service account connected (check for the green Status: Connected badge)

Google Play

Purchases work on device but validation fails

Go to your app's detail page and check the Google Play Setup card. If it shows Status: Not Connected, the service account hasn't been invited yet — start from Step 1 of the guide. If it shows Status: Pending, the service account is invited but this specific app hasn't been added under App permissions. See the Google Play Setup Guide.

Just set up permissions but still failing

Google Play permission changes can take up to 24 hours to propagate, though it's usually much faster. Click Recheck on the Google Play Setup card to test. If it shows Pending, the account-level invite worked but you still need to add this app under App permissions. If it still shows Not Connected after 24 hours, verify the service account email is correct and the View financial data permission is granted.

Package name mismatch

The Android package name in your app settings must exactly match your B4A project's package name and your Google Play listing. Check all three match.

No app listing in Google Play yet

You need at least an Internal Testing track with a build uploaded before Google Play will recognize your app for purchase validation. See the Android App Setup Guide.

App Store

B4i project won't compile after adding b4xlib

The b4xlib references the iStore library, which requires a provisioning profile based on an explicit (non-wildcard) App ID. Set up your provisioning profile before adding the b4xlib to your project. Wildcard profiles like com.yourcompany.* won't work. See the iOS App Setup Guide.

Apple Shared Secret not working

If the badge shows Status: Uploaded but validation still fails, the secret may not match. Delete it from your app's detail page and re-upload from App Store Connect → your app → General → App Information → App-Specific Shared Secret. See the Apple Shared Secret Setup Guide.

Sandbox purchases not validating

Make sure you're signed into a sandbox account on your test device (Settings → App Store → Sandbox Account). If testing via TestFlight, it automatically routes to the sandbox environment.

API key & authentication

Invalid or missing API key

The API key in your Initialize call must match an active key from your app's detail page. If you recently regenerated a key, update your app code with the new one.

Rate limit errors

Each plan has a per-minute validation limit. The library handles caching to minimize requests, but if you're hitting limits during testing, wait a moment or upgrade your plan.

Credit limit reached (free plan)

Free plans have a monthly validation limit. When reached, the library preserves the user's last known purchase status so they won't be locked out, but new validations won't go through until credits reset next month or you upgrade.

Consumables

UseConsumables returns False unexpectedly

UseConsumables returns False when the user doesn't have enough consumables to cover the requested count. Check GetConsumableCount before calling it, or use the False result to prompt the user to buy more.

Consumable count resets to zero

Consumable counts are stored locally on-device. If the user reinstalls the app or clears app data, the count resets. If you track consumables on your own server, call SetConsumableCount on app launch to sync the local count with your server's authoritative value.

Forgot to call AddConsumables after purchase

The library doesn't automatically credit consumables after a purchase — you need to call AddConsumables(count) yourself after ShowInAppPurchase returns True. Use AddConsumableProduct (not AddProduct) when registering the product.

General

No activity in the dashboard

If test purchases aren't showing in Analytics, verify your App ID and API key are correct in your Initialize call. Also check the app isn't deactivated.

Still stuck?

Check your B4X logs for lines starting with 🛡 — they show the exact error code and message from the server. You can also check the Analytics page for server-side request logs with platform, status, and timestamps.