Hi Carlos,
Nice! Thanks for the interest and your contribution. I haven't had a chance to try your function yet.
I get the idea about server side verification of transactions but I'm not too sure about the inventory stored on the blockchain idea. That could get quite expensive just to manage product data on-chain and also add many technical challenges on top of basic CMS integration for a regular product catalogue.
Additional transaction verification is a good idea at some point in the online order process. This is something that should probably happen at the end of the transaction process and/or in the CMS/Cart back-end to show admins which orders have valid payments.
Currently, StellarCheckout just dumps the transaction / payment result as the payload for the submit handler. This is supposed to be saved with the order item on the server so additional verification can happen as part of a greater process. So currently, the server will just know about a transaction but this may have to be extended to include for example, lumen price at time of transaction, and any other additional data that will make server side verification easier.
One of the goals of StellarCheckout is trying to make it standalone as much as possible so I didn't want to have a dependency on any server side verification code I controlled.
I do run a basic and pretty verbose transaction verification client side. This is run in response to receiving a message from a server sent event in the payment stream so I'm not sure if this can be tampered with by a rogue actor or not.
So I like the idea Carlos, but I'm not too sure if the StellarCheckout plugin-in needs to handle this. I'm leaning towards this being a job for the server side devs to write in their language of choice in their chosen environment.
What are your thoughts?