An open-source SDK
empowering you to directly accept
cryptocurrency and stablecoin payments
free from centralized fintech infrastructure
StablePay is a fully decentralized solution for online payments. When the StablePay widget is embedded in a website, the widget interacts directly with smart contracts on blockchains, with no intermediary servers.
StablePay allows payments to be made either via the native cryptocurrency of the underlying blockchain or via decentralized stablecoins backed by these native currencies. StablePay also allows automatic conversion between the two. For example, a consumer may pay using a native cryptocurrency, but the merchant receives the payment in a stablecoin backed by that cryptocurrency. The conversion happens automatically, by interacting with the stablecoin contract to mint stablecoins.
Currently, stablecoins based on the Djed stablecoin protocol deployed on EVM-compatible chains are supported.
The StablePay widget itself is located in the stablepay-sdk folder. It makes use of the Djed SDK to interact with Djed stablecoin contracts. The Djed SDK is located in the djed-sdk folder.
The main files of the Djed SDK and their purposes are:
- djed/stableCoin.js - contains functions to build transations that buy and sell stablecoins.
- djed/reserveCoin.js - contains functions to build transations that buy and sell reservecoins.
- djed/djed.js - contains functions to connect to the Djed contracts and to the ERC20 contracts for the stablecoins and reservecoins.
- djed/system.js - contains functions to fetch the parameters and state variables of the Djed contracts and of the user.
- oracle/oracle.js - contains functions to connect to the oracle contract used by a Djed contract.
- constants.js - contains configuration constants.
- web3.js - handles wallet connection.
A simple example merchant website with the StablePay widget embedded is available in the StablePay-MerchantWebsiteDemo.
