Skip to content

feat: sync with openiap v1.3.15 - simplify Android input field names#3129

Merged
hyochan merged 4 commits intomainfrom
feat/openiap-sync-1.3.15
Jan 20, 2026
Merged

feat: sync with openiap v1.3.15 - simplify Android input field names#3129
hyochan merged 4 commits intomainfrom
feat/openiap-sync-1.3.15

Conversation

@hyochan
Copy link
Owner

@hyochan hyochan commented Jan 20, 2026

Summary

  • Breaking Change: Simplify Android input type field names (remove redundant Android suffix)
  • New Feature: Add offerToken support for one-time purchase discounts (Android 7.0+)
  • Sync with OpenIAP v1.3.15 (gql: 1.3.15, google: 1.3.26, apple: 1.3.13)

Breaking Changes

Fields inside RequestPurchaseAndroidProps and RequestSubscriptionAndroidProps no longer need Android suffix:

Old Name (v14.7.3) New Name (v14.7.4)
obfuscatedAccountIdAndroid obfuscatedAccountId
obfuscatedProfileIdAndroid obfuscatedProfileId
purchaseTokenAndroid purchaseToken
replacementModeAndroid replacementMode

Note: Response types (like PurchaseAndroid.purchaseTokenAndroid) keep their suffix.

Migration

// Before
await requestPurchase({
  request: {
    google: {
      skus: ['subscription_id'],
      purchaseTokenAndroid: currentPurchaseToken,
      replacementModeAndroid: 1,
    },
  },
  type: 'subs',
});

// After
await requestPurchase({
  request: {
    google: {
      skus: ['subscription_id'],
      purchaseToken: currentPurchaseToken,
      replacementMode: 1,
    },
  },
  type: 'subs',
});

Test plan

  • TypeScript typecheck passes
  • All 187 tests pass
  • Nitro specs regenerated successfully
  • Example apps updated
  • Documentation updated with cross-platform examples

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for one-time purchase discount offers (Android 7.0+).
  • Documentation

    • Updated API docs, examples, and release notes with simplified Android input naming and a migration guide.
  • Chores

    • Simplified Android request field names (removed platform-specific suffixes) and aligned request payloads.
  • Bug Fixes

    • Improved parsing and error handling in purchase verification flows.
  • Tests

    • Added comprehensive tests for offer/token mappings and Android input typings.

✏️ Tip: You can customize this high-level summary in your review settings.

Breaking Changes:
- Android input type fields no longer need Android suffix:
  - obfuscatedAccountIdAndroid → obfuscatedAccountId
  - obfuscatedProfileIdAndroid → obfuscatedProfileId
  - purchaseTokenAndroid → purchaseToken
  - replacementModeAndroid → replacementMode

New Features:
- Add offerToken support for one-time purchase discounts (Android 7.0+)

Changes:
- Update openiap-versions.json (gql: 1.3.15, apple: 1.3.13, google: 1.3.26)
- Regenerate TypeScript types
- Update Nitro spec with new field names
- Update Android native code (HybridRnIap.kt)
- Update TypeScript API layer (src/index.ts)
- Update example apps to use google key instead of android
- Update documentation with cross-platform examples
- Add release blog post

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Android input field names no longer include the "Android" suffix (e.g., obfuscatedAccountIdAndroidobfuscatedAccountId). A new offerToken field is added for one-time purchase discounts (Android 7.0+). Kotlin bridge parsing for verify flows now includes a defensive null-check on parsed props. Documentation, examples, and tests updated accordingly.

Changes

