Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. InApp Purchasing C++ not working in Qt 5.11.1 on Mac OS 10.13.6

InApp Purchasing C++ not working in Qt 5.11.1 on Mac OS 10.13.6

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 844 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nando
    wrote on last edited by Nando
    #1

    Hi,
    i try to implement an In-App-Purchase on Mac OS (10.13.6) with the qt purchase module.

    I do the following:

        m_iapStore = new QInAppStore(this);
    
        connect(m_iapStore, SIGNAL(productRegistered(QInAppProduct*)),
                this, SLOT(markProductAvailable(QInAppProduct*)));
        connect(m_iapStore, SIGNAL(productUnknown(QInAppProduct::ProductType, const QString &)),
                this, SLOT(handleErrorGracefully(QInAppProduct::ProductType, const QString &)));
        connect(m_iapStore, SIGNAL(transactionReady(QInAppTransaction*)),
                this, SLOT(handleTransaction(QInAppTransaction*)));
    
    
    
    void InAppPurchaseManager::markProductAvailable(QInAppProduct *product)
    {
        m_inAppFullVersionProduct = product;
        qInfo() << "InAppPurchaseManager::markProductAvailable: product: " << m_inAppFullVersionProduct;
    
    }
    
    void InAppPurchaseManager::handleErrorGracefully(QInAppProduct::ProductType productType, const QString &identifier)
    {
        qInfo() << "InAppPurchaseManager::handleErrorGracefully: productType:" << productType << " id: " << identifier;
    
    }
    
    void InAppPurchaseManager::handleTransaction(QInAppTransaction *transaction)
    {
        qInfo() << "InAppPurchaseManager::handleTransaction: transaction: " << transaction;
    
    }
    
        qInfo() << "InAppPurchaseManager::call registerProduct";
        m_iapStore->registerProduct(QInAppProduct::Consumable, QStringLiteral("de.myproduct.inapp-id"));
    

    Documentation says:
    Registering a product is asynchronous, and will at some point yield one of the following two signals: 1. productRegistered() if the product was found in the external store with a matching type. 2. productUnknown() if the product was not found in the external store with the type you specified.

    But i do not get any answer / slot called after calling the registerProduct method.
    I would expect that either the productUnknown or the productRegistered slot gets called, but nothing happens...

    Any ideas, what the problem could be?

    Greetings
    Nando

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      first step is to check return of the connects to see they all return true .

      N 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        first step is to check return of the connects to see they all return true .

        N Offline
        N Offline
        Nando
        wrote on last edited by
        #3

        @mrjj said in InApp Purchasing C++ not working in Qt 5.11.1 on Mac OS 10.13.6:

        Hi
        first step is to check return of the connects to see they all return true .

        Hi and thank you.
        I chekced connect calls and all look good:

        if(!connect(m_iapStore, SIGNAL(productRegistered(QInAppProduct*)),
                    this, SLOT(markProductAvailable(QInAppProduct*))))
            {
                qCritical() << "connect failed: productRegistered";
            }
            else {
                qInfo() << "connect OK: productRegistered";
            }
        
            if(!connect(m_iapStore, SIGNAL(productUnknown(QInAppProduct::ProductType, const QString &)),
                    this, SLOT(handleErrorGracefully(QInAppProduct::ProductType, const QString &))))
            {
                qCritical() << "connect failed: productUnknown";
            }
            else {
                qInfo() << "connect OK: productUnknown";
            }
        
        
            if(!connect(m_iapStore, SIGNAL(transactionReady(QInAppTransaction*)),
                    this, SLOT(handleTransaction(QInAppTransaction*))))
            {
                qCritical() << "connect failed: transactionReady";
            }
            else {
                qInfo() << "connect OK: transactionReady";
            }
        

        Any other ideas why the slots get not called?
        I call this code from my MainWindow constructor.

        1 Reply Last reply
        0
        • N Offline
          N Offline
          Nando
          wrote on last edited by
          #4

          Puuh, i can not get it working in my project :-(

          Somehow no signals are emitted from the QInAppStore module on MacOS.
          I checked it the signals are connected correctly.

          Maybe i need to add something extra in Info.plist?

          Same code in a mini test-project runs fine (but without app bundle, just normal app)
          Something in my app seems to block the QInAppStore class to emit signals.
          But i use signals slots all over my app and all work perfectly. Only QInAppStore seems not to emit the signals productUnknown(QInAppProduct::ProductType, const QString &)

          mrjjM 1 Reply Last reply
          0
          • N Nando

            Puuh, i can not get it working in my project :-(

            Somehow no signals are emitted from the QInAppStore module on MacOS.
            I checked it the signals are connected correctly.

            Maybe i need to add something extra in Info.plist?

            Same code in a mini test-project runs fine (but without app bundle, just normal app)
            Something in my app seems to block the QInAppStore class to emit signals.
            But i use signals slots all over my app and all work perfectly. Only QInAppStore seems not to emit the signals productUnknown(QInAppProduct::ProductType, const QString &)

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Nando
            sadly i have no idea.
            Do you use commercial version of Qt ?

            N 1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              Can you provide a minimal buildable example that shows that behaviour ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • mrjjM mrjj

                @Nando
                sadly i have no idea.
                Do you use commercial version of Qt ?

                N Offline
                N Offline
                Nando
                wrote on last edited by
                #7

                @mrjj said in InApp Purchasing C++ not working in Qt 5.11.1 on Mac OS 10.13.6:

                version of Qt ?

                Hi, for my tests i use the open source version.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved