OPEN
Shares

Open Platform WooCommerce Integration

Shares

Open Platform, in conjunction with Open State, allows you to access powerful interoperability features that can help grow your online business. Beyond a proof of concept, we have created the Open Platform Payment Gateway plugin in WordPress for WooCommerce. So, if you are an ecommerce application developer or have an ecommerce application that sells products, this is a great fit.

We built Open Commerce with our latest interoperability technology.

We also made it easy to install this plugin to utilize our new blockchain interoperability tools in your business. This means you can take payment using any blockchain’s cryptocurrency without having to create new wallets for every blockchain and track for every transaction.

Open Platform will create wallets using hierarchical deterministic (HD) wallet structure by Trust Wallet, another great open source solution (
docs here). From the point of view of an end user, a customer makes a payment in which Open State will track wallet address transactions and let you know about any ongoing transactions with a webhook call.

Currently, Open State is able to track transactions from Bitcoin, Ethereum and Binance Smart Chain. Also, it can track the most popular stablecoins like USDT, USDC, and BUSD. If developers or customers decided not to use our widget for this functionality, they would have to use the native solutions. For example, for Ethereum they must use
https://etherscan.io/, for BSC they must use https://bscscan.com, and for BTC they must use https://www.blockchain.com/explorer. So, by using our widget, customers can track all of these transactions from different chains in only one page with a webhook call.

 

 

Here is an explanation of HD wallets, as per this technical article:

“Wallets that carry the functionality to derive many different addresses from a single access point are called HD wallets, which stands for Hierarchical Deterministic wallets. When these wallets are first generated, a root seed or key is derived. This is the foundation seed from which all branches and addresses will stem from in a given wallet. In most cases, this key is derived from an entropy standard of 128 or 256 bits. The higher the entropy, the more randomized and secure this seed is. When you connect through your HD wallet, some wallets use slightly different paths for connection. Each path will generate a completely new list of addresses, relative to your root private key. That’s why it’s important to keep derivation paths in mind when troubleshooting issues regarding addresses accessed with hardware wallets. 

For example, the general path for connecting to the base Ethereum set of addresses looks like this: m/44’/60’/0’/0. Trezor, MetaMask, Digital Bitbox, Jaxx, and Exodus, MEWconnect are just a few HD wallets that use this path. This sequence is broken down into different sections and changes based on what you’re working with. 

The sequence goes: m’ / purpose’ / coin_type’ / account’ / change / address_index. Any change to that path number or sequence will completely alter the addresses you expect to see. Ethereum Classic takes a different path, using this sequence: m/44’/61’/0’/0. Then hardware wallets like Ledger take an even more varied sequence specific to Ethereum Classic: m/44’/60’/160720’/0.”

Here is a brief summary of Trust Wallet:

  • It’s open source
  • It’s a widely recognized software wallet
  • Binance acquired Trust Wallet in June 2018 and it is maintained and updated by the Binance team
  • It supports a large range of cryptocurrencies 
  • It offers multiple crypto assets for staking (Trust Wallet token)
  • It does not charge any initial fees or subscription charges
  • It has over 5 million active users across the world

The figure above gives you a sneak peek of our system architecture and how services communicate with each other. More on this later. 

To help you get started so that your business can benefit from Open Platform’s interoperability features and WooCommerce integration, we are providing you with a comprehensive step-by-step guide below. So let’s get started!


GUIDE

Step 1: Create a New Application in Open Platform

  1. Go to the Open API (api.openfuture.io)
  2. Login or sign up with your Google account
  3. After successful login, you will be redirected to the Open Platform home page

  1. Click on Applications in the top menu bar to see a list of created applications

      5. Click the Add Application button to create a new application. The Application Name and Webhook fields must be filled in.              The webhook is used to send notification invocations.

  1. If you click on any application in the applications list, you will see detailed information for the application you select.

Please note that:

Access and Secret Keys are used by third-party integrations like our WordPress plugin. Users can update their keys in case someone else accessed those keys.

Wallet Addresses are either generated by third-party integrations like our WordPress plugin or by users who can also generate various blockchain addresses.

Private addresses and seed codes are saved in Open Key. After successful wallet generation, its public address will be pushed to Open State to track any payment transactions for the current address. In the diagram above, we can see 3 parts of Open Platform integrated. The user sends a wallet creation request to Open API. Open API then sends requests to Open Key. After wallet generation, Open Key returns only public addresses to Open API. The last step is that Open API will send a public address with an application webhook address to Open State. From that stage, Open State starts to track transactions, and if there is a transaction, Open State will invoke a webhook notification. Our current architecture can track interoperable blockchain transactions, and later definitions.

Here are the GitHub code links to the aforementioned components of Open Platform for your reference: 

Open API: https://github.com/OpenFuturePlatform/open-api

Open State: https://github.com/OpenFuturePlatform/open-state 

