Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEXT-36303 - In App Purchases docs #1641

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lernhart
Copy link
Member

@lernhart lernhart commented Jan 9, 2025

No description provided.

@lernhart lernhart self-assigned this Jan 9, 2025
@Isengo1989 Isengo1989 requested a review from Copilot January 14, 2025 11:19
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

guides/plugins/apps/gateways/in-app-purchase/in-app-purchase-gateway.md:69

"url": "http://localhost:8000",

guides/plugins/apps/in-app-purchase/index.md Outdated Show resolved Hide resolved
guides/plugins/plugins/in-app-purchase/index.md Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update with the newest version:

In-App Purchases.md

Copy link
Member Author

Choose a reason for hiding this comment

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

@cyl3x isn't that exactly the base we've worked on in the bus?

Copy link

Choose a reason for hiding this comment

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

Almost, there are some small changes regarding plugins

## In-App Purchases gateway endpoint

During checkout of an In-App Purchase, Shopware checks for any active In-App Purchases gateways and will call the `inAppPurchases` url.
The app server will receive a list containing the single only In-App Purchase the user wants to buy as part of the payload.
Copy link
Contributor

Choose a reason for hiding this comment

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

This sentence doesn't make sense. Receive a list containing the single only In-App Purchase. What is it? A list, a single or an only? :-P

Also, if memory serves, the gateway handles 2 requests:

  1. listing of in app purchases - which I think you are explaining here, but it doesn't happen during the checkout. This call happens from the extension detail page in the store. A list is sent, and a filtered list is sent back. For more info: https://github.com/shopware/SwagExtensionStore/blob/trunk/src/Controller/InAppPurchasesController.php#L111
  2. filtering an in-app purchase cart. This happens just before checkout completes. A specific feature id is sent, and that gets filtered. For more info: https://github.com/shopware/SwagExtensionStore/blob/trunk/src/Controller/InAppPurchasesController.php#L86

Copy link
Contributor

Choose a reason for hiding this comment

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

Reading further, I see what you are trying to do. You are covering both parts in one section.

I'd suggest breaking it into two pieces:

  1. Listing available purchases
  2. Filtering during checkout

Copy link
Member Author

Choose a reason for hiding this comment

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

The listing stuff is not implemented yet, I'd find it very confusing to split the docs up now. I wanted to give a fully-fledged example of how it will look like in the future, however there is a big warning text at the top, that we only actually calling the gateway during checkout and not for filtering purposes

Copy link

@cyl3x cyl3x Jan 15, 2025

Choose a reason for hiding this comment

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

I also vote for not breaking this up. While currently only the checkout stuff is implemented and plan on that list feature, that's not the essence of this endpoint.

  • You're (as an app server) allowed to filter the in-app purchases that are available for a merchant to see or buy - therefore not filtering any active/bought ones.
  • The given list can be incomplete, containing any amount of IAPs, but these are sure yours.
  • If you want to make a decision based on bought ones, have a look at the JWT in the app source.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please update with the attached file in previous comment.

@lernhart lernhart force-pushed the next-36303/in-app-purchase-docs branch 4 times, most recently from ab6237a to 884b856 Compare January 15, 2025 13:26
@lernhart lernhart force-pushed the next-36303/in-app-purchase-docs branch from 884b856 to f8c5216 Compare January 15, 2025 13:43
@cyl3x cyl3x self-requested a review January 15, 2025 15:50
In-App Purchases are a way to lock certain features behind a paywall within the same extension.
This is useful for developers who want to offer a free version of their extension with limited features and a paid version with more features.

## How do I receive bought In-App Purchases?
Copy link

Choose a reason for hiding this comment

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

shouldn't be a question

Alternatively you can extract the query parameter from `document.location` on the initial `sw-main-hidden` request,
store it and ask your app-server do properly decode it for you.

## Allow the purchase of an In-App Purchases
Copy link

Choose a reason for hiding this comment

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

Suggested change
## Allow the purchase of an In-App Purchases
## Trigger a purchase of an In-App Purchases

Comment on lines +18 to +21
You will also receive In-App Purchases with the initial `sw-main-hidden` admin request.
To make them accessible, inject them into your JavaScript application.

Here is an example with an `admin.html.twig` and `shopware/app-bundle`:
Copy link

Choose a reason for hiding this comment

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

That sounds a bit plummy, to be honest

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.

3 participants