This is an example Payment Server for the Hedera Hashgraph public network. It acts as a payment gateway, allowing developers to more easily monetize of any type of content on the web via micropayments.
Hedera's example payment server was originally built for Hedera's community testing program, alongside example mobile wallets (iOS, Android), a WordPress plugin, and a chrome browser extension.
You can read a technical deep dive on Hedera's community testing program, written by Calvin Cheng, if you're curious to learn more.
We implemented a socketio based server that listens to a socketio event, in this case a CRYPTOTRANSFER
from our Hedera Browser Extension.
Next it will receive a cryptographically signed CryptoTransfer transaction object passed from the Hedera Browser Extension.
On receipt of the signed transaction object from the Hedera Browser Extension, this payment server will then proxy the transaction object to a node in Hedera Network, via a gRPC network call.
The gRPC response from Hedera Network will then be handled and pushed back to listening socketio clients via the CRYPTOTRANSFER_RESPONSE
event, in our example's case, a WordPress website and plugin.
While this Payment Server could be implemented in any language of your choosing, for our purposes, we choose to implement with node.js using the very popular express.js framework.
It also uses socket.io for persistent connections between the Hedera Browser Extension, this payment server, and clients wishing to interact with both.
Hedera Hashgraph's APIs are implemented in protobufs are used in this project, which you can learn more about here.
# node dependencies
npm install
# set up config/index.js by using the sample config/index.js.sample as reference
Hedera welcomes open source contributions to this respotitory, but please file an issue and discuss the improvements with one of the maintainers before beginning work.
We also suggest joining Hedera's Discord or Telegram chats, if you haven't already!
To learn more, visit Hedera Hashgraph's documentation at docs.hedera.com.