Search Unity

[Solved] IAP Google Store and PlayerIO

Discussion in 'Unity IAP' started by lauromrcruz, Jan 25, 2018.

Thread Status:
Not open for further replies.
  1. lauromrcruz

    lauromrcruz

    Joined:
    Oct 31, 2014
    Posts:
    7
    Hi

    I'm using IN APP BILLING service to integrate with Google Store.

    Process work fine and I receive the callback at

    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)

    Now I use PlayerIO for my server and need set those parameters to be possible to registry the purchase with my server

    info.Add("inapp_signed_data", args.purchasedProduct.receipt);
    info.Add("inapp_signature","MY KEY FROM GOOGLE STORE");

    after these be defined I call PlayerIO PayVaul to registry the purchase

    _client.PayVault.UseBuyInfo("googleplayv2", info, successPayVault, failurePayVault);

    but I'm receiving InvalidPurchageArguments: invalid "inapp_signature", does match "innap_signed_data"

    I believe it is happen because the receipt provided by IAP is already parsed while PlayerIO is expecting the origninal encrypted data from Google Store

    Can you help? Is there a way to get the Google Store data encrypted send to IAP?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @lauromrcruz Might you be able to confirm with PlayerIO that this is the cause? I will check with the IAP team here and see if they have insight also.
     
  3. lauromrcruz

    lauromrcruz

    Joined:
    Oct 31, 2014
    Posts:
    7
    thanks a lot. I'm also trying to contact them.
     
  4. lauromrcruz

    lauromrcruz

    Joined:
    Oct 31, 2014
    Posts:
    7
    Hi Jeff

    I got this answer from PlayerIO
    "In UseBuyInfo, you're supposed to pass two parameters, one is the INAPP_PURCHASE_DATA, and the other is the INAPP_DATA_SIGNATURE, both should be returned to your app when you've completed a purchase through Google Play."

    Those are information that the google store send when the purchase happen.

    I believe UNITY IN APP BILLING is parsing this and generate its own structure, the problem is I can't recognize where those information are.

    Can you help me?

    Thanks
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you elaborate on your statement "after these be defined I call PlayerIO PayVaul to registry the purchase". Are you using the PlayerIO service just to track the transactions for reporting purposes? If you are using PlayerIO for handling the actual purchase, then you would want to ask them for specifics on integrating with Unity, perhaps ask for example code https://playerio.com/documentation/services/payvault/provider/googleplay .
     
  6. lauromrcruz

    lauromrcruz

    Joined:
    Oct 31, 2014
    Posts:
    7
    Hi JeffD

    Thank you for you reply.

    What I'm trying to achieve is registry the purchase with our back end server.

    On my application I decided to use the IN APP BILLING, that similar to use google Store API has a method called when a purchase happen.

    the IN APP BILLING method has this signature

    PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)

    while google Store has this signature:

    void onActivityResult(int requestCode, int resultCode, Intent data)

    I believe the IN APP BILLING is passing the data provided by google and create the instance of PruchaseEventArgs.

    Now to be possible to registry my purchase at a secure way with PlayerIO, it is required to use their PAYVAULT feature that expect receive in c# a dictionary with 2 information that are provided by the google store API

    INAPP_PURCHASE_DATA
    INAPP_DATA_SIGNATURE

    Because the IN APP BILLING feature is receiving the call back from google store I believe is possible to access those information but I can't see them on the PruchaseEventArgs parameter received.

    Is there a way to get those information?

    Does make sense what I'm trying to achieve?

    Thank you in advance
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sorry, I'm still not clear on "registry the purchase". So this is for reporting only, and not part of the transaction, correct? I met with the IAP team and they mentioned that you should be able to obtain this information from product.receipt. Please ask PlayerIO for sample code as they mention that they support Unity IAP.
     
  8. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @lauromrcruz

    After a purchase is complete, we attach a Unity receipt to each product. The receipt formats are documented here:
    https://docs.unity3d.com/Manual/UnityIAPPurchaseReceipts.html

    The original receipt we receive from the store will always be available in the Payload field. For Google Play, the Payload will contain the keys: json which is INAPP_PURCHASE_DATA and signature which is INAPP_DATA_SIGNATURE.

    You can parse this json any way you'd like, but there is some example code in this forum thread:
    https://forum.unity.com/threads/how-do-i-track-auto-renewing-subscriptions.476293/#post-3108170
     
  9. lauromrcruz

    lauromrcruz

    Joined:
    Oct 31, 2014
    Posts:
    7
    Thanks a lot, I will try this.
     
  10. lauromrcruz

    lauromrcruz

    Joined:
    Oct 31, 2014
    Posts:
    7
    Thank you all for your help, it did work.
     
Thread Status:
Not open for further replies.