AppsFlyer - logPurchase validation in sandbox mode?

Hi, I’ve been able to successfully use AppsFlyer so far in one of my games across both iOS and Android.  All seems to be working well.  It appears to be built by Corona and I have a quick question about using the logPurchase function.

https://marketplace.coronalabs.com/corona-plugins/appsflyer

http://docs.coronalabs.com/plugin/appsflyer/index.html

When I install my game via TestFlight to do a formal IAP test, and in iOS when I use the logPurchase() function (see http://docs.coronalabs.com/plugin/appsflyer/logPurchase.html), I’m getting an error code 21007.  Per this link on Apple docs, it states essentially that the validation call is pointing to production servers at Apple rather than test ones.

21007:  This receipt is from the test environment, but it was sent to the production environment for verification. Send it to the test environment instead.

In AppsFlyer docs, there is an actual “useReceiptValidationSandbox” flag that can be applied to force an IAP validation event to point towards Apple’s testing servers rather than production.  On this AppsFlyer doc, here’s what it shows:

_ “Important: For testing purposes, we recommend to set the useReceiptValidationSandbox flag to YES, as this redirects the requests to Apple sandbox servers.” _

AppsFlyer support said they didn’t make the plugin, so they’re not sure how this flag can be implemented…

Any ideas if this is possible?

Thanks,

Nate

I don’t believe it is available, but this should be an easy plugin to make. Not a brand new Appsflyer plugin, but one that complements the one that is already available.

Thanks agramonte.  That’d be great to have a secondary plugin that could be used alongside the primary AppsFlyer plugin that would simply set useReceiptValidationSandbox to true or false.  I have not created a plugin yet… is this something that you have done before?

I started it last night shouldn’t be hard to do, but I would need your help to test it. I don’t have a project at the moment with both a store and AppsFlyer.

Oh wow thanks!  I’m available to test whenever you’re ready!  Would this involve Corona Enterprise or a special setup on my end?

No. I"ll publish it and then make it available as a beta. Regular corona builds. What version of Corona are you using? 

Awesome.  Using the latest daily build right now… I think 3378.

Ok. I submitted the plug-in. Now we just have to wait for Corona (usually a couple of days at the most) and probably a couple a version updates to fix any bugs. I implemented two methods:

  1. appsFlyerExtras:setUseUninstallSandbox(bool) : Sets uninstall flag on iOS.

appsFlyerExtras:setUseReceiptValidationSandbox(bool): Sets receipt validation flag for iOS.

The documentation is up:

https://github.com/agramonte/AppsFlyer-Extras

I can confirm that it works from my logs.

2018-09-20 19:27:00.207848-0400 App[733:212145] AppsFlyer SDK version 4.8.9 started build (728) 2018-09-20 19:27:00.208087-0400 App[733:212145] [DEBUG] AppsFlyer: -[AppsFlyerTracker setIsDebug:] \* \* \* AppsFlyer is set to debug mode. This should only be used in development enviornment!!!! \* \* \* 2018-09-20 19:27:00.271968-0400 App[733:212145] Status bar could not find cached time string image. Rendering in-process. 2018-09-20 19:27:01.287080-0400 App[733:212145] version: 4.8.9 (build 728) 2018-09-20 19:27:01.290899-0400 App[733:212145] [DEBUG] AppsFlyer: -[AppsFlyerTracker setUseReceiptValidationSandbox:] \* \* \* AppsFlyer is set to verify in app purchases on Apple sandbox. This should only be used in development enviornment!!!! \* \* \*

This is AWESOME.  Thank you so much!!  Will you be notified by Corona that it’s up and live in the Marketplace?

Yes. They will let me know.

It is live and working. I don’t have any receipts but at least I know it is setting the property correctly:

Sep 22 10:26:06.481 [Device] [DEBUG] AppsFlyer: -[AppsFlyerTracker setUseReceiptValidationSandbox:] * * * AppsFlyer is set to verify in app purchases on Apple sandbox. This should only be used in development enviornment!!! * * *

Please make sure to activate it first:

https://marketplace.coronalabs.com/corona-plugins/appsflyer-extras

And here are the instructions:

https://github.com/agramonte/AppsFlyer-Extras

As I side note, I was informed that a new version of AppsFlyer plugin is coming so the usefulness of this plugin might be short-lived. 

Ok. I tried everything and contact support the last couple of days. Unfortunately even though in the logs it says it should be pointing the sandbox the actual request is going to the live servers. thank you for helping try to test it.

I don’t believe it is available, but this should be an easy plugin to make. Not a brand new Appsflyer plugin, but one that complements the one that is already available.

Thanks agramonte.  That’d be great to have a secondary plugin that could be used alongside the primary AppsFlyer plugin that would simply set useReceiptValidationSandbox to true or false.  I have not created a plugin yet… is this something that you have done before?

I started it last night shouldn’t be hard to do, but I would need your help to test it. I don’t have a project at the moment with both a store and AppsFlyer.

Oh wow thanks!  I’m available to test whenever you’re ready!  Would this involve Corona Enterprise or a special setup on my end?

No. I"ll publish it and then make it available as a beta. Regular corona builds. What version of Corona are you using? 

Awesome.  Using the latest daily build right now… I think 3378.

Ok. I submitted the plug-in. Now we just have to wait for Corona (usually a couple of days at the most) and probably a couple a version updates to fix any bugs. I implemented two methods:

  1. appsFlyerExtras:setUseUninstallSandbox(bool) : Sets uninstall flag on iOS.

appsFlyerExtras:setUseReceiptValidationSandbox(bool): Sets receipt validation flag for iOS.

The documentation is up:

https://github.com/agramonte/AppsFlyer-Extras

I can confirm that it works from my logs.

2018-09-20 19:27:00.207848-0400 App[733:212145] AppsFlyer SDK version 4.8.9 started build (728) 2018-09-20 19:27:00.208087-0400 App[733:212145] [DEBUG] AppsFlyer: -[AppsFlyerTracker setIsDebug:] \* \* \* AppsFlyer is set to debug mode. This should only be used in development enviornment!!!! \* \* \* 2018-09-20 19:27:00.271968-0400 App[733:212145] Status bar could not find cached time string image. Rendering in-process. 2018-09-20 19:27:01.287080-0400 App[733:212145] version: 4.8.9 (build 728) 2018-09-20 19:27:01.290899-0400 App[733:212145] [DEBUG] AppsFlyer: -[AppsFlyerTracker setUseReceiptValidationSandbox:] \* \* \* AppsFlyer is set to verify in app purchases on Apple sandbox. This should only be used in development enviornment!!!! \* \* \*