Added monetization functions - #3
Conversation
The64thRealm
left a comment
There was a problem hiding this comment.
We're still missing the getEntitlements function, but I can add that in a separate pr if you'd like.
| - name: is_entitled_async | ||
| type: function | ||
| desc: | | ||
| Checks whether the player owns the given paid content for this game. This is a UX hint, not a security check. | ||
| parameters: | ||
| - name: content_identifier | ||
| type: string | ||
| returns: | ||
| - name: response | ||
| type: function | ||
| desc: | | ||
| Returns true if the player owns the content. | ||
| (Note: Only if called from within a coroutine) | ||
|
|
||
|
|
||
| - name: trigger_paywall_async | ||
| type: function | ||
| desc: | | ||
| Triggers the Wavedash-rendered paywall flow for the given content and returns whether the purchase was completed. Resolves immediately with true if the player already owns it. | ||
| parameters: | ||
| - name: content_identifier | ||
| type: string | ||
| returns: | ||
| - name: response | ||
| type: function | ||
| desc: | | ||
| Returns true if the player owns the content after the flow completes. | ||
| (Note: Only if called from within a coroutine) |
There was a problem hiding this comment.
These are indented by 3 spaces, which causes this file to fail to parse and prevents auto-complete from working
There was a problem hiding this comment.
change the indent to be 2 spaces
| /** | ||
| * Checks whether the player owns the given paid content for this game. | ||
| * @name is_entitled_async | ||
| * @string content_identifier | ||
| * @return response Returns true if the player owns the content. (Note: | ||
| * Only if called from within a coroutine) | ||
| */ |
There was a problem hiding this comment.
nit but other async functions have
This is an asynchronous function. The result will be delivered as an event with id 'requestFullscreen' or as a return value if the function is called from a coroutine.
in their doc comment, can you add it for consistency?
| /** | ||
| * Triggers the Wavedash-rendered paywall flow for the given content. | ||
| * Resolves immediately with true if the player already owns it; otherwise | ||
| * opens the paywall and resolves with whether the purchase was completed. | ||
| * @name trigger_paywall_async | ||
| * @string content_identifier | ||
| * @return response Returns true if the player owns the content after the | ||
| * flow completes. (Note: Only if called from within a coroutine) | ||
| */ |
There was a problem hiding this comment.
| * @return response Returns true if the player owns the content after the | ||
| * flow completes. (Note: Only if called from within a coroutine) |
There was a problem hiding this comment.
This isn't true, it returns a response, you have to check entitled.success and entitled.data to make sure that they are entitled
Added two core monetization functions, updated example and documentation, tested on a real live game:
Wavedash.isEntitled("entitlement-id"); > wavedash.is_entitled_async("entitlement-id")
Wavedash.triggerPaywall("entitlement-id"); > wavedash.trigger_paywall_async("entitlement-id")
Closes #2