I can't for the life of me figure out what's wrong. I'm using the in_app_purchase
library and trying to buy a non-consumable. I've got license testing set up properly. Everything looks fine but when I go to make a purchase I get an error: "Something went wrong on our side. Please try again." (Obviously trying again does not change anything.)
Here's the relevant code snippet, though not sure if it helps given this could be an issue with config on the in-app purchase product:
await InAppPurchase.instance.buyNonConsumable(
purchaseParam: PurchaseParam(
productDetails: productDetails!,
applicationUserName: currentUserId,
),
);
Any idea what the error could be? Perhaps a configuration problem in the Play Store?
Turns out that the applicationUserName
field needs to be completely obfuscated and cannot be an email address (user ID in my case was an email address -- whoops).
Do not use this field to store any Personally Identifiable Information (PII) such as emails in cleartext. Attempting to store PII in this field will result in purchases being blocked.
One fix is to just remove the applicationUserName
field all together.
Another (the one I'm going with) is to just do a quick hash of the field:
await InAppPurchase.instance.buyNonConsumable(
purchaseParam: PurchaseParam(
productDetails: productDetails!,
applicationUserName: sha1.convert(utf8.encode(currentUserId)).toString(),
),
);
So if you're seeing the "Something went wrong on our end" error, double check that you're not having a purchase blocked because you're sending something that Google thinks is PII.