In-App Purchase History API
Return the user's Google Play purchase history as window.purchaseHistory so your web app can list subscriptions or unlock premium content client-side.
The In-App Purchase History API returns the list of the user's previous purchases (product IDs, timestamps, tokens) made through Google Play Billing and injects it into your web app as window.purchaseHistory. Make sure to own an Extended License of WebViewGold if you plan to use this feature in an end product.
How to Use:
<a href="getpurchasehistory://" onclick="setTimeout(renderHistory, 300)">My purchases</a>
<script>
function renderHistory() {
const data = window.purchaseHistory;
if (!data) return;
data.purchases.forEach(function (p) {
console.log(p.productId, p.purchaseTime, p.orderId);
});
}
</script>
Payload Shape:
{
"purchases": [
{
"productId": "com.example.premium",
"purchaseTime": 1721600000000,
"orderId": "GPA.xxxx-xxxx-xxxx",
"purchaseToken": "..."
}
]
}
Exact fields depend on the store record — treat the value as a JSON array to iterate.
Typical Use Cases:
- Show a "My subscriptions" or "My purchases" page inside your web app.
- Client-side unlock of premium content based on past purchases without hitting your backend.
- Debugging and customer-support workflows.
Notes: The list contains only purchases made under the currently signed-in Google Play account on this device.