Cohort / File(s) Summary
Core Types & Specs
src/types.ts, src/specs/RnIap.nitro.ts
Renamed Android input fields to remove "Android" suffix (obfuscatedAccountId, obfuscatedProfileId, purchaseToken, replacementMode) and added `offerToken?: string
Bridge Implementation
android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt
Read renamed fields from incoming Android request objects (e.g., androidRequest.replacementMode), and added a defensive null-check after fromJson in verifyPurchaseWithProvider, throwing if parsing fails.
Runtime / API Logic
src/index.ts
Construct Android payloads using the renamed fields; include offerToken for non-subscription one-time purchases when present; subscription branch uses purchaseToken and replacementMode.
Examples & Apps
example/screens/SubscriptionFlow.tsx, example-expo/app/subscription-flow.tsx
Switched android: {...} usage to google: {...} and updated field names (replacementMode, purchaseToken, obfuscated IDs) to match new names.
Tests
example/__tests__/screens/SubscriptionFlow.test.tsx, src/__tests__/standardized-offer-types.test.ts
Updated expectations and assertions to use renamed fields; added comprehensive tests validating offer/discount tokens propagation and Android response vs input naming conventions.
Docs / Release Notes
docs/CONVENTIONS.md, docs/blog/2026-01-20-14.7.4-android-input-naming.md, docs/docs/api/methods/unified-apis.md, docs/docs/examples/subscription-flow.md, docs/static/llms-full.txt, docs/static/llms.txt
Documented field renames, migration guidance, added offerToken examples and One-Time Purchase Discount (Android 7.0+) coverage; adjusted examples and parameter docs.
Versioning
openiap-versions.json
Bumped versions: apple 1.3.12→1.3.13, google 1.3.25→1.3.26, gql 1.3.14→1.3.15, docs 1.3.14→1.3.15.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Client as App(JS)
participant Core as openiap JS (src/index.ts)
participant Bridge as HybridRnIap (Kotlin)
participant Play as Google Play / Provider
Client->>Core: requestPurchase({ google: { skus..., offerToken?, purchaseToken?, replacementMode?, obfuscatedAccountId?, obfuscatedProfileId? } })
Core->>Bridge: forward purchase payload (renamed fields)
Bridge->>Play: call Play Billing API (use offerToken / purchaseToken / replacementMode)
Play-->>Bridge: billing response
Bridge->>Core: emit result / verifyPurchaseWithProvider(parse props)
Core->>Play: optional provider verification request
Play-->>Core: verification response
Core->>Client: emit purchase/update via listeners/useIAP callbacks

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested labels

🎯 feature, 🤖 android, 💲 openiap

Poem

🐰 Hop, hop — I read the keys with care,

obfuscatedAccountId now breathes fresh air,
offerToken brings a discounted treat,
Fields are tidy, naming neat,
My little paws applaud this change so rare.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: field name simplification in Android input types as part of an OpenIAP version sync.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hyochan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request streamlines the Android in-app purchase API by simplifying input field names and introducing support for one-time purchase discount offers. It also updates underlying OpenIAP dependencies to their latest versions, ensuring compatibility and leveraging new features. The changes aim to make the API more intuitive for developers while expanding functionality for Android users.

Highlights

  • Breaking Change: Android Input Field Naming: Simplified Android input type field names by removing the redundant 'Android' suffix from RequestPurchaseAndroidProps and RequestSubscriptionAndroidProps fields (e.g., obfuscatedAccountIdAndroid becomes obfuscatedAccountId). Response types retain the suffix.
  • New Feature: One-Time Purchase Discounts: Added support for offerToken in one-time purchases for Android 7.0+ to enable discount offers.
  • Dependency Update: Synchronized with OpenIAP v1.3.15, including updates to openiap-gql (1.3.15), openiap-google (1.3.26), and openiap-apple (1.3.13).

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@hyochan hyochan added 🚽 migration Activities due to changes in framework 🛠 refactor labels Jan 20, 2026
@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 58.33333% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.63%. Comparing base (42d6f2b) to head (f6d0629).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/index.ts 58.33% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3129      +/-   ##
==========================================
+ Coverage   67.61%   67.63%   +0.01%     
==========================================
  Files           9        9              
  Lines        1717     1721       +4     
  Branches      574      576       +2     
==========================================
+ Hits         1161     1164       +3     
- Misses        551      552       +1     
  Partials        5        5              
Flag Coverage Δ
library 67.63% <58.33%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/index.ts 68.72% <58.33%> (+0.03%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…s to llms.txt

- Add subscription upgrade/downgrade example with purchaseToken and replacementMode
- Add one-time purchase discount example with offerToken (Android 7.0+)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request simplifies the Android input type field names by removing the redundant Android suffix and aligns platform keys to google instead of android, which are great improvements for API consistency. It also adds support for offerToken for one-time purchase discounts on Android. The changes are consistently applied across the codebase, including source files, documentation, examples, and tests. I have one minor suggestion to improve code style in the new blog post. Overall, this is a solid pull request.

hyochan and others added 2 commits January 20, 2026 18:55
- Add standardized-offer-types.test.ts matching expo-iap test coverage
- Tests DiscountOffer, SubscriptionOffer type structures
- Tests input field naming convention (no Android suffix for inputs)
- Tests offerToken for one-time purchase discounts
- Fix nullable VerifyPurchaseWithProviderProps in HybridRnIap.kt

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@hyochan hyochan merged commit b98b6d3 into main Jan 20, 2026
11 checks passed
@hyochan hyochan deleted the feat/openiap-sync-1.3.15 branch January 20, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚽 migration Activities due to changes in framework 🛠 refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant