by HVStudios » August 24th, 2013, 1:49 am
by Pawel Wozniak » August 24th, 2013, 2:14 am
by Guillaume » March 28th, 2014, 4:48 pm
by Henrik » March 30th, 2014, 2:06 am
by Guillaume » March 30th, 2014, 2:20 am
by Guillaume » September 10th, 2014, 12:20 pm
by robscherer123 » September 10th, 2014, 1:44 pm
by Guillaume » September 10th, 2014, 2:07 pm
by Guillaume » September 28th, 2014, 4:29 am
by jasonredhawk » January 11th, 2015, 9:24 pm
by Guillaume » January 11th, 2015, 10:05 pm
by jasonredhawk » January 11th, 2015, 11:36 pm
by Guillaume » January 12th, 2015, 2:09 pm
public void SendReceiptToPayVault(ReceiptDeserialize currentReceipt)
{
try
{
//Assume client is a reference to an already connected Client.
//Pass signed data and signature to useBuyInfo
Dictionary<string, string> info = new Dictionary<string, string>(2);
info.Add("inapp_signed_data", currentReceipt.json);
info.Add("inapp_signature", currentReceipt.signature);
client.PayVault.UseBuyInfo("googleplayv2", info, delegate(Dictionary<string, string> result)
{
//Yeah ! If we are here, that mean that everything is OK for Payvault !
Debug.Log("Receipt successfully sent !");
//Warning ! YGNBiller does not exist in PlayerIO, it's just a bridge class I have made to avoid different code base in method like this one for Flash / Webplayer versions and Android / Ios
//Since everything is ok (Google Play and Payvault) you can say to your game to give the desired bought product.
//You can do that manually if you want. Here, GetCallbackById search for the given id and execute the success method for this Id.
//This way, you have only ONE Payvault (for Android) Method, it's generic, only the content of GetCallbackById is specific. You may do something better than that !
YGNBiller.GetCallbackById(currentReceipt.productId);
//You can ignore this line. In my implementation, every Google Play or iOS purchase are stored in the save if for some strange reasons, they were never validated on Payvault.
//Because the statut is unknown (Maybe internet is gone during the process), theses Purchases are queued, and will be validated at next startup, then removed from the save when verified.
//This way, users can't complain that they have "lost" a purchase. Think of Atomicity in your Purchase Workflow. This is one strategy.
//Has you see here, and because we are on the success method of Payvault, this line only remove the current "Unknown" queued purchase.
unvalidatedReceipt.Remove(currentReceipt);
//Updating the local save of the game with new products, if not done yet !
Save();
}, delegate(PlayerIOError error)
{
//If we are here, that mean that there was an error or that the receipt is invalid from Payvault server side verification
//Nothing happen here. No "Success" popup or anything more for the player because the transaction doesn't have finished right. Game continue normally.
Debug.Log("YGN responded with an error to the Receipt...");
});
}
catch (PlayerIOError e)
{
Debug.Log("Fatal exception in ReceiptService");
//Handle error as you wish
//Nothing happen here. No "Success" popup or anything more for the player because the transaction doesn't have finished right or something bad happened in code.
//Game continue normally. But if in this case, maybe something worse happened, maybe it's good to show an error popup ?
}
}
by Henrik » January 12th, 2015, 6:27 pm
by jasonredhawk » January 12th, 2015, 7:35 pm
by Guillaume » January 12th, 2015, 9:59 pm
Henrik wrote:Thanks Guillaume for digging into that, we can make PayVault work with Google Play v3 as long as there is a receipt that can be validated server-side, but that part is completely missing from their v3 documentation.
I don't know if they're gonna shut down that part when they shut down v2 completely, that's what's making us uncertain in knowing if we can support Google Play going forward. We'll try to get some answers and we hope to be able to make the Google Play support official.
The In-app Billing Version 2 API is deprecated and will be discontinued in January 2015. If you have an existing In-app Billing implementation that uses API Version 2 or earlier, you must migrate to In-app Billing Version 3.
If you have published apps selling in-app products, note that:
- Managed items and subscriptions that you have previously defined in the Developer Console will work with Version 3 as before.
- Unmanaged items that you have defined for existing applications will be treated as managed products if you make a purchase request for these items using the Version 3 API. You do not need to create a new product entry in Developer Console for these items, and you can use the same product IDs to purchase these items. They will still continue to be treated as unmanaged items if you make a purchase request for them using the Version 2 or earlier API.
by jasonredhawk » January 15th, 2015, 5:53 pm
by Guillaume » January 15th, 2015, 7:48 pm
Function executed on successful connect: function(client:Client):void{...}
Repeating Result Values
<orderid> The status of each order in the signed data. Contains the Product ID if everything went ok, otherwise a short error message.
by Guillaume » January 26th, 2015, 2:04 am
by jasonredhawk » January 26th, 2015, 4:07 am
public function onPurchaseSuccess(e:AndroidBillingEvent = null):void
{
var providerArgs:Object = new Object();
providerArgs.json = e.jsonData;
providerArgs.signature = e.signature;
// myClient is the client I received from my PlayerIO Connection.
myClient.payVault.usePaymentInfo("googleplayv2",providerArgs, function()
{
trace("\nAuthentication: SUCCESS ");
},function(){
trace("\nAuthentication: FAILED ");
});
}
by Guillaume » January 26th, 2015, 6:09 am
by jasonredhawk » January 26th, 2015, 2:24 pm
Dictionary<string, string> info = new Dictionary<string, string>(2);
info.Add("inapp_signed_data", message.GetString(0));
info.Add("inapp_signature", message.GetString(1));
player.PayVault.UseBuyInfo("googleplayv2", info, delegate(Dictionary<string, string> result)
{
// Success authentication
}, delegate(PlayerIOError error)
{
// Failed authentication
});
by Guillaume » January 26th, 2015, 2:52 pm
by Henrik » January 26th, 2015, 10:38 pm
by jasonredhawk » January 27th, 2015, 12:32 am
public function onPurchaseSuccess(e:AndroidBillingEvent):void
{
playerioConnection.send("verifyAndroidReceipt", e.jsonData, e.signature);
}
// This method is called when a player sends a message into the server code
public override void GotMessage(Player player, Message message) {
switch(message.Type) {
case "verifyAndroidReceipt":
{
Dictionary<string, string> info = new Dictionary<string, string>(2);
info.Add("inapp_signed_data", message.GetString(0));
info.Add("inapp_signature", message.GetString(1));
player.PayVault.UseBuyInfo("googleplayv2", info, delegate(Dictionary<string, string> result)
{
// Successful authentication
Broadcast("verifyAndroidReceipt", player.Id, 1); // Letting my game know that it was successfull verified
player.GetPlayerObject(delegate(DatabaseObject o)
{
// Update the player's DatabaseObject here in C#, so it can't be hacked
player.PlayerObject.Set("hasFullVersion", true);
player.PlayerObject.Save();
});
}, delegate(PlayerIOError error)
{
// Failed authentication
Broadcast("verifyAndroidReceipt", player.Id, 0); // Letting my game know that it was NOT verified
});
break;
}
}
}
by Guillaume » January 27th, 2015, 2:01 am
by Henrik » January 27th, 2015, 7:41 pm
by Guillaume » January 28th, 2015, 12:05 am
by Henrik » January 28th, 2015, 12:27 am
by Guillaume » January 28th, 2015, 12:33 am