elianaicgomes cross-posted this post in HivePay Merchants 3 years ago


Simple way to promote ๐Ÿ’ฒHIVE๐Ÿ’ฒ on your page ๐Ÿค‘

in The CTP Swarm โ€ข 3 years ago (edited)

I spent some time this weekend looking for a way to get into web3 stuff since it's really not my area, but I knew I couldn't help much, so I focused on a pretty quick example... easy enough for me.

Where it all started?

@forkyishere was going through the usual manjar of Twitter and suddenly found that HIVEPay could do something more than what he saw. So why not give it a try and show how easy it can be?

Immediately diagonally scrolled through the documentation page (https://hivepay.io/docs) and found the basic example quite easy to go for:

<form action="https://hivepay.io/purchase/" method="post">
    <input type="hidden" name="merchant" value="blainjones">
    <input type="hidden" name="item_name" value="Test Item 1">
    <input type="hidden" name="description" value="Test Item Description">
    <input type="hidden" name="notify_url" value="https://blainjones.com/notify/">
    <input type="hidden" name="return_url" value="https://blainjones.com/thankyou/">
    <input type="hidden" name="amount" value="7.00">
    <input type="hidden" name="base_currency" value="USD">
    <input type="hidden" name="merchant_email" value="me@blainjones.com">
    <input type="hidden" name="pay_currency" value="CTP,TOP10T,HBD">
    <input type="hidden" name="merchant_name" value="Blain Jones">
    <input type="hidden" name="cancel_url" value="https://blainjones.com/cancel">
    <input type="hidden" name="merchant_memo" value="Purchase Made By HIVEBUYER">
    <input type="submit" value="Purchase">
</form>

Note for readers: The above "merchant_memo" line didn't exist yet. ๐Ÿ˜œ

My target was to come up with a simple way to use that code somewhere for something as simple as a donation, and then I used something as ridiculous as (https://htmlsave.com/) to generate a page and do a test. It worked! I was already ๐Ÿ˜Š smilling here.

But I want more!

Ok, it was working but I did not know from who was the donation and I didn't want to go through the trouble of using and deploying an IPN Listener for the notifications (where later on I found to be where you can understand more about who sent the donation).

So, I headed to @hivepay-io Discord server (https://discord.gg/CPS9wd4WuK) to search for some answers. And on the help channel, I quickly went through my idea, and not many seconds after, the chat began with @blainjones. Very helpful and in minutes a solution was forged with my request. 24 hours later here I am writing a post about it to record the experience and let everyone find how easy this process of exploring can be.

@blainjones added the new field "merchant_memo" above which can then show which HIVE account send the transaction.

So I gave it a try with my own version (https://tryme.htmlsave.net๐Ÿ‘‰https://tryme.tiiny.site, valid for 7 days):

Hehe, have hacked the original button to be more indicative of what I wanted. Then, if you click that button (that is being hosted on the https://tryme.htmlsave.net I mentioned above) it redirects to the HIVEPAY service.

Here you can select the currencies you have allowed on the code. Also, where you will set your HIVE account for the donation to be sent. This was my 50 cents! ๐Ÿ˜

Then, after selecting one of the available payment options, the current value of the token will be calculated and displayed. I have used STARBITS token for this example (from @risingstargame).

HiveKeyChain request will prompt you and then after confirming you will get a quick link to visualize your broadcast to the blockchain.


https://hiveblocks.com/tx/b28488ded3c3bb6e50b000f25d5d1084f09b10ac

Note

While writing this post I have found a little bug in the detection of how many decimal places each Hive-Engine token has, and currently until fixed (HIVEPAY already informed) any token transaction that ends up (on the time of the calculation) with higher decimal places than what the token has, it will not work with HIVEPAY because your account broadcast will not be processed (it's like you did pay at all). Hence the STARBITS transaction above was actually not processed from my account to @hivepay-io, and I did another one with SIM ๐Ÿ˜Ž (that has 3 decimals) that worked. There is no security problem with this as long the merchant never provides the products until the transaction is verified (aka, that @hivepay-io really received the payment).

Above has been fixed โ˜โ˜โ˜


(@hivepay-io account)

To complete this example, I have created two posts (pages) with @forkyishere (no payout please), to use them as a success page (the thank you) or in case you would cancel.

And voilรก!

My code!

What I actually used for the example in this post.
If you wanna give it a try ๐Ÿ‘‰ https://tryme.htmlsave.net (https://tryme.tiiny.site) will last for 7 days!

<form action="https://hivepay.io/purchase/" method="post">
    <input type="hidden" name="merchant" value="forkyishere">
    <input type="hidden" name="item_name" value="You are donating to Forky!">
    <input type="hidden" name="description" value="Do you like what Forky (@forkyishere) is doing? Show some appreciation by donating 50 cents in form of any token listed bellow! Forky will reply back via the HIVE blockchain!">
    <input type="hidden" name="notify_url" value="https://hive.blog/hive/@forkyishere">
    <input type="hidden" name="return_url" value="https://hive.blog/hive/@forkyishere/thank-you">
    <input type="hidden" name="amount" value="0.5">
    <input type="hidden" name="base_currency" value="USD">
    <input type="hidden" name="merchant_email" value="">
    <input type="hidden" name="pay_currency" value="SWAP.DOGE,SWAP.EOS,SWAP.BTC,SWAP.LTC,LEO,SIM,STARBITS,CTP,PIZZA,LEN,BEER,WEED,BUDS,ASH,HIVE">
    <input type="hidden" name="merchant_name" value="Forky!">
    <input type="hidden" name="merchant_memo" value="Donation from HIVEBUYER">
    <input type="hidden" name="cancel_url" value="https://hive.blog/hive/@forkyishere/that-s-alright-see-you">
    <input type="image" src="https://images.ecency.com/DQmcHQi6zji1adP29WXNpaBAwYn8syzg2JQHLgXC8vL2tXw/donate_hivepay.png" alt="Donate With HivePay">
</form>

And looks like that's it ๐Ÿ‘Œ

Learn new things, play blockchain games
and don't forget to have lots of fun!




(credit @doze) ๐Ÿ‘†โ„น๏ธ


Cryptocurrency ๐Ÿ’ณCards

Crypto.comCrypteriumTenX (retired)Revolut (wen?)Wirex (fuckdup)

by @forykw