Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by auge · Oct 27, 2012 at 12:28 AM · androidprime31

Prime31 "In-App Billing" plugin, where to put my logic?

Hi,

I just writing an interface for the IAB plugin (http://www.prime31.com/unity/docs/#inAppBillingDoc), but I'm not really sure where to put my "succeed"-logic in.

I have two events:

  • purchaseSignatureVerifiedEvent

  • purchaseSucceededEvent

but which one is called first? Because the purchaseSignatureVerifiedEvent is confirming the transaction (using confirmPendingPurchases), I suppose the order is succeed then verified.

I do not want to unlock content before verification (or doesn't it matter?), but I also do not want to have it confirmed, before my game is saved successful. On the other hand the verified event does not receive any productid...

And do anybody knows, which events are called, when google play tries to complete pending transactions from previous sessions, that were not confirmed before. Am I able to cancel these transactions, e.g. when the item id is not valid anymore in my game?

( Sorry, I do not have any device to test the order by my self :( )

best regards -auge

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by auge · Oct 29, 2012 at 05:40 PM

OK, maybe someone else will have similar problems...

I ran tests on some devices (Galaxy Ace 2.3.6, LG-P350 2.2.1) and both fired purchaseSignatureVerifiedEvent. The purchaseSucceededEvent was never called, I have no idea what this is for.

Anyway, you get all needed data (includes productid) from the signedData string in the hashtable that is passed to the event as json. Using Json.Net you can copy the snippet below.

 using Newtonsoft.Json;
 
 public sealed class SignedDataResponse
 {
     public sealed class Order
     {
         [JsonProperty(PropertyName = "notificationId")]
         public string NotificationId;
 
         [JsonProperty(PropertyName = "orderId")]
         public string OrderId;
 
         [JsonProperty(PropertyName = "packageName")]
         public string PackageName;
 
         [JsonProperty(PropertyName = "productId")]
         public string ProductId;
 
         [JsonProperty(PropertyName = "purchaseTime")]
         public long PurchaseTime;
 
         [JsonProperty(PropertyName = "purchaseState")]
         public int PurchaseState;
     }
 
     [JsonProperty(PropertyName = "nonce")]
     public long Nonce;
 
     [JsonProperty(PropertyName = "orders")]
     public Order[] Orders;
 }

your callback:

 private void PurchaseSignatureVerifiedEvent(Hashtable payload)
 {
     if (null != payload)
     {
         var signedData = payload["signedData"].ToString();
         var signature = payload["signature"].ToString();
 
         var response = Newtonsoft.Json.JsonConvert.DeserializeObject<SignedDataResponse>(signedData);
 
         UnityEngine.Debug.Log("productId: " + response.Orders[0].ProductId);
     }
 }
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image taxvi · Feb 20, 2015 at 07:24 AM 0
Share

thanks a lot for taking your time to post this! there is not much documentation on Prime31 IAB on the web.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

iOS Game Center & Android Game Center "Play Games" 1 Answer

Prime31: Posting To Facebook 0 Answers

Etcetera: promptForPictureFromAlbum 0 Answers

remote_app_id does not match stored id (with different hashes) 2 Answers

Error building Player: CommandInvokationFailure: 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges