SDKBOX live OPS instruction wrong?

@pabitrapadhy

I’m generating code for Live OPS:

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
sdkbox::init("ddd", "eee");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
sdkbox::init("fff", "ggg", "googleplay");
#endif

But sdkbox::init(“ddd”, “eee”); function not exsisting in SDKBOX, how to initialize it?

Also from page http://docs.sdkbox.com/en/#overview links under section Liveops not working.

Ok, checked git sample and found there include

#include "Sdkbox/Sdkbox.h"

So seems missed this one , sdkbox not adding it automaticly and it’s not mentioned anywhere in docs. Please fix and confirm :slight_smile:

1 Like

@nite, @pabitrapadhy

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.

There are two ways to use IAP verification

  1. 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)

  2. 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?

Hey @musikov

Please check our documentation here -
http://docs.sdkbox.com/en/liveops/receipt-verification/

Best,
Pabitra

Thanks for your response!

I saw that instruction before. But i can’t understand what is onPayResult method and where do i need to implement it?

1 Like

You don’t need to implement onPayResult method, SDKBOX already handle it for you.

1 Like

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.

thanks

setDebug(true) will output verbose level of logs, it’s not useful for the release build.

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?

Any idea what’s going on?

We’ll look into that, are you making purchase with iTunes tester account?

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 )))

can you give me more details about setDebug(false) issue?

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

debug init code was:

  sdkbox::IAP::setDebug(true);
  sdkbox::IAP::setListener(new IAPL());
  sdkbox::IAP::init();

release:

  sdkbox::IAP::setDebug(false);
  sdkbox::IAP::setListener(new IAPL());
  sdkbox::IAP::init();

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:

IAP :Server validation: not authenticated

i tried your code, but i can’t reproduce.

can you use sdkbox-sample-iap to reproduce your issue, and show the detail steps

it reproducing only then using LIVEOPS server side verification ie:

bool AppDelegate::applicationDidFinishLaunching()
{
........
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
      sdkbox::init("......", ".........");
#endif
.......
  sdkbox::IAP::setDebug(false);
  sdkbox::IAP::setListener(new IAPL());
  sdkbox::IAP::init();
.........
}

and looks like it is IOS only bug cos Android works fine with verification is on

yes, i enabled LIVEOPS. it’s ok

maybe your need double check your liveops config.