Guide
Google Play Billing vs Stripe in TWAs: Rules and Setup
August 21, 2026 · 7 min read
The Intersection of Web Payments and Google Play Policies
When converting a Progressive Web App (PWA) into an Android app using a Trusted Web Activity (TWA), one of the most critical decisions revolves around monetisation. Unlike standard websites, apps distributed through the Google Play Store must comply with strict developer policies regarding in-app purchases and payments. Failing to understand these rules before publishing your converted PWA can lead to immediate app rejection or removal from the store.
For web developers, the natural inclination is to use standard web payment gateways such as Stripe, PayPal, or Adyen. These platforms are simple to integrate, feature lower transaction fees, and allow you to keep 100% control of your customer data. However, once your web app is wrapped inside a TWA and distributed via Google Play, you enter Google's ecosystem, which mandates Google Play Billing for specific types of transactions. Understanding where the line is drawn is essential for any SaaS founder, indie maker, or digital business owner.
Understanding Google Play Payment Rules for TWAs
Google Play Policy divides transactions into two main categories: digital goods and physical goods. The payment integration you are permitted to use depends entirely on which category your PWA falls under. If your app violates these policies, Google will reject your submission or suspend your published app.
For physical goods and services consumed outside the app, you must use an external payment processor. Google Play Billing is strictly prohibited for these transactions. Examples include physical e-commerce stores, ride-hailing services, food delivery, and physical ticket sales. For these apps, you can keep your existing Stripe or PayPal web integrations active within your PWA.
For digital goods and services consumed inside the app, Google Play Billing is mandatory. This includes software-as-a-service (SaaS) subscriptions, virtual currencies, premium game features, ad-free upgrades, and digital media access. If a user can purchase access to digital content that is delivered or experienced inside the Android app, you cannot use Stripe or direct credit card input fields in your TWA. You must instead route these transactions through Google Play Billing.
| Transaction Category | Examples | Permitted Payment Method |
|---|---|---|
| Physical Goods | Clothing, groceries, hardware, physical books | Stripe, PayPal, custom web gateways |
| Physical Services | Ride-sharing, hotel bookings, food delivery | Stripe, PayPal, custom web gateways |
| Digital Subscriptions | SaaS tools, cloud storage, premium media access | Google Play Billing |
| Digital Content | In-game items, virtual coins, ad removal | Google Play Billing |
What is the Digital Goods API?
Historically, integrating Google Play Billing into a web-based app was highly complex, often requiring developers to build heavy custom Android bridges using WebView interfaces. Trusted Web Activities solve this issue by supporting the Digital Goods API. This is a web-incubated API that allows web applications running inside a TWA to communicate directly with the Google Play Billing service on the user's device.
The Digital Goods API acts as an intermediary. Your PWA executes JavaScript code in the browser context, which calls the Digital Goods API. The browser (Chrome or another TWA-enabled browser) then communicates with the underlying Android operating system to trigger the Google Play purchase flow. The user sees the familiar native Google Play payment sheet, completes the payment using their saved Google payment methods, and your web app receives a secure callback with the transaction receipt.
How to Implement the Digital Goods API in Your PWA
Integrating Google Play Billing via the Digital Goods API involves a series of steps that must be handled in your web app's codebase. It is recommended to implement this as a progressive enhancement, meaning your app uses standard Stripe billing on desktop browsers and switches to the Digital Goods API when it detects it is running inside a TWA.
Step 1: Feature Detection
First, you must check if the Digital Goods API is available in the user's current environment. The API is exposed under the window.getDigitalGoodsService interface. If this interface is undefined, the app is running in a standard web browser, and you should fall back to your standard web payment gateway.
Example check:
if ('getDigitalGoodsService' in window) { console.log('Digital Goods API is supported'); } else { console.log('Falling back to standard web payments'); }
Step 2: Initialize the Billing Service
To interact with Google Play, you need to call the digital goods service using your Google Play billing reference. This is typically the Android package name of your app (e.g., com.example.pwaapp).
const paymentProvider = 'https://play.google.com/billing';
let service;
try {
service = await window.getDigitalGoodsService(paymentProvider);
} catch (error) {
console.error('Failed to connect to Play Billing service', error);
}
Step 3: Query Product Details
Before showing a purchase button, you should query Google Play for the active products and prices configured in your Google Play Console. This ensures the currency and pricing match what Google Play expects.
const products = await service.getDetails(['subscription_premium_monthly']);
for (const product of products) {
console.log(product.title, product.value, product.currency);
}
Step 4: Initiate the Payment Flow
Once the user clicks purchase, you use the standard Payment Request API, passing the payment method identifier and the digital goods service details. This triggers the native Android payment sheet.
const paymentMethods = [{
supportedMethods: paymentProvider,
data: { sku: 'subscription_premium_monthly' }
}];
const paymentDetails = {
total: { label: 'Total', amount: { currency: 'USD', value: '9.99' } }
};
const request = new PaymentRequest(paymentMethods, paymentDetails);
const response = await request.show();
Handling Alternative Billing Systems by Jurisdiction
In recent years, regulatory pressure has forced Google to allow alternative billing systems in certain countries, such as South Korea, India, and member states of the European Economic Area (EEA). If your target audience is based in these regions, you may be permitted to offer an alternative web-based payment method alongside Google Play Billing inside your TWA.
However, implementing this requires registering for the specific developer programmes with Google, submitting additional compliance documentation, and paying a reduced service fee to Google on those external transactions. For most small businesses and independent developers, sticking to standard Google Play Billing for digital goods is the most straightforward path to compliance.
Testing and Compliance Checklist
To ensure your app is not rejected during the Google Play review process, keep the following items in mind:
- Ensure your TWA has Digital Asset Links correctly configured. If your app displays the address bar, Google may reject the app for payment policy compliance issues because it behaves like an open browser.
- Create licensed testers in your Google Play Console. This allows you to test the checkout flow without spending real money.
- Always write fallback logic. If a user accesses your PWA outside of the Android app, ensure they can still manage their subscription or make purchases using your standard Stripe payment pages.
- Confirm that your Google Play Console pricing matches the pricing displayed on your website to avoid confusing users.
Ready to ship your Android app?
Paste your PWA URL, get a signed APK and a Google Play ready AAB in minutes.
Build my app