Also it would be good to have code example for server side recipe validation for in-app purchase, it’s not clear from description how it should be handled . Is it new listener functions or what is onPayResult. Please give example how this part should be implemented.
Android IAP flow
Player makes a purchase request, and pays for it.
If the purchase is canceled, onPayResult is called with code PAYRESULT_CANCEL.
If the purchase is errored, onPayResult is called with code PAYRESULT_FAIL.
If the purchase is successful
Receipt and cyphered payload info is obtained.
If the developer requested to do receipt validation, onPayResult is called with PAYRESULT_NEEDS_VERIFICATION. The Product passed to the plugin listener has receipt and cyphered payload information, which is sufficient info to verify purchase authenticity.
else
If Application has not remote configuration set: local validation process is executed:
Application’s private key must be present in the sdkbox_config.json file.
If verification succeeds: onPayResult is called with code PAYRESULT_SUCCESS.
if verification fails: onPayResult is called with code PAYRESULT_FAIL.
If Application has remote configuration set: a remote validation request is started.
If the validation request is errored or timeout (both situations refer to our server or network status), the verification process falls back to local verification [4.3.1]
If the validation request is is aborted, onPayResult is called with code PAYRESULT_FAIL.
If the validation request executes normally:
If validation is not successful, the verification process falls back to local verification [4.3.1]
if validation is successful, onPayResult is called with code PAYRESULT_SUCCESS.
If the purchase is a Consumable item the purchase will always be consumed.
The workflow you described is correct if you want to use your own server to verify the purchase.
To achieve this, you would need to call enableUserSideVerification(true)
Otherwise, if you want to use SDKBOX’s server to verify the purchase for you, you just need to call sdkbox::init(key, token) and use IAP as it is. If the verification fails, you’ll get callback in onFailure with the message been failed to verify purchase.
Good day!
I have the same issue.
I want to make server-side receipt validation using own server.
I’ve already enabled enableUserSideVerification, but onPayResult never called. I can’t find any info regard onPayResult, only that such method was in pluginx
Could You please help me to find out how to make it work?
what is the purpose of IAP::setDebug(true)? Does that stay true even when we release the product? It would be nice to have a wiki or other documentation of the actual api, so we don’t have to try to guess or infer.
nite, here’s the problem I’m having, though. If I call setDebug(false) (or not at all), then even though I get an Apple popup saying that the purchase was successful, apparently my onSuccess method isn’t called, because the purchase isn’t reflected.
In fact, this is what I get with setDebug(false)
IAP :Server validation: not authenticated
OTOH, if I setDebug(true), then it works. But then you’re saying that I’m spewing lots of logs, right?
Apple has improved their TestFlight, and now you can use your regular account, but it detects that you’re running in the sandbox. I don’t know how they handle that, though. Thanks.
sorry for necro posting but setDebug(true) problem is still in late version of IAP plugin (IOS)! I release my app with setDebug(false) and got some angry users asking for refund )))
yep! i integrate IAP plugin in to my game and test it in sandbox with setDebug(true) everything works perfectly, then i make a release build and set it to false. My
and in prod after succesfull purchase (charge money) it calls onFailure in my Listener
so i stop distributing my app and test it in sandbox with setDebug(false) and got logs: