MultiversX Tracker is Live!

E-Commerce DAPP - handling shipping costs

Etherum Reddit

More / Etherum Reddit 153 Views

Hi everyone,

I am working on an e-commerce DAPP prototype that makes use of the Ethereum blockchain.

The user fills a cart of items, and purchase them in a single transaction using a wallet such as MetaMask.

I am still new to the technology and I've stumbled on the problem of calculating the shipping costs for the products.

I thought of using Oracles to dynamically calculate the shipping costs, but Oracles do not seem a great solution for such a dynamic request; unlike the ETH/USD data feeds where you can simply ask for the latest updated value and are updated on a time-basis, here the Oracle would have to calculate a custom answer for each cart beforehand, so it would add costs for the company that has to update the data on-chain for each cart request.

So I’ve thought, what if I simply add the shipping costs to the MetaMask transaction?

So basically, the items and their price are stored on the smart contract, and the smart contract calculates the total for the cart.

The shipment instead, is defined by the company and is not stored on the blockchain.

If the user has to pay 80$ of items + 10$ of shipping costs, the company webapp would set the MetaMask transaction to pay for 90$ (using dollars and not ETH for ease of understanding).

The company can then check how much the user has paid for the shipping.

Is there some sort of loophole I am missing to that?

I then see the following cases can happen:

  1. The company does not send the items, the user can request the 80$ back through the smart contract;
  2. The company sends the items, the user confirms the items when he receives them, all is well;
  3. The company sends the items, they are defective, the user does not confirm the items and requests the 80$ back through the smart contract;
  4. The user does not pay 90$ but only 80$ (doesn't use MetaMask, manually buy the items); the order would be registered in the smart contract, but the company sees that the user has not paid the correct amount for the shipping costs and decides to not send the item (obviously it would also notify the user for that). The user can still request its 80$ back through the smart contract.

So worst case scenario the user would lose the shipping costs, granted I don’t add another mechanic so that the user can ask a refund on that cost as well, and then the company will then have the right to accept such refund case by case.

It seems to me this approach kinda tries to minimize the risks for both actors, but I want to know your opinion on it. Perhaps there is a much better approach that slipped my mind.

submitted by /u/ihgyug3
[link] [comments]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments