Bitcoin Forum
May 26, 2024, 12:15:40 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to use crypto curency as game in-app-purchase payment?  (Read 261 times)
wsxdrfv (OP)
Jr. Member
*
Offline Offline

Activity: 405
Merit: 5


View Profile WWW
April 05, 2018, 07:29:41 AM
 #1

So in mobile phone Game (Android, iOS), PC game, how to implement that (title)?

In game, game company's specific crypto currency's address, QR code appears for payment receiving,

gamers see that, and send amount to that address, it should be automatically recognize and when it confirmed, game should automatically give item to users.

How this be done technically behind the scene?



Kogs
Member
**
Offline Offline

Activity: 86
Merit: 26


View Profile
April 05, 2018, 08:40:15 AM
 #2

So in mobile phone Game (Android, iOS), PC game, how to implement that (title)?

In game, game company's specific crypto currency's address, QR code appears for payment receiving,

gamers see that, and send amount to that address, it should be automatically recognize and when it confirmed, game should automatically give item to users.

How this be done technically behind the scene?

If you only want to buy items from the game company, the game company just creates an address on their server, and show you the QR code with the amount so the player can pay it. The server is checking if the coins were confirmed by the network and then would give you the items.
It is not necessary to implement any type of wallet inside the game itself.

If you also want that players them self are able to sell and buy in-game items with each other, I would add something like a SPV client into the game where each player control his own private keys. The game would create transactions automatically after the player confirmed the payment and then would exchange the item after the transaction got confirmed.
Instead of a SPV client you could also integrate a lightning client, which would allow cheaper micro transactions (what is usually the case in games).
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
April 05, 2018, 08:48:55 AM
 #3

So in mobile phone Game (Android, iOS), PC game, how to implement that (title)?

In game, game company's specific crypto currency's address, QR code appears for payment receiving,

gamers see that, and send amount to that address, it should be automatically recognize and when it confirmed, game should automatically give item to users.

How this be done technically behind the scene?

There are several possibilities to implement it.
You can either use a 3rd party service to process the payments or you do it yourself.

An example: Once a customer decides to buy an article, you request a new address from your local daemon (or take one unused pregenerated address)
and assign it to your customer in your database.
Then you display the QR and after the (correct) transaction has been received by your node and has the amnount of confirmation you decided to set,
you can afterwards release the digital item to your customer.

Im not sure 'how behind the scene' you are asking for.
But there are a lot of code snippets available on github which can deliver you an technical insight.


Cobalt9317
Copper Member
Sr. Member
****
Offline Offline

Activity: 434
Merit: 278

Offering Escrow 0.5 % fee


View Profile WWW
April 05, 2018, 08:57:41 AM
 #4

So in mobile phone Game (Android, iOS), PC game, how to implement that (title)?

In game, game company's specific crypto currency's address, QR code appears for payment receiving,

gamers see that, and send amount to that address, it should be automatically recognize and when it confirmed, game should automatically give item to users.

How this be done technically behind the scene?

It is all automatic in scripting your personal account have a personal payment addresses that will technically credit your account once a certain amount of funds was transferred to it, the steam have a built in data which also tracks your progress for example in dota2.

Look on the copper membership it has the same concept of automation.
cr1776
Legendary
*
Offline Offline

Activity: 4046
Merit: 1303


View Profile
April 05, 2018, 10:02:41 AM
 #5

So in mobile phone Game (Android, iOS), PC game, how to implement that (title)?

In game, game company's specific crypto currency's address, QR code appears for payment receiving,

gamers see that, and send amount to that address, it should be automatically recognize and when it confirmed, game should automatically give item to users.

How this be done technically behind the scene?

It is also relevant to know the cost of the purchases.  Unless it is expensive, you’ll also probably want to be using lightning in order to keep costs down and transactions instant.   Otherwise if bitcoin transaction costs increase or the number of transactions waiting spikes, your mobile gamers won’t have a good experience. 

I haven’t seen code snippets to implement this specifically, but it shouldn’t be tricky and the logic should be like the ones above.  Lightning though will be a critical part for a bitcoin payment - and since you asked here in the Bitcoin section not the alt coin area, that seems to be the plan.
Colorblind
Member
**
Offline Offline

Activity: 392
Merit: 41

This text is irrelevant


View Profile
April 05, 2018, 11:45:06 AM
Merited by suchmoon (1)
 #6

