Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

fix: subscription upgrade and download#13

Merged
hyochan merged 4 commits intomainfrom
fix/subscription-upgrade
Sep 29, 2025
Merged

fix: subscription upgrade and download#13
hyochan merged 4 commits intomainfrom
fix/subscription-upgrade

Conversation

@hyochan
Copy link
Member

@hyochan hyochan commented Sep 29, 2025

Current PR introduce proper support for subscription plan changes by refactoring requestPurchase to use platform-specific props, switching fetchProducts to a ProductRequest object, and replacing restorePurchases with getAvailablePurchases(null), while disallowing type=All for purchases.

Refactor OpenIapStore to use GraphQL types, fix handling of effectiveObfuscatedProfileId during plan changes, and update the example app to demonstrate subscription upgrade/downgrade scenarios.

Resolve hyochan/react-native-iap#3032

- Refactor requestPurchase to handle subscription replacement with platform-specific props
- Use ProductRequest object in fetchProducts for consistency
- Replace restorePurchases with getAvailablePurchases(null)
- Disallow type=All for purchases to enforce InApp or Subs only
@hyochan hyochan added the 🛠 bugfix All kinds of bug fixes label Sep 29, 2025
@hyochan hyochan merged commit 90e4590 into main Sep 29, 2025
4 checks passed
@hyochan hyochan deleted the fix/subscription-upgrade branch September 29, 2025 09:40
hyochan added a commit to hyochan/react-native-iap that referenced this pull request Sep 29, 2025
…3039)

Check if the subscription is `upgrade` and filter
`obfuscatedProfileIdAndroid` field which is done in
hyodotdev/openiap-google#13.

```kt
val isUpgrade = !androidRequest.purchaseTokenAndroid.isNullOrEmpty()

obfuscatedProfileIdAndroid = if (isUpgrade) null else androidRequest.obfuscatedProfileIdAndroid,
```
> Exact line:
https://github.com/hyodotdev/openiap-google/blob/c7af9f04fbdeb42721315185d0e4ed3d8a056cfb/openiap/src/main/java/dev/hyo/openiap/OpenIapModule.kt#L309-L313

Add tests and example codes related to this.

Resolve #3032

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Plan-change UI with upgrade/downgrade controls, current plan, expiry,
auto-renew, and transaction display; added yearly subscription option.

* **Documentation**
* Simplified example links and note blocks for
Purchase/Subscription/Available-Purchases/Offer-Code guides.
* Updated API docs and guides to show useIAP invoked with
onPurchaseSuccess/onPurchaseError callbacks (removing
currentPurchase/currentPurchaseError examples).

* **Tests**
* Expanded subscription tests covering Android flows, ownership states,
retries, connection transitions, modals, and logging.

* **Chores**
  * Bumped a dependency patch version.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🛠 bugfix All kinds of bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Getting Invalid arguments provided to the API when upgrading

1 participant