AppsFlyerSDK / appsflyer-capacitor-plugin

AppsFlyer SDK plugin for Capacitor
MIT License
15 stars 26 forks source link

What should be passed to the purchaseData param of validateAndLogInAppPurchaseAndroid method? #20

Closed mcfarljw closed 2 years ago

mcfarljw commented 2 years ago

I'd like to preface this by saying that I reached to support directly as mentioned in the README over a week ago but didn't get a response so I am going to try reaching out here as a last resort.

What is supposed to be passed to the purchaseData param of the method below? I'm not seeing anything referencing this property in the latest Google Play Billing library documentation (https://developer.android.com/google/play/billing/integrate).

  AppsFlyer.validateAndLogInAppPurchaseAndroid({
      additionalParameters: {aa: 'cc'},
      currency: 'usd',
      price: '20',
      signature: 'the_signature',
      publicKey: 'your_public_key',
      purchaseData: 'the_purchase_data'
    })
      .then(r => alert('validateAndLogInAppPurchase success: ' + r.res))
      .catch(e => alert('validateAndLogInAppPurchase error: ' + e));
mcfarljw commented 2 years ago

I did finally hear back from support but was told that the Google Play Billing Library v4 isn't officially supported yet. We're likely going to look for another service as this back and forth has been way too slow.

pazlavi commented 2 years ago

Hi @mcfarljw , Thank you for reaching out to us.

We do support Google Play Billing Library v4 as our API is agnostic from Play Billing Library. The required data is identical in both V3 and V4. The only difference is how to extract the required data:

mcfarljw commented 2 years ago

Hey @pazlavi the problem ended up not being related to v3 or v4 but the documentation wasn't worded clearly on what to pass for Android purchases. It just says purchaseData: 'the_purchase_data' which is wording that is more relevant to the v3 billing library but that terminology isn't used for the v4 billing library as it's no longer referred to as purchase data. I was told by support I should use purchase.getOriginalJson() for the purchaseData field.

https://developer.android.com/reference/com/android/billingclient/api/Purchase#getOriginalJson()

I recommend updating your documentation to make this more clear for future developers.