-
Notifications
You must be signed in to change notification settings - Fork 267
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
- The URL is escaped incorrectly. It should be 'http://localhost:8000' instead of 'http://localhost:8000'.
"url": "http://localhost:8000",
guides/plugins/apps/gateways/in-app-purchase/in-app-purchase-gateway.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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:
- 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
- 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
There was a problem hiding this comment.
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:
- Listing available purchases
- Filtering during checkout
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
ab6237a
to
884b856
Compare
884b856
to
f8c5216
Compare
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? |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Allow the purchase of an In-App Purchases | |
## Trigger a purchase of an In-App Purchases |
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`: |
There was a problem hiding this comment.
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
No description provided.