Complete guide to setting up Google Play Billing (Android) and Apple StoreKit (iOS) in-app purchases and subscriptions in Nativine Builder.
Monetize your mobile application with native Google Play Billing (Android) and Apple StoreKit (iOS) in-app purchases. Nativine embeds native billing SDKs to process digital goods, one-time product unlocks, and recurring subscriptions seamlessly.
Both Google Play Console and Apple App Store guidelines mandate that digital goods, digital memberships, premium feature unlocks, and subscriptions sold inside mobile apps must use native In-App Purchases rather than external credit card web forms:
Never grant premium access solely based on frontend purchase callbacks. Always send the purchaseToken to your secure backend server to verify authenticity with Google Play / Apple App Store APIs before updating your user database:
const { google } = require('googleapis');
// 1. Authenticate with Google Play Developer Service Account
const auth = new google.auth.GoogleAuth({
keyFile: './service-account.json',
scopes: ['https://www.googleapis.com/auth/androidpublisher']
});
async function verifyGooglePlayPurchase(purchaseToken, productId, isSub = false) {
const androidpublisher = google.androidpublisher({ version: 'v3', auth });
const packageName = 'com.yourcompany.yourapp';
try {
if (isSub) {
const res = await androidpublisher.purchases.subscriptions.get({
packageName,
subscriptionId: productId,
token: purchaseToken
});
// paymentState: 1 = Payment received, 2 = Free trial
return res.data.paymentState === 1 || res.data.paymentState === 2;
} else {
const res = await androidpublisher.purchases.products.get({
packageName,
productId: productId,
token: purchaseToken
});
// purchaseState: 0 = Purchased
return res.data.purchaseState === 0;
}
} catch (error) {
console.error("Receipt validation failed:", error);
return false;
}
}
Use the Nativine JS Bridge nativine.iap.getProducts(['sku_id']) function. The native shell queries Google Play / Apple App Store APIs in real time and returns localized prices and currency symbols.
Yes. Both Google Play Console (License Testing) and Apple App Store Connect (TestFlight / Sandbox Accounts) allow developers to execute test purchases using test accounts without actual credit card charges.