Skip to content

Conversation

@FlorianKe
Copy link
Contributor

@FlorianKe FlorianKe commented Aug 25, 2025

In-App Purchase: Upgrade and Downgrade

If a merchant has already purchased an in-app feature, they can now upgrade to a higher plan (e.g., from Basic to Pro) or downgrade to a lower plan (e.g., from Pro to Basic).

As part of the implementation, a new admin component was introduced based on the updated design. Additionally, the purchase process was redefined, since we now require a cart to check whether the merchant already owns the feature. This information is retrieved via a new SBP endpoint.

The SBP endpoint returns information about the merchant's current in-app purchases. Based on that data, we can determine if the requested feature is already owned and whether an upgrade or downgrade is applicable.

Furthermore, the api.in-app-purchases.cart.order call has now optional supports for an additional body parameter:

For upgrades:

"subscriptionChange": {
  "type": "upgrade",
  "currentInAppFeatureIdentifier": "identifier"
}

For downgrades:

"subscriptionChange": {
  "type": "downgrade",
  "currentInAppFeatureIdentifier": "identifier"
}

If the subscriptionChange parameter is not set, the system will treat the request as a new purchase.

@FlorianKe FlorianKe self-assigned this Aug 25, 2025
@FlorianKe FlorianKe force-pushed the feat/iap-upgrade-downgrade branch from da33ba1 to 1609134 Compare August 26, 2025 11:05
@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2025

Codecov Report

❌ Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.45%. Comparing base (b38765a) to head (af91e38).

Files with missing lines Patch % Lines
src/Services/StoreClient.php 0.00% 12 Missing ⚠️
src/Controller/InAppPurchasesController.php 0.00% 2 Missing ⚠️
src/Services/InAppPurchasesService.php 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk     #110      +/-   ##
============================================
+ Coverage     68.89%   76.45%   +7.56%     
- Complexity       66       69       +3     
============================================
  Files            35        8      -27     
  Lines          1064      361     -703     
  Branches        126        0     -126     
============================================
- Hits            733      276     -457     
+ Misses          302       85     -217     
+ Partials         29        0      -29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@FlorianKe FlorianKe force-pushed the feat/iap-upgrade-downgrade branch 2 times, most recently from 82ce7ab to 0d2eeb6 Compare August 27, 2025 10:45
@FlorianKe FlorianKe force-pushed the feat/iap-upgrade-downgrade branch 3 times, most recently from c22e4cc to f896b2f Compare August 27, 2025 13:40
@FlorianKe FlorianKe marked this pull request as ready for review August 27, 2025 13:41
@FlorianKe FlorianKe requested review from a team, cyl3x and lernhart August 27, 2025 13:41
@FlorianKe FlorianKe force-pushed the feat/iap-upgrade-downgrade branch 5 times, most recently from 1772d83 to cba80a9 Compare September 1, 2025 11:28
cyl3x
cyl3x previously approved these changes Sep 1, 2025
@FlorianKe FlorianKe force-pushed the feat/iap-upgrade-downgrade branch from 64b4fdf to e33b9b5 Compare September 12, 2025 06:20
@cyl3x cyl3x requested a review from a team September 12, 2025 06:24
cyl3x
cyl3x previously approved these changes Sep 12, 2025
@cyl3x cyl3x requested a review from a team September 12, 2025 06:24
@mstegmeyer
Copy link
Contributor

I'm missing a description for this PR and this whole feature. This has already been very sidelined and not well documented, to have this at least here would be at least something 💙

Copy link
Member

@En0Ma1259 En0Ma1259 left a comment

Choose a reason for hiding this comment

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

Just minor things, except the language

@cyl3x cyl3x merged commit f5dc076 into trunk Oct 7, 2025
6 checks passed
@cyl3x cyl3x deleted the feat/iap-upgrade-downgrade branch October 7, 2025 06:44
FlorianKe added a commit that referenced this pull request Oct 7, 2025
FlorianKe added a commit that referenced this pull request Oct 10, 2025
* feat: iap upgrade and downgrade (#110)

* fix: pipeline

* styling: fix spacing

* chore: increase composer version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants