Article sections

    Q: How can I grant access to content after a successful In-App Purchase?

    Yes, you can absolutely identify the buyer and grant them full access to your web content. The method for doing this depends on whether you are using our RevenueCat integration or the traditional manual setup.

    1. Using RevenueCat (Recommended Method)

    With our recommended RevenueCat integration, the process is easy, robust and secure.

    Please check out our documentation for detailed examples:

    It’s easy to connect your WebView content to RevenueCat using WebViewGold:

    • Identify the Buyer: You identify the user upfront by passing your own unique user ID (like an email address or a database ID) in the external_id parameter when you trigger the purchase.
    • Granting Access: The best and most reliable way to grant access is by using RevenueCat Webhooks. RevenueCat sends real-time notifications directly to your server when a purchase, renewal, or cancellation occurs. Your server can then automatically update the user’s account status (e.g., is_premium = true) in your database.
    • Serving Content: When the user visits your website within the app, your site simply checks your database for their account status to determine whether to show them the premium content.

    This server-to-server approach is highly secure and ensures that user permissions are always up-to-date. For more details on setting up RevenueCat, check out our documentation and sign up at tinyurl.com/register-revenuecat.

    2. Using the Manual Setup

    If you are using the manual in-app purchase setup, you can use the successful_url and expired_url parameters.

    Please check out our documentation for detailed examples:

    Our manual In-App Purchase API allows you to redirect to a specific URL after a successful payment/subscription. If the subscription expires, another expired_url will be called. Both URLs can be used to trigger an upgrade for your user in the database or to set a client-side “premium” cookie.

    Additionally or alternatively, the manual setup allows you to handle purchase data from the server side. After a successful transaction, WebViewGold injects JavaScript variables (containing the planID, transactionIdentifier, etc.) into the webpage. You can then send this data to your server for validation. Please see the documentation for more details on this method.

    in WebViewGold for AndroidWebViewGold for iOS