greenheartgames / greenworks

a node.js plugin to integrate nw.js/electron games with steamworks
MIT License
1.48k stars 152 forks source link

Documentation lacks information about microtransactions #252

Open Josh1billion opened 4 years ago

Josh1billion commented 4 years ago

Are microtransactions supported?

Searching through the issues, it appears that they are: another issue references a PR that added support for handling an event related to them.

But the docs do not appear to mention microtransactions. Unless the API is the same as it is for DLC, anyway, but that doesn't seem to be the case unless I'm misunderstanding.

FacePlace commented 4 years ago

It seems like greenworks doesn't support ISteamMicroTxn interface of Steamworks SDK. @Josh1billion did you find any hack solution to integrate microtransactions?

hokein commented 4 years ago

I don't have experience on using the steam microtransactions. @MadSpyxFR since you contributed the micro-txn-authorization-response event before, it would be nice if you could share your experience here.

TheRealDannyyy commented 4 years ago

Madspy stopped working on this for about 2 years now. Would be nice if someone else could look into it.

Josh1billion commented 4 years ago

It seems like greenworks doesn't support ISteamMicroTxn interface of Steamworks SDK. @Josh1billion did you find any hack solution to integrate microtransactions?

Nope, didn't find anything. But I didn't end up looking into it very deeply either.

framerate commented 4 years ago

Has anyone implemented microtransactions? I wanted to just put into my web flow (game opens a browser now with stripe integration and redirects back to game) but their documentation is horrendous...

Is it easier to do that or implement something in the overlay? Any experience (electron) is GREATLY appreciated!

FacePlace commented 4 years ago

There is a way to implement microtransactions into a game using just greenworks micro-txn-authorization-response. The solution is to create an available for everyone item store (such as in game "Grim Clicker") and then open it in a game using the steam overlay.

Example

I have not integrated it yet, but I think that this solution is the best until greenworks doesn't support mtx natively.

framerate commented 4 years ago

@FacePlace this is awesome news. Steams documentation leaves a little to be desired (versus implementing something like Stripe).

What does the flow look like here?

Although in my case I think I'd need micro-txn-authorization-response to be handled on my server for security purposes...

FacePlace commented 4 years ago

@framerate Yes, I think that the flow would be as you described. Of course, this is a hacky solution, but at this time we don't have much of a choice.

framerate commented 4 years ago

Ok here's my steps to implement this weekend if anyone has feedback/input. My game uses a browser for other transactions so I'm starting there. I'll send the itemId and pricing to my server (running nodejs) in the first steps. I'll update with progress too for transparency for the next person trying this.

REQUIRED

framerate commented 4 years ago

FYI after 3 days I'm blocked by not being able to get the overlay to work (electron). I'm going to try and solve the problem but if anyone has answers, I'd like to clean up the documentation around here as I go (made a bug: https://github.com/greenheartgames/greenworks/issues/262) that way the next person has clear updated info and can hit the ground running faster.

MikalDev commented 4 years ago

Overlay works only with Windows as far as I can tell. You must launch your application from steam and you need to use this command-line option for your application:

--in-process-gpu

Also, make sure you are updating the screen every frame.

framerate commented 4 years ago

@MikalDev thank you, we're getting further in the investigations.

One of our biggest pitfalls is needing 3x build machines to build 3x platforms since it checks platform. When using prebuilt binaries, there has to be a way to let a single machine build all 3 don't you think? Any info on that would be great if you've gone down that rabbit hole!

Rosslington commented 4 years ago

@framerate I use Electron Builder to build for both Windows and MacOS on a single Mac machine and then created a custom Node script that uses the SteamCMD tools to upload those builds to Steam in one command. For Example: electron-webpack && electron-builder --dir --win --mac && node ./steam/steamPackage.js

EDIT: For this specific issue, my experience is that the "micro-txn-authorization-response" event works fine once you get the Steam Overlay working on Windows. You'll just need to set up something server side to start the transaction

Inateno commented 4 years ago

I started using this but as the overlay is a true pain with the last version of electron, I just switched to Xsolla which handles many other things.

With my team we are working on a way to have "a better overlay" inclusion as there are a lot of issues because of "chrome" behind the scene and there is nothing you can do about it. If our solution works, then we already have all the payment API system ready to go on our servers (only the client overlay was missing).

So if we manage to get something easy to setup and "generic" we will share our solution, but for now xsolla does the job.

framerate commented 4 years ago

We've recently got the overlay working on windows, it seems, in electron 8.2.5. However I don't think it works on all platforms (macOS and Linux) and users can still turn it off! So we're currently investigating a all server-side transaction flow as our default with the "fall back" being the overlay...

I'm merging the branch today so at least we've made some real progress here...

Inateno commented 4 years ago

You can't do a "all server side" transaction in any cases, the User have to select what he want to purchase and send that info.

With the steam API this goes through the steam overlay (and if you find any way to do it without the overlay I'm very curious about that).

For Xsolla what we did is:

If we could do that with the steam API that would have been cool...

framerate commented 4 years ago

@Inateno

I'm referring to this: https://partner.steamgames.com/doc/features/microtransactions/implementation under "Web Based Purchasing"

Clicking a link in the game opens a Browser which redirects to SteamWallet purchase page. Successful transaction goes back to your API which finalizes the transaction and sends an event to your client that the purchase was successful, thus "skipping" the overlay

So yeah, I think you CAN do it with just the Steam API, according to that doc, but I'm still confirming it.

Inateno commented 4 years ago

Oh indeed I completely ignored the "Web-based purchasing" section when I did it first ! So yes this should work more or less the same way we did with Xsolla, good to know !

framerate commented 4 years ago

FYI - I'm live with the web-based purchasing for the past 2 months. So far so good!

I'm not using greenworks on my server, and I'm not sure I even SHOULD/WOULD. All the NPM modules for communicating with the web API seemed to fail me so I started making my own.

If having a simple webAPI interface for communicating with the awful steam API would be beneficial to you, let me know, and I can probably open source it.

MikalDev commented 4 years ago

I'd be interested in seeing this - thanks for offering to share it.

framerate commented 4 years ago

Cool @MikalDev I'll see what I can do this week. I should be revisiting some of that code.

it's not that much code right now, but its like 20+ hours of work trying to figure out why Steam API was rejecting my requests (like they don't tell if you a POST is a body payload or a query param very clearly...)

But I figure I could abstract it to a core function, a tiny datalayer and wrapper functions for the calls I use (related to microtransactions) with some error checking... then maybe people can PR some more functions in 👍

kaansoral commented 4 years ago

I recently got my prototype up and running too, the real challenge was figuring out that you don't need to configure/pre-add anything to Steam - and the post-transaction auth flow could be kinda challenging for everyone's own unique environment, as you need to add an url to handle the transaction success callback, and manually approve it, then inform the user about the success etc.

framerate commented 4 years ago

Nice Kaan!

It's really great to see people using JavaScript and crazy ways like me.

Makes me feel a little less alone!