Use this page with AI

Copy this into your coding assistant and add your request.

Read https://openiap.dev/docs/features/discount and https://openiap.dev/llms.txt. Follow the reading instructions, detailed reference, and linked guides relevant to my task before making changes.
Inspect my existing project and reuse its framework and conventions. Ask me for missing product decisions. Implement the requested behavior and run the applicable checks.
Show the working result, the commands and actual test results, and any remaining limitations. Keep your explanation brief.

My request: [describe what customers should be able to do]
See an example request →

Discounts

Display and handle discounted one-time purchase products on Google Play. This feature requires Google Play Billing Library 8.0+ and allows you to show original prices, discount percentages, and promotional offers.

Overview#

Google Play Billing Library 8.0+ introduced support for one-time purchase discounts. When you configure a discount in Google Play Console, the library provides:

  • Multiple Offers - Products can have multiple offers with different prices
  • Discount Information - Percentage or fixed amount discounts
  • Full Price - Original price before discount for strikethrough display
  • Time Windows - Start and end times for limited-time offers
  • Quantity Limits - Maximum and remaining quantities for limited offers

Data Structure#

The discountOffers field contains standardized DiscountOffer values. The following excerpts use the generated field names:

swift
// iOS does not support one-time purchase discounts in the same way.
// For iOS subscription offers, use SubscriptionOffer instead.

Fetching Products with Discounts#

Fetch products normally using fetchProducts. Discounted one-time offers will be included in the discountOffers array:

swift
// iOS does not support one-time purchase discounts.
// Products are fetched the same way, but discount fields will not be present.

Displaying Discounts in UI#

Show discount information to users with strikethrough original prices and discount badges:

swift
// iOS does not support one-time purchase discounts in the same way.
// For subscription promotional offers on iOS, see the Subscription documentation.

Time-Limited Offers#

Check if an offer has a time window and display countdown or expiration information:

swift
// iOS does not have time-limited one-time purchase offers.

Limited Quantity Offers#

Some offers have quantity limits. Check remaining availability before displaying:

swift
// iOS does not have limited quantity one-time purchase offers.

Purchasing with Specific Offer#

When purchasing a discounted product, read the selected offer's offerTokenAndroid and pass its value as the Android request's offerToken:

swift
// iOS does not use offer tokens for one-time purchases.
// Simply request the purchase with the product ID.

Setting Up Discounts in Google Play Console#

To create discounted offers for one-time products:

  1. Go to Google Play Console > Monetization > Products
  2. Select your one-time product or create a new one
  3. In the product details, look for the Offers section
  4. Click Add offer to create a promotional offer
  5. Configure:
    • Discount type: Percentage or fixed amount
    • Discount value: The discount percentage or amount
    • Time window: Start and end dates (optional)
    • Quantity limit: Maximum purchases per user (optional)
  6. Save and publish your changes - it may take a few hours for changes to propagate

Best Practices#

  • Always show original price - Display the strikethrough original price next to the discounted price to highlight the value
  • Use urgency indicators - Show countdown timers for time-limited offers
  • Handle multiple offers - If a product has multiple offers, let users choose or automatically select the best discount
  • Graceful degradation - If discount info is not available, display the regular price without errors
  • Cache carefully - Discount offers can change; fetch fresh product data periodically
  • Test with license testers - Use Google Play Console license testers to verify discount display before release

Native References#