In-App Purchases

I’m looking for a cross-platform(iOS and Android) way to process and verify in-app purchases. Is this possible? If not what is the best way to do it for each of those two platforms, note I’m using C++ not C.

Not really related to SDL is it?On Sep 20, 2014 10:32 PM, “ruler501” <d.ruler501 at gmail.com> wrote:

I’m looking for a cross-platform(iOS and Android) way to process and
verify in-app purchases. Is this possible? If not what is the best way to
do it for each of those two platforms, note I’m using C++ not C.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Not especially so just in that this is an SDL app and both are attempts at cross-platform code.

I doubt that there is a cross-platform way. You would need to code for both
iOS and Android separately. The way I did it was to create an in-app
purchase interface class & then made platform specific derived classes. The
iOS specific class tapped into the Objective C API and the Android specific
class used JNI to call google’s API.

It was a tedious and sometimes non-obvious process, but it worked.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768On Sun, Sep 21, 2014 at 8:02 AM, ruler501 <d.ruler501 at gmail.com> wrote:

I’m looking for a cross-platform(iOS and Android) way to process and
verify in-app purchases. Is this possible? If not what is the best way to
do it for each of those two platforms, note I’m using C++ not C.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Could you maybe share the code? Maybe a third party lib could unify that in
the sdl way.Am 22.09.2014 07:23 schrieb “Pallav Nawani” :

I doubt that there is a cross-platform way. You would need to code for
both iOS and Android separately. The way I did it was to create an in-app
purchase interface class & then made platform specific derived classes. The
iOS specific class tapped into the Objective C API and the Android specific
class used JNI to call google’s API.

It was a tedious and sometimes non-obvious process, but it worked.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768

On Sun, Sep 21, 2014 at 8:02 AM, ruler501 <d.ruler501 at gmail.com> wrote:

I’m looking for a cross-platform(iOS and Android) way to process and
verify in-app purchases. Is this possible? If not what is the best way to
do it for each of those two platforms, note I’m using C++ not C.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I’d be willing to put some time in to try and make this have a cross platform API if it is possible, I’d need to see the code before deciding that though

M. Gerhardy wrote:> Could you maybe share the code? Maybe a third party lib could unify that in the sdl way. Am 22.09.2014 07:23 schrieb “Pallav Nawani” <pallavnawani at gmail.com (pallavnawani at gmail.com)>:

I doubt that there is a cross-platform way. You would need to code for both iOS and Android separately. The way I did it was to create an in-app purchase interface class & then made platform specific derived classes. The iOS specific class tapped into the Objective C API and the Android specific class used JNI to call google’s API.

It was a tedious and sometimes non-obvious process, but it worked.

Pallav Nawani
IronCode Gaming Private Limited
Website:??http://www.ironcode.com (http://www.ironcode.com)
Twitter:?? http://twitter.com/Ironcode_Gaming (http://twitter.com/Ironcode_Gaming)
Facebook: http://www.facebook.com/Ironcode.Gaming (http://www.facebook.com/Ironcode.Gaming)
Mobile: 9997478768

On Sun, Sep 21, 2014 at 8:02 AM, ruler501 <@Ruler_501 (@Ruler_501)> wrote:

  I'm looking for a cross-platform(iOS and Android) way to process and verify in-app purchases. Is this possible? If not what is the best way to do it for each of those two platforms, note I'm using C++ not C.

SDL mailing list
SDL at lists.libsdl.org (SDL at lists.libsdl.org)
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)


SDL mailing list
SDL at lists.libsdl.org (SDL at lists.libsdl.org)
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

Okay, I will share the code. However, the code might be tied to our game
engine, and it might need to modified quite a bit.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768On Mon, Sep 22, 2014 at 12:18 PM, M. Gerhardy <martin.gerhardy at gmail.com> wrote:

Could you maybe share the code? Maybe a third party lib could unify that
in the sdl way.
Am 22.09.2014 07:23 schrieb “Pallav Nawani” <@Pallav_Nawani>:

I doubt that there is a cross-platform way. You would need to code for
both iOS and Android separately. The way I did it was to create an in-app
purchase interface class & then made platform specific derived classes. The
iOS specific class tapped into the Objective C API and the Android specific
class used JNI to call google’s API.

It was a tedious and sometimes non-obvious process, but it worked.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768

On Sun, Sep 21, 2014 at 8:02 AM, ruler501 <d.ruler501 at gmail.com> wrote:

I’m looking for a cross-platform(iOS and Android) way to process and
verify in-app purchases. Is this possible? If not what is the best way to
do it for each of those two platforms, note I’m using C++ not C.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thank you, and I’ll see what we can do to tidy it up for you and make it more of a library

Pallav Nawani wrote:> Okay, I will share the code. However, the code might be tied to our game engine, and it might need to modified quite a bit.

Pallav Nawani
IronCode Gaming Private Limited
Website:??http://www.ironcode.com (http://www.ironcode.com)
Twitter:?? http://twitter.com/Ironcode_Gaming (http://twitter.com/Ironcode_Gaming)
Facebook: http://www.facebook.com/Ironcode.Gaming (http://www.facebook.com/Ironcode.Gaming)
Mobile: 9997478768

On Mon, Sep 22, 2014 at 12:18 PM, M. Gerhardy <martin.gerhardy at gmail.com (martin.gerhardy at gmail.com)> wrote:

Could you maybe share the code? Maybe a third party lib could unify that in the sdl way. Am 22.09.2014 07:23 schrieb “Pallav Nawani” <pallavnawani at gmail.com (pallavnawani at gmail.com)>:

I doubt that there is a cross-platform way. You would need to code for both iOS and Android separately. The way I did it was to create an in-app purchase interface class & then made platform specific derived classes. The iOS specific class tapped into the Objective C API and the Android specific class used JNI to call google’s API.

It was a tedious and sometimes non-obvious process, but it worked.

Pallav Nawani
IronCode Gaming Private Limited
Website:??http://www.ironcode.com (http://www.ironcode.com)
Twitter:?? http://twitter.com/Ironcode_Gaming (http://twitter.com/Ironcode_Gaming)
Facebook: http://www.facebook.com/Ironcode.Gaming (http://www.facebook.com/Ironcode.Gaming)
Mobile: 9997478768

On Sun, Sep 21, 2014 at 8:02 AM, ruler501 <@Ruler_501 (@Ruler_501)> wrote:

  I'm looking for a cross-platform(iOS and Android) way to process and verify in-app purchases. Is this possible? If not what is the best way to do it for each of those two platforms, note I'm using C++ not C.

SDL mailing list
SDL at lists.libsdl.org (SDL at lists.libsdl.org)
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)


SDL mailing list
SDL at lists.libsdl.org (SDL at lists.libsdl.org)
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)


SDL mailing list
SDL at lists.libsdl.org (SDL at lists.libsdl.org)
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

As Promised, here is the In-App Purchase Code:
https://dl.dropboxusercontent.com/u/38460079/InAppPurchaseCode.zip

I have tried a bit to make it clear & self contained, however I am sure
that some changes will be needed, esp. in the Android code. I will be out
of station from Today till 29th September, so I will not be able to answer
any questions during that time.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768On Tue, Sep 23, 2014 at 12:01 PM, Pallav Nawani <@Pallav_Nawani> wrote:

Okay, I will share the code. However, the code might be tied to our game
engine, and it might need to modified quite a bit.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768

On Mon, Sep 22, 2014 at 12:18 PM, M. Gerhardy <martin.gerhardy at gmail.com> wrote:

Could you maybe share the code? Maybe a third party lib could unify that
in the sdl way.
Am 22.09.2014 07:23 schrieb “Pallav Nawani” <@Pallav_Nawani>:

I doubt that there is a cross-platform way. You would need to code for
both iOS and Android separately. The way I did it was to create an in-app
purchase interface class & then made platform specific derived classes. The
iOS specific class tapped into the Objective C API and the Android specific
class used JNI to call google’s API.

It was a tedious and sometimes non-obvious process, but it worked.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768

On Sun, Sep 21, 2014 at 8:02 AM, ruler501 <d.ruler501 at gmail.com> wrote:

I’m looking for a cross-platform(iOS and Android) way to process and
verify in-app purchases. Is this possible? If not what is the best way to
do it for each of those two platforms, note I’m using C++ not C.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

1 Like

Thanks for sharing the code! Highly appreciated!On 26.09.2014 07:51, Pallav Nawani wrote:

As Promised, here is the In-App Purchase Code:
https://dl.dropboxusercontent.com/u/38460079/InAppPurchaseCode.zip

I have tried a bit to make it clear & self contained, however I am sure
that some changes will be needed, esp. in the Android code. I will be
out of station from Today till 29th September, so I will not be able to
answer any questions during that time.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768

On Tue, Sep 23, 2014 at 12:01 PM, Pallav Nawani <pallavnawani at gmail.com <mailto:pallavnawani at gmail.com>> wrote:

Okay, I will share the code. However, the code might be tied to our
game engine, and it might need to modified quite a bit.

*Pallav Nawani*
*IronCode Gaming Private Limited*
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: *9997478768*

