WebToNative
  • Getting started
  • Plugin Setup
    • OneSignal Set Up
    • Google AdMob Setup
    • In App Purchase - iOS Setup
    • In App Purchase - Android Setup
    • Firebase Notification Integration - iOS Setup
  • Social Login Integrations
    • Getting the SHA Key for Google Login
    • Create Google OAuth Client Id
    • Facebook Login Configuration
  • Javascript APIS
    • Getting Started
    • Status Bar
    • Pull To Refresh
    • Close App
    • Device Info
    • Clear App Cache
    • OneSignal Push Notification
    • Download Files
    • Printing Options
    • AdMob
    • Geo Location
    • Load In External Browser
    • Barcode Scan
    • In App Purchase - iOS Integration
    • In App Purchase - Android Integration
    • Social Login
    • Facebook App Events
    • Bottom Navigation
    • Clipboard
    • Screen Control
    • Background Location
    • Native Contacts
    • iOS App Tracking Transparency
    • Google Firebase Analytics
    • Haptic Feedback
    • Google Firebase Notification
    • Apps Flyer
    • App Review
    • Calender - iOS
    • Calendar - Android
    • Biometric Authentication
    • Media Player
    • Notification View
    • Offer Card
    • Cookie Update
    • App Launch Detection
    • Download Manager
    • Dynamic App Icon
    • File Sharing
  • Website Plugins
    • Wordpress
      • Push notification (WooCommerce)
      • In-App Purchase
        • In-App Purchase (IAP) Configuration Guide for iOS and Android
        • In-App Purchase (WooCommerce)
        • In-App Purchase
      • Offercard
      • Biometric Authentication
      • Social Login
      • Webtonative media player
        • WebToNative Radio Player
        • MediaPlayer Native Control
    • Bubble.io
      • Customize Status Bar
      • Device-Based Element Visibility
      • Pull to Refresh (Android)
      • OneSignal Push Notification
        • Set External ID
        • Send Push Notification
        • Set/Remove Email or SMS Phone
        • Set Tag
      • Close App
      • Get Device Info
      • Clear App Cache (Android)
      • Screen Control
      • Facebook Events
        • Regular
        • Purchase
      • AdMob
      • Offercard
      • In-App Purchase
        • In-App Purchase (Android/iOS)
        • Get IAP Canceled Subscription List (iOS)
      • Social Login
      • Biometric Authentication
  • Shopify
    • Social Login
    • In-App Purchase
      • In-app purchase
    • Push Notification
      • Abandoned Cart
    • Status Bar Customization
    • Native Device Visibilty
    • Set Onesignal Tags
    • Pull to Refresh
    • Account Deletion
    • Biometric Authentication
  • Upload Apps
    • Android App
    • Ios App
Powered by GitBook
On this page
  • Admin Setup
  • REST API Endpoints
  • Payment Validation
  • Where In-App Purchase Data is Saved

Was this helpful?

  1. Website Plugins
  2. Wordpress
  3. In-App Purchase

In-App Purchase (WooCommerce)

The In-App Purchase (IAP) integration enables seamless payment handling via the Google Play Store (Android) and Apple App Store (iOS) within WooCommerce.

PreviousIn-App Purchase (IAP) Configuration Guide for iOS and AndroidNextIn-App Purchase

Last updated 3 months ago

Was this helpful?

Android IAP

Admin Setup

  1. Custom Fields for Products

When creating or editing WooCommerce products, the following fields are available for configuring in-app purchases:

  • Google Play Product ID: ID for the product in Google Play

  • App Store Product ID: ID for the product in the App Store

  • Product Type: (INAPP for one-time purchases or SUBS for subscriptions)

  • Is Consumable: (Checkbox indicating if the product is consumable)

  1. Configure Custom Button Text

Admins can customize the text for various buttons displayed during the checkout process in the WooCommerce IAP Settings section. To access these settings:

  1. Go to your WordPress admin dashboard.

  2. Navigate to WooCommerce > IAP Settings (specific section for Webtonative integration).

  3. Configure the following button texts:

  • Cart Button Text: The default is "Buy Now."

  • Processing Button Text: Default is "Processing..."

  • Failed Button Text: The default is "Payment Failed."

  • Payment Completed Button Text: The default is "Payment Completed."

Save the settings after making changes.

3. Setting Up the Webtonative Payment Gateway

Here’s a guide to setting up the App Store Secret Key and configuring the Is Test mode for the Webtonative Payment Gateway in WooCommerce


Step 1: Access WooCommerce Payment Settings

  1. Go to your WordPress admin dashboard.

  2. Navigate to WooCommerce > Settings.

  3. Click on the Payments tab.

Step 2: Enable Webtonative Payment Gateway

  1. Locate the Webtonative Payment Gateway in the list of payment methods.

  2. Toggle the switch to enable the gateway.

  3. Click the Manage button to access the gateway settings.

Step 3: Configure the App Store Secret Key

  1. In the Webtonative Payment Gateway Settings:

    • Enable/Disable: Check the box to enable the payment gateway.

    • App Store Secret: Enter your App Store secret key. This key validates in-app purchases or subscriptions through the Apple App Store.

  2. Save the secret key securely in the provided field.

Step 4: Enable Test Mode

  1. Check the Is Test option to enable the test mode.

    • When enabled, the gateway will use the sandbox environment to test purchases instead of the live environment.

    • Use this option during development or testing to avoid real charges.

Step 5: Save Changes

  1. Click the Save Changes button at the bottom of the settings page.

  2. Verify that the changes are saved successfully.


Important Notes:

  • App Store Secret Key: Ensure the secret key is up-to-date and matches the credentials in your Apple Developer account.

  • Test Mode: Remember to uncheck Is Test and switch to the live environment before launching your store.


REST API Endpoints

1. Get a Native Product ID

  • Endpoint: POST /webtonative/iap/product

  • Request Parameters:

    • productId (string): WooCommerce Product ID

    • platform (string): ANDROID or IOS

  • Response: Returns native product details like Product ID, Type, and Consumable status.

2. Create WooCommerce Order

  • Endpoint: POST /webtonative/iap/order

  • Request Parameters:

    • productId (string): WooCommerce Product ID

    • platform (string): ANDROID or IOS

    • Additional purchase data specific to the platform.

  • Response: Create an order in WooCommerce with payment details from Google Play or Apple App Store.

Payment Validation

Android Payment Validation

  • Data validated includes orderId, purchaseToken, purchaseState, and other parameters received from Google Play.

  • A wooCommerce order is created if the purchase is verified successfully.

iOS Payment Validation

  • Receipt data is validated using the App Store's API (sandbox or production).

  • If validated successfully, a WooCommerce order is created and marked as completed.

Where In-App Purchase Data is Saved

  1. WooCommerce Order Notes

  • Each order created via IAP includes a detailed note with purchase data.

  • Example note: Webtonative Payment Data:

    - Product ID: <product_id>

    - Order ID: <order_id>

    - Platform: <ANDROID/IOS>

    - Other purchase details...

  1. Post Meta

  • metadataPurchase details are saved as metadata in WooCommerce orders.

  • Meta Key: _wtn_payment_data

  • It contains a JSON object with transaction details, such as productId, receiptData, platform, and more.

You can obtain this key from your . To create or retrieve the secret key, navigate to Users and Access > Integrations > Shared Secret.

Apple Developer Account
iOS IAP