Hello,
It seems that there is a bug in the IAP plugin as I’m trying to verify the receipts for purchased products, but they seem to be very inconsistent on JS. I’ve enabled the setting by using sdkbox.IAP.enableUserSideVerification(true);
, but it seems that the receipt info is almost always empty (this is tested on Android).
If I purchase a product that is a consumable in the onSuccess
callback I get both the receipt
and receiptCipheredPayload
, but if the product is a non-consumable these fields are empty.
If I use the restore purchase functionality the receipt fields are again empty for the non-consumable product.
Even in the onProductRequestSuccess
callback the receipt data is empty for the non-consumable item, and even though the fields shouldn’t even exist for the consumable item, they are there (but empty as they should be).
The problem to me is coming from the plugin as it outputs debug data to the console and in it the receipt data is present, but the JS wrapper doesn’t receive it.
Here are examples of this:
Debug data from the plugin:
03-18 19:39:34.851 16636-16660/? D/IAP: GooglePlay Request result : 0 msg :Product request successful. data :
[{"id":"com.whitenovastudio.gametemplate.hd_graphics",
"title":"HD Graphics (game template 2)",
"desc":"Graphics that scale for larger displays",
"price":"BGN4.19",
"currencyCode":"BGN",
"priceValue":4.190000057220459,
"orderId":"",
"receipt":
{"packageName":"com.whitenovastudio.GameTemplate",
"productId":"com.whitenovastudio.gametemplate.hd_graphics",
"purchaseTime":1489849392299,
"purchaseState":0,
"purchaseToken":"......."},
"cipheredReceiptInfo":"........."},
{"id":"com.whitenovastudio.gametemplate.coin_pack_50",
"title":"50 Coins (game template 2)",
"desc":"50 coins to use for in-game items",
"price":"BGN2.39",
"currencyCode":"BGN",
"priceValue":2.390000104904175}]
And this is what I get in the JS wrapper:
03-18 19:39:34.968 16636-16660/? D/cocos2d-x debug info: sdkbox IAP onProductRequestSuccess
[{"name":"coin_pack_50",
"id":"com.whitenovastudio.gametemplate.coin_pack_50",
"title":"50 Coins (game template 2)",
"description":"50 coins to use for in-game items",
"price":"BGN2.39",
"currencyCode":"BGN",
"receipt":"",
"receiptCipheredPayload":""},
{"name":"hd_graphics",
"id":"com.whitenovastudio.gametemplate.hd_graphics",
"title":"HD Graphics (game template 2)",
"description":"Graphics that scale for larger displays",
"price":"BGN4.19",
"currencyCode":"BGN",
"receipt":"",
"receiptCipheredPayload":""}]
The coin pack purchase shouldn’t even contain the receipt
and receiptCipheredPayload
fields, whereas the hd graphics purchase should have the data from the debug output.
Please fix this and see if there are any similar bugs on iOS.