On Mon, Sep 22, 2014 at 12:18 PM, M. Gerhardy <martin.gerhardy at gmail.com <mailto:martin.gerhardy at gmail.com>> wrote:

    Could you maybe share the code? Maybe a third party lib could
    unify that in the sdl way.

    Am 22.09.2014 07:23 schrieb "Pallav Nawani"
    <pallavnawani at gmail.com <mailto:pallavnawani at gmail.com>>:

        I doubt that there is a cross-platform way. You would need
        to code for both iOS and Android separately. The way I did
        it was to create an in-app purchase interface class & then
        made platform specific derived classes. The iOS specific
        class tapped into the Objective C API and the Android
        specific class used JNI to call google's API.

        It was a tedious and sometimes non-obvious process, but it
        worked.

        *Pallav Nawani*
        *IronCode Gaming Private Limited*
        Website: http://www.ironcode.com
        Twitter: http://twitter.com/Ironcode_Gaming
        Facebook: http://www.facebook.com/Ironcode.Gaming
        Mobile: *9997478768*

        On Sun, Sep 21, 2014 at 8:02 AM, ruler501 <d.ruler501 at gmail.com <mailto:d.ruler501 at gmail.com>> wrote:

            __
            I'm looking for a cross-platform(iOS and Android) way to
            process and verify in-app purchases. Is this possible?
            If not what is the best way to do it for each of those
            two platforms, note I'm using C++ not C.

            _______________________________________________
            SDL mailing list
            SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
            http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org



        _______________________________________________
        SDL mailing list
        SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
        http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


    _______________________________________________
    SDL mailing list
    SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
    http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thanks for the code, it is greatly appreciated.

It does seem to be missing a few headers though(XAppBase.h, misc/XF_Log.h, os/xf_os_android_jni.h) otherwise it seems to be working great, and though I’m not sure if we could make a library out of it, because of the android complications I think I could write some scripts to make it seem almost like a plug and play library.

ruler501 wrote:

Thanks for the code, it is greatly appreciated.

It does seem to be missing a few headers though(XAppBase.h, misc/XF_Log.h, os/xf_os_android_jni.h) otherwise it seems to be working great, and though I’m not sure if we could make a library out of it, because of the android complications I think I could write some scripts to make it seem almost like a plug and play library.

I managed to edit it so it would compile, but I’m not certain my edits were correct, what is mClassPath = pApp->mJavaClassPath; supposed to do? I just assumed it returned the path of the main package in my code.

Also does XFOsAndroidManageLocalRef aLocalRef(aEnv); do anything? It seems the value was never used so I commented out those lines.

I also had to remove most of the logging since that header was missing.

Thanks a lot for the code :)On Fri, Sep 26, 2014 at 5:28 PM, ruler501 <d.ruler501 at gmail.com> wrote:

ruler501 wrote:

Thanks for the code, it is greatly appreciated.

It does seem to be missing a few headers though(XAppBase.h, misc/XF_Log.h,
os/xf_os_android_jni.h) otherwise it seems to be working great, and though
I’m not sure if we could make a library out of it, because of the android
complications I think I could write some scripts to make it seem almost
like a plug and play library.

I managed to edit it so it would compile, but I’m not certain my edits
were correct, what is mClassPath = pApp->mJavaClassPath; supposed to do? I
just assumed it returned the path of the main package in my code.

Also does XFOsAndroidManageLocalRef aLocalRef(aEnv); do anything? It seems
the value was never used so I commented out those lines.

I also had to remove most of the logging since that header was missing.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Those other headers are not required, you can simply remove them.
ClassPath is the path for the main activity, like:

mClassPath = “
com/ironcode/droid/PahelikaSecretLegends/PahelikaSecretLegends”;

basically used to call the methods defined in the game’s activity via JNI.

XFOsAndroidManageLocalRef aLocalRef(aEnv);
is used to ensure that JNI doesn’t garbage collect local variables we
create via JNI before we are done using them. I am not quite sure whether
this works at all though, I just had it as a safety measure.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768On Fri, Sep 26, 2014 at 9:58 PM, ruler501 <d.ruler501 at gmail.com> wrote:

ruler501 wrote:

Thanks for the code, it is greatly appreciated.

It does seem to be missing a few headers though(XAppBase.h, misc/XF_Log.h,
os/xf_os_android_jni.h) otherwise it seems to be working great, and though
I’m not sure if we could make a library out of it, because of the android
complications I think I could write some scripts to make it seem almost
like a plug and play library.

I managed to edit it so it would compile, but I’m not certain my edits
were correct, what is mClassPath = pApp->mJavaClassPath; supposed to do? I
just assumed it returned the path of the main package in my code.

Also does XFOsAndroidManageLocalRef aLocalRef(aEnv); do anything? It seems
the value was never used so I commented out those lines.

I also had to remove most of the logging since that header was missing.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

The code is not available anymore, can you share it again? would it work with the modern version of the google libs?