Sign In Register

How can we help you today?

Start a new topic
Answered

In App Purchases

Transferred from the ticket system.


Hi,


Firstly, well done on this excellent service!


Im on the final stages of completing my game, and am stuck on implementing the In App Purchases!


I have gone over all the documentation and can't find anything to actually get the user to purchase (with real money).

I want a system so that the user can click on a button and purchase 200 coins for £0.69. But so far all i have found is that we have to validate a receipt, not how to receive the receipt! I have set up IAP for all of my other apps before using Prime31. So can you please let me know how to set up the above. I have already got a product in iTunes and have set the productID in the portal.





Best Answer
Hi there,

You will need to validate the receipt against the GameSparks service using IOSBuyGoodsRequest. The receipt should be issued by Apple, you are looking for  SKPaymentTransaction number. The IOS product ID should also be linked to the virtual good on the backend.

Here is the API reference in the documentation

https://docs.gamesparks.net/documentation/request-api/store-request-api/iosbuygoodsrequest


Hope this helps,

Jamie

 


Answer
Hi there,

You will need to validate the receipt against the GameSparks service using IOSBuyGoodsRequest. The receipt should be issued by Apple, you are looking for  SKPaymentTransaction number. The IOS product ID should also be linked to the virtual good on the backend.

Here is the API reference in the documentation

https://docs.gamesparks.net/documentation/request-api/store-request-api/iosbuygoodsrequest


Hope this helps,

Jamie

 

Im using Unity.


So do i need to get another plugin (Prime31) or is there a way to do purchases using Gamesparks?


Abdullah

No need for additional plugins if I'm not mistaken, the IOSBuyGoodsRequest is called the following way:


 

		new IOSBuyGoodsRequest ().SetReceipt("Reciept ID").Send ((response) =>
		                                         {
			//If our response has errors we can check what went wrong
			if (response.HasErrors)
			{
				Debug.Log(response.Errors);
				
			} else {
				Debug.Log ("Works");
				
			}
		}); 

 

ye but how do we get the Receipt Id? do we have to make a native call to the Storekit? 

In the API reference

https://docs.gamesparks.net/documentation/request-api/store-request-api/iosbuygoodsrequest

it says that "The receipt obtained from SKPaymentTranscation", so yes I suppose so.

From the plugin you are using register for purchaseSuccessful event which returns transaction receipt.

Where does the money goes to after the player purchase something in the game I'm creating?

Hi Ines,

The money goes to wherever it was setup to go in GPlay/iOS/Windows.
GameSparks validates the receipt and unlocks whatever was purchased.

So if the same account moves platform they can still have everything unlocked.

Oisin.

I didn't understand how you get the receipt then? Do you have to have a plugin to do that? I'm looking to Soomla but I think what they do is what gamesparks does for virtual goods.I'm not sure if that is what I need.

Hi Ines,


The following is a breakdown of how real money transactions are handled:

  1. The player requests a purchase to be made within the Game Client. 
  2. The Game Client calls the Store API on the device to process the transaction. 
  3. The Store API responds with a receipt. 
  4. The Game Client sends the receipt through to the GameSparks platform. 
  5. The GameSparks platform validates the receipt and adds the purchased Virtual Goods to the player’s profile.

In the case of iOS, the receipt is received from SKPaymentTransaction transactionReceipt.

Thanks.

Oisin

Hi Oisin,


Ok I understand now how gamesparks work. 

The thing is that I'm stuck right now is in the first step. Is there a plugin that I need in Unity to request the purchase? I'm using Google Play by the way.


Thanks.

Hi Ines,


There are a number of plugins that will tie into Google Play Game Services which are capable of making the actual transaction with Google.


There is a free option with Unity support:


OpenIAB Unity Plugin


It supports Android (and many of it's stores) as well as iOS and Windows Phone. That said I haven't tested this one personally.


When the transaction is complete, you should be provided with a transaction receipt. You pass that into the GooglePlayBuyGoodsRequest and we will verify the receipt with Google and add the Virtual Goods to the player's account.


Shane

I look to some of them. Soomla is free but don't give me access to the receipt, I would need to change their code. And I didn't want to pay for a plugin without knowing that it would work. I started to look to OpenIAB yesterday, I'll try to implement that. If it works I'll tell you.

I'll be testing myself by this time tomorrow and will share any information I find.


Shane

Login to post a comment