How do I create a counter like bitqa.app uses that increases the “Answer: 0” count and stays?

I’m a programming noob trying to build a website using Money Button and BSV blockchain. I need help (or a visual of code) writing code that increases a number on the page after the Money Button is swiped. Just how “Answers: 0” gets increased by +1 on bitqa.app after paying. I hope $5 bounty for best answer is enough. Thanks in advance!

Submit an answer See answers Share on Twitter Share on Facebook
Answers
Accepted Answer

Accepted: It depends...

Your question is a bit vague… You didn’t specify the language used (I assume it is JavaScript, but it could be plain JS, React, something else,…), whether you also have a backend or not, what the counter is actually counting, …

On a very basic level there is an onPayment() callback that MoneyButton let’s you use to react on the payment that has just happened. You can use that to update the counter on the page. See MoneyButton docs for more info.

When it comes to actually calculating the counter value you will have to provide some more info. Is it something that you have in some kind of database, do you want to count something on the blockchain, are you counting something that is stored in local storage of the browser,… All of those are possible, but the approach one would take is different.

You are creating this answer as an anonymous user. If you log in we will be able to store the draft as you write it.

Submit an Answer

By swiping I acknowledge that the answer will be immutably stored on the Bitcoin SV blockchain forever and that I take full responsibility for any legal or other consequences that might be related to that.
Made with in Slovenia.