Open Key: https://github.com/OpenFuturePlatform/open-key

WooCommerce Plugin: https://github.com/OpenFuturePlatform/open-wc-plugin

Step 2: How to Integrate the Open Platform Payment Gateway Plugin in WordPress 

  1. In WordPress (with WooCommerce already installed), go to Plugins

       2. Click the Add New button and search for ‘Open Platform Payment Gateway’. In the search results page, you will see the                     Open Platform Payment Gateway for WooCommerce.

       3. Click Install Now and then activate the plugin. After doing this, you will see that the plugin is activated.

        4.  Now go to the WooCommerce > Settings > Payments menu to integrate with Open Platform

        5. Enable Open Platform Gateway and then click Manage to manage configurations

  1. Paste in the Access and Secret Keys from the Open Platform application you created earlier. If the user wants to test, test mode should be enabled. The Blockchains field shows which blockchains the user wants to accept payments in. Also, users can enable logging so that they can see debug logs.

Step 3: How to Use the Plugin in a Simple E-commerce Website

  1. Add a product to your cart

      2. Then, click proceed to checkout. Customers can see the Open Platform Payment Gateway as a default payment gateway to                 proceed with.

       3. After a customer clicks place order to make a purchase, they will be redirected to Open Widget

  1. Within Open Widget, information about the order amount, remaining amount, and 1 hour countdown can be seen on the left. Customers must make payments during this countdown period. On the right, the customer will see generated wallet addresses. These addresses are actually generated by Open Platform. 

Please note that if the user enabled test mode and chose Ethereum and Binance, Open API generates two addresses and connects to Ropsten and Binance Smart Chain test networks.

Step 4: How to Track Blockchain Payments

      1. Let’s make a payment using Metamask to a Binance address

  1. After a successful transaction, our widget is automatically updated

  1. Now, let’s make a payment using Metamask to a Ropsten address

  1. After a successful transaction, our widget is automatically updated

  1. You can also see the transactions by clicking on the addresses

  1. If the customer made the payments in full, the status will be updated to completed

How Does This All Work?

The WooCommerce system will send a request with a signing request body with the secret key. Also, in the request header, it will send a signed request body and public access key of the application. Additionally, in the body, there will be metadata of products. Metadata are order id, product currency, and payment currency with a timestamp. A simple request template will look like the below curl request:

curl –location –request POST ‘https://api.openfuture.io/public/api/v1/wallet/generate’ \

–header ‘X-API-SIGNATURE: 06b2dd66812aef2e18ac4de998fa69adb541f372abb942ff7262915e085a3576’ \

–header ‘X-API-KEY: op_jGbshr6NCZvQM2rpX4+8’ \

–header ‘Content-Type: application/json’ \

–data-raw ‘{

    “timestamp”:“1650258362”,

    “metadata”:{

        “amount”:“10.00”

        “orderId”:“1”

        “orderKey”:“wc_order_8WtVNDm4E3usj”

        “paymentCurrency”:[“ETH”],

        “productCurrency”:“USD”

        “source”:“woocommerce”

        “test”:true

    }

}

After the request, Open API will send a request to Open Key for generating wallet addresses with payment currencies chosen by the customer. Then, generated addresses will be pushed to Open State to start tracking blockchain transactions. At that moment, Open State will get rates for the given payment currency and product currency from Binance API, saving it to its database. If there is a transaction for generated addresses, it will get it and convert it to the product currency with saved rates and then send a webhook to the customer with the relevant information. Open API has a payment tracking widget page where customers can track their transactions and also pay for the product from that widget page with the MetaMask extension for browsers. So the idea is you don’t need any third party applications to track and pay in cryptocurrencies, you just need to install the Open Payment Gateway plugin as it has everything you need in one page.

We get rates when customers make payment for all allowed blockchains and provide them in a given time period to finish their payments. 

Open State Architecture (https://github.com/OpenFuturePlatform/open-state/wiki)

What We’ve Accomplished and Next Steps

So far, the development team has completed the following milestones to help your business applications through the Woocommerce plugin:

  1. We have built tools to allow you to create an Open Application and Open Key
  2. We have created the Open Platform Payment Gateway plugin in WordPress for WooCommerce
  3. We have created an Open Platform integration with third-party libraries like the Open Platform Payment Gateway plugin in WordPress
  4. We have built Open State tracking for interoperable blockchain payments

The team is hard at work to bring additional developer tools for application developer needs. Here is a glimpse of what we’re looking at and what is to come:

  1. Implementation of Customer Wallet integration, so customers can, at the same time, generate wallets by using Open API or import their own wallet addresses
  2. Adding more blockchains for payments, including but not limited to Polkadot and Solana
  3. Adding a Metamask connection to Open Widget
  4. Creating a unique SDK for all languages, so that developers can use our interoperable blockchain payment gateway

Stay tuned for more updates!

 

About the Author open