Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Insert IAP in custom package

Discussion in 'Unity IAP' started by oANDRYo, Apr 8, 2020.

  1. oANDRYo

    oANDRYo

    Joined:
    Nov 27, 2017
    Posts:
    6
    Im working with custom package that will be core part for other projects. I successfully imported most of the plugins that I need. So now they located inside my package folder and work properly.
    One of my scipts in package need to work with IAP (with IAPButton, Product, CodelessIPA)

    But I have problem with Unity IAP. How can I import this correcly? Is it possible? If not, what can i do then?

    I tried to do next things:
    -copy folders that I have after importing IAP ( from Services, after pushing buttons "Enable" and "Import")
    -create assembly defenitions for IAP scripts and link with other assembly def.
    -add In App Purchasing package in my package dependencies

    But it doesn't work / have some errors.
     
  2. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    600
    You can download the IAP package from Unity Assets Store and then import it.
    https://assetstore.unity.com/packages/add-ons/services/billing/unity-iap-68207
     
  3. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    I would not recommend to use Codeless IAP in your product, it is not flexible, and Apple won't allow it without receipt validation which requires coding. Since you would need to code, you would be advised not to use Codeless. But I believe you won't have much luck creating a package anyway, it requires both a Package Manager package and an Asset Store package. We are hoping to resolve this later this year.
     
  4. JayR

    JayR

    Unity Technologies

    Joined:
    Aug 2, 2016
    Posts:
    84
    @oANDRYo :
    What is the timeline for your custom package development and will it be used only for new projects or also existing projects? Which version(s) of Unity are you using?
     
  5. oANDRYo

    oANDRYo

    Joined:
    Nov 27, 2017
    Posts:
    6
    Thanks for answers.

    We released couple games in 2019 with in game premium mode ("buy once", not a subscription). We used Codeless IAP and didn't have problem with Apple. Maybe something has changed.

    It will be really handy if I can use it both with existing projects and with new ones.
    Now Im using Unity 2019.3.5f1.


    Just in case, I’ll tell you more about package.
    We have many simular puzzle games with same menu logic, same mechanic, and purchase functionality. But textures, sounds, and some small features are different for this games. And if we want to add something in menu logic we just copy-paste from one project to another.
    So as a solution I was thinking about the package for core logic and plugins. So we can implement it in existing games and for future ones.

    As I understood there is no easy step-by-step solution for now =(
     
    JayR likes this.
  6. JayR

    JayR

    Unity Technologies

    Joined:
    Aug 2, 2016
    Posts:
    84
    Codeless IAP itself isn't a problem, but we have recently heard reports of games being rejected by Apple (during review) for issues related to purchase verification. If you encounter any issues with new app submissions please feel free to ask here in the forums.

    This is the real heart of my question about the version you're using and types of projects. As you know, the current process involves both a "package manager" package and service window toggle and second package import. That's not something that works well if you're trying to create your own package framework for internal development.

    We have a simplified workflow that uses only the Package Manager approach which is currently in internal testing. It will likely be available for use in new projects sooner than a general solution that deals with existing project upgrade cases. So for your internal package development you'll be able to just add a dependency and bypass all of the other pain, but I don't have a definitive date for you yet. It will also only be available as a "preview" package on 2019.x which may or may not be a dealbreaker for you. I'm happy to discuss this further but wanted to get you a sense of where we're headed with the product.
     
    oANDRYo likes this.
  7. oANDRYo

    oANDRYo

    Joined:
    Nov 27, 2017
    Posts:
    6
    @JayR Thanks for your reply
    Probably, the best option for me now is to implement somehow my package without IAP (maybe with events), and add IAP (and purchase logic) manually in each game.
     
  8. JayR

    JayR

    Unity Technologies

    Joined:
    Aug 2, 2016
    Posts:
    84
    @oANDRYo
    You can still include your normal purchasing code in your package, just wrap it in some #if blocks that you control. I would avoid using only the UNITY_PURCHASING define for that purpose.
     
    oANDRYo likes this.