Wondering how to use blockchain for your e-commerce? Here is a simplistic showcase applying the features of blockchain and cryptocurrency in ecommerce.
Find out how crypto currency can be integrated in different layers of your e-commerce processes. For example, to improve security in the fight against frauds and to enable great technological features like instant payments that preserve your customer’s privacy.
For better clarity, this article also contains a showcase implementation of the integration of blockchain features and cryptocurrency for your e-commerce. If you are impatient, head over to Github to find the source code for MiniCommerce.
The Following topics will be discussed in this article:
Table of contents
- What is a cryptocurrency?
- 4 ways to use blockchain for your e-commerce
- Introducing MiniCommerce: Your own crypto commerce
- How to create online coupons with cryptocurrency?
- How to accept payments with blockchain networks?
- How to detect chargeback fraud with blockchain networks?
- Benefit from blockchain for your e-commerce
What is a cryptocurrency?
Cryptocurrency is an internet-based medium of exchange which uses cryptographical functions to conduct financial transactions, and publish digital signatures in a distributed [append-only] database – a.k.a a blockchain. There are many ways to use blockchain for your ecommerce but first, let’s try to understand what cryptocurrencies do.
Most of the cryptocurrency projects are not controlled by a central authority as their issuance is programmed into a software protocol. Thus, sending cryptocurrency from one account to another, theoretically, is a one-click feature – much to the power of businesses and other users that want to integrate blockchain in their ecommerce.
After many years of failed attempts at creating digital currencies, e.g. Digicash, Bitcoin stood up as the first-of-a-kind solution to the problem, using peer-to-peer technology and public key cryptography. Similar to well-known peer-to-peer networks for file sharing (e.g. BitTorrent), Bitcoin uses a distributed network to circumvent the double-spending problem.
The terms “double spending” are used when the same money is being spent twice. It is a well known fact that cash, for instance, cannot be double spent. Cryptocurrencies are fully digital, and as you may well know, anything that is digital can also be copied. In earlier digital money systems, a central authority (i.e.: a company) would act upon your balance to make sure that balances cannot be double spent.
This is where cryptocurrencies are different as they present an alternative solution that leverages peer-to-peer networks to communicate about the integrity of the network. Integrity of data is ensured using public key cryptography, which when data is being tampered with, makes it obvious to the whole network. With the correct tooling, it is easy to verify the integrity of a cryptocurrency transaction, similarly to how you would verify the origin of an e-mail (i.e. with PGP).
4 ways to use blockchain for your ecommerce
You may wonder how we can leverage blockchain and ecommerce crypto. Here are 4 ways you can benefit from blockchain to improve an ecommerce business.
Online coupons
Online coupons can be considered as ecommerce crypto. They are a great way to boost sales of ecommerce business by rewarding loyal customers and giving incentives for potential buyers.
Watch out for the Couponise command in the showcase source code below.
Trail integrity
Given its attributes of preserving data integrity, blockchain can be leveraged to audit chain of supplies or produce audit trails for your sold products. More about this in our article: How to use blockchain to tokenise your supply chain?.
Fraud protection
As we explained previously, cryptocurrencies address the problem of double spending using a peer-to-peer network. This is particularly useful when accepting payments from customers because given the public nature of cryptocurrency, it is always possible to find out about chargeback fraud attempts. The software protocol actually can serve as fraud protection for your ecommerce website.
Borderless payments
Sending payments cross-borders is not always as simple as it could be. Using cryptocurrency, there is no borders because there is no single authority that governs over said currency. Watch out for the AcceptPayment command in the showcase source code below.
Introducing MiniCommerce: Your own crypto commerce
Now that we defined what possible integrations we can do of blockchain technology for your ecommerce, let’s analyse a more precise showcase of these as defined in UsingBlockchain/BlockSnippets, where we published a MiniCommerce command that is our minimum viable product for the integration of blockchain for your e-commerce.
First and most important, we have to create a digital business, as it is usual with our showcase implementations. This is to prevent loss of data when using blockchain technology, as our showcase packages store simplistic backups of data in JSON stores. Similarly as in our article “How to use blockchain for your business?“, we will create a digital business for your ecommerce, as illustrated below:
$ BlockSnippets MiniCommerce Create -n “Your e-commerce Name”
It is important to understand how sensitive data must be secured. Yet, this is probably a topic for another post. Please note that, using secure encrypted drives and other encrypted devices to store sensitive data is more appropriate than what is done in our simplistic showcase.
Sensitive data that is stored with MiniCommerce is always encrypted with a password. Yet, we recommend to use more secure file storage practices such as encrypted hard drives.
Back to our …horsesblocks: the first showcase implementation consists in creating online coupons for your customers.
How to create online coupons with cryptocurrency?
Creating online coupons can be done in many ways with the software packages available today. Also, you can create coupons to represent discounts on your products, but you can also create coupons that can be redeemed for your services. As such, the actual production implementation of online coupons will probably be quite different than the below.
Nevertheless, the following showcase implementation uses transactions on a Symbol blockchain network to represent quote requests. This type of online coupon can be used by your customer to request your services, scanning just a QR-Code.
Following is our simplistic example:
/**
* This concern creates a “price quote request” coupon
* which consists in sending a message to the owner of
* the e-commerce.
*
* When your customers scan the resulting QR-Code, all
* they need to do is to sign the digital contract and
* you will be notified on your blockchain account.
*
* :note: This type of QR-Code can be freely shared with
* others because it doesn’t contain any sensitive info.
*
* @param CommandLineArgument inputs A list of command line arguments (see SnippetInputs).
* @return DigitalContract The digital contract representing the online coupon. Share it!
*/
public execute(
inputs: CommandLineArguments,
): DigitalContract {
// – All transactions will be bundled in one contract
let transactions: Transaction[] = []
// – (1) Prepare a pre-formatted message
const formattedMessage = ‘Price Quote Request for ‘
+ this.quantity
+ ‘ ‘
+ this.product.sku
// – (2) Sends a message to the e-commerce governor
const productRequest = getTransferTransaction(
this.owner.getPublicInfo().address,
undefined, // (3) no assets added
undefined, // (4) empty quantity
formattedMessage,
);
transactions.push(productRequest)
// – (5) Setup our distributed governance digital contract.
// A digital contract consists in one or many transactions
// that are all executed together (atomically).
return getContract(transactions);
}
Source: Couponization concern in MiniCommerce, part of BlockSnippets by Using Blockchain Ltd.
As usual, let’s inspect the above snippet of source code. We added a doccomment on top to illustrate the idea of sharing price quote requests in the form of Symbol transactions.
Going on, in (1) we prepare a pre-formatted message, this has the same effect as formatting your E-Mail subject when an order comes in with WooCommerce. In this example, we use a message similar to: Price Quote Request for 3 UBC-21-BOOK-00002.
This message is then attached to a transfer transaction as illustrated in (2). The recipient of this transaction is the owner of the e-commerce. Also, as illustrated in (3), we don’t attach any digital assets, nor do we attach a quantity (4). The transfer transaction that is created, only holds a message to the owner of the e-commerce.
Because a transaction on Symbol blockchain networks must be signed digitally, the owner of the e-commerce can identify the customer by their public key. In (5), we go on to define a digital contract that holds our transfer transaction.
This is already it about this online coupon showcase. In practice, your customers would scan the resulting QR-code – that is, after you shared it with them – and sign the digital contract and either send you a signed copy of the digital contract or use a Symbol blockchain network to publish the digital signature online.
How can ecommerce platforms accept payments with blockchain networks?
This next showcase is one of the simplest use of blockchain technology. In fact, blockchain networks do the processing of transactions for you. This means that you just have to share your digital address with your customers and the payments can be accepted in a matter of seconds.
In the following showcase implementation, we generate a QR Code that contains a transfer transaction where the recipient is the owner of the ecommerce. Also, we attach a quantity of digital assets equal to the price of the product.
We use the cryptocurrency XYM for which you can find all information here. You can replace this digital asset with any other Symbol mosaic in the following:
/**
* This concern creates a payment requests QR Code for
* specific products. It attaches a quantity of assets
* that is equal to the price of the product.
*
* When your customers scan the resulting QR-Code, all
* they need to do is to sign the digital contract and
* you will be notified on your blockchain account.
*
* :note: This type of QR-Code can be freely shared with
* others because it doesn’t contain any sensitive info.
*
* @param CommandLineArgument inputs A list of command line arguments (see SnippetInputs).
* @return DigitalContract The digital contract representing the payment request. Share it!
*/
public execute(
inputs: CommandLineArguments,
): DigitalContract {
// – All transactions will be bundled in one contract
let transactions: Transaction[] = []
// – (1) Prepare a pre-formatted message
const formattedMessage = ‘Payment Request for ‘
+ this.product.sku
// – (2) Define which cryptocurrency is accepted
const digitalCurrency = new NamespaceId(‘symbol.xym’)
// – (3) Sends a message to the e-commerce governor
const productRequest = getTransferTransaction(
this.owner.getPublicInfo().address,
digitalCurrency, // (4) Paid with XYM
this.product.price, // (5) Price depends on the product
formattedMessage,
);
transactions.push(productRequest)
// – (6) Setup our distributed governance digital contract.
// A digital contract consists in one or many transactions
// that are all executed together (atomically).
return getContract(transactions);
}
Source: PaymentProcessing concern in MiniCommerce, part of BlockSnippets by Using Blockchain Ltd.
As usual, let’s inspect the above snippet of source code. We added a doccomment on top to illustrate the idea of sharing payment requests in the form of Symbol transactions.
Following along, in (1) we define a pre-formatted message similar to: Payment Request for UBC-21-BOOK-00002. This message is not obligatory and can be removed, we use a message to more easily identify the transaction in a long transactions list.
Next, in (2) we define a cryptocurrency that we want to accept as payment. In this example, we use symbol.xym for which you can find price information here.
The step (3) is about creating the actual transfer transaction. We set a recipient – i.e. the owner of the e-commerce – and we attach the XYM digital asset in (4) with a quantity equal to the price of the product (5). Because a transaction on Symbol blockchain networks must be signed digitally, the owner of the e-commerce can identify the customer by their public key. Eventually, in (6) we go on to define a digital contract that holds our transfer transaction.
The showcase creates a QR-Code that you can share with your customers. Customers who own enough of the XYM cryptocurrency can then pay for your product by signing the digital contract and sending it to you or using the Symbol blockchain network to broadcast the signed transaction.
When the signed transaction is valid and gets announced on a Symbol blockchain network, the owner of the e-commerce will be credited the correct amount of XYM – as such, the processing of said payments really happens online and without required action(s) from the owner of the ecommerce.
How to detect chargeback fraud with blockchain networks?
This one is very simple, as well. That is because any transaction in a blockchain network always requires a digital signature of the owner of said cryptocurrency. In a chargeback fraud scenario, your customer would 1) send you a cryptocurrency amount, and then 2) request a chargeback for the same cryptocurrency amount.
Blockchain networks inherently protect you against this chargeback by the fact that it requires your signature. There is of course, other types of chargebacks that are possible to achieve, with more knowledge around distributed networks. An attacker could for instance create a separate Symbol blockchain network – a.k.a fork the network – and use his own network’s accounts and transactions.
This would be more than obvious for you, though. Because, in practice, when you would try to send the transaction on the blockchain network of your choice, your client app (i.e. Wallet) is most likely to tell you that you are being redirected to a different network – i.e. as does Facebook, when you click an external link. It is trivial for software to determine if the transaction was created for the correct network, that’s the point.
It is also trivial for you to verify this, provided that you have the correct tooling available, which may not always be the case when you only want to accept payments. We recommend that you seek professional advise, before your company can work with cryptocurrency.
Ecommerce crypto: Benefits from using blockchain for your ecommerce
Blockchain can be used and integrated at different levels of your ecommerce processes, i.e. to improve security and transparency, or to enable easier digital access to your products. We think using blockchain for your e-commerce protects your business from fraud and has the potential to enable great technological features like the payment request example from above.
You can use blockchain projects as an instrument of truth for your ecommerce. One, that is distributed and open for anyone to use. The incentivization strategies around blockchain networks may differ from one project to the other, but the principles of immutability of data and that of preserving data integrity are usually respected by all blockchain projects.
The full source code for this e-commerce showcase of using blockchain can be found in: UsingBlockchain/BlockSnippets MiniCommerce Command.
We hope that this article was insightful for you and are looking forward to any feedback and messages. Please share your thoughts in the comments section below!
Disclaimer
This website may contain information about financial firms, employees of such firms, and/or their products and services such as real estate, stocks, bonds, and other types of investments. While this website may intend - as the author deem necessary - to provide information on financial matters and investments, such information or references should not be construed or interpreted as investment advice or viewed as an endorsement.