So in mobile phone Game (Android, iOS), PC game, how to implement that (title)?

In game, game company's specific crypto currency's address, QR code appears for payment receiving,

gamers see that, and send amount to that address, it should be automatically recognize and when it confirmed, game should automatically give item to users.

How this be done technically behind the scene?





In real world you really shouldn't. It's way easier and convenient for most games to create non-tradable currency because if it was tradable devs should have to deal with in-game economy. That's why you almost never can giveaway or trade "diamonds" in games like clash of clans and other mobile games.

In game currency does not need insane robustness and fraud protection so it's much more effective to store it in SQL rather then in some super complicated structure like Blockchain. 

The only viable application for blockchain I see for in-game currency is cross-developer currency that works and tradable between different games of different developers. Still the rules of it's creation should be defined very carefully.


TL/DR - you don't need to introduce real life economy in time-killer game.

 
nc50lc
Legendary
*
Offline Offline

Activity: 2422
Merit: 5640


Self-proclaimed Genius


View Profile
April 05, 2018, 11:55:15 AM
Merited by suchmoon (1), ABCbits (1)
 #7

Depends on how you coded your game's in-app purchase, you can partner with a 3rd-party wallet providers for an instant and zero fee transactions that users prefer or direct peer-to-peer that can receive funds even if the user is offline.

Examples:
  • 1. The game has a permanent receiving address for each account that automatically converts the received balance into coins/points.
    It's for a game so a unique address must be issued in every registered username (not like invoice)
  • 2. Integrate a 3rd party service like coins which process the transaction for you (off-chain), coins users won't be charged for tx fees in every top-up, the charge is between you and them depending on your contract.
  • 3. Or both of the two, add the second option like the "usual" payment options in every F2P games. You can add more 3rd-party wallet/service if you like.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
shahzadafzal
Copper Member
Legendary
*
Offline Offline

Activity: 1554
Merit: 2933



View Profile
April 14, 2018, 08:33:48 AM
 #8

So in mobile phone Game (Android, iOS), PC game, how to implement that (title)?

In game, game company's specific crypto currency's address, QR code appears for payment receiving,

gamers see that, and send amount to that address, it should be automatically recognize and when it confirmed, game should automatically give item to users.

How this be done technically behind the scene?
I guess you looking for a technical explanation?

I have been working in Payment Gateway solutions, like any other credit card payment there are number of Payment gateway solution offering crypto currency payment too they give you APIs and you simply initiate every time payment is need you get QR code or payment address where client is suppose to make payment. At same time you get event or you inquire using same address for payment confirmation.

In the backend payment gateway company handles the address generation and payment receiving confirmation. They will charge you some percentage of course.

But if want to create you own payment system let say for Bitcoin, then it will be more complicated and you really need to understand more technical things and setup your own bitcoind server and use JSON-RPC commands using the below API

https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

and this is for JSON RPC, there are example for almost all famous programming languages
https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)

Easier said than done! other then technical expertise there are many things you should be worried about and security might be the biggest concern you have to consider. So it's always better to use existing payment providers to minimize the risks at some cost.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
gnaaaa
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
April 14, 2018, 10:47:45 AM
 #9

Hi, not sure if you want to simply have the possibility to pay in btc or if you want to include the transactions on a chain (which means you can save the goods you sell in the game directly on the chain, and these good will become "property" of the users).

In this case, maybe you can migrate to an ethereum (or other smart contract like system) smart contract. In case you use eth, you can query the eth chain in app via web3 and infura (or set up a web3 server yourself).

If instead you want to use btc, as other say, you have to setup a payment service by your own (very risky) or pay an external one. Also keep in mind it will be slow and at risk of high fees (unless you use LN).

angry_runner
Jr. Member
*
Offline Offline

Activity: 162
Merit: 8


View Profile WWW
April 15, 2018, 05:25:10 PM
 #10

look on Ethereum smartcontracts. Smartcontract live in a Eth blockchain and done by the Eth VM. So as a output you have a contract address - where contract live(after deploy in a blockchain.) Then you can communicate with the smartcontract via different functions. Then in a website you can use Web3 JS library for the contract communications and call different methods. So it is a birdview how it works. Now I work under the TicTacToe game in a blockchain Smiley. It is very nice example how it works. Watch the final result in my Youtube channel.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!