Ponja
Ponja

Reputation: 663

In-app Purchases from iMessage app extension

I created an app that uses in-app purchases, I already have set up the in-app purchases on iTunes and I even tested it using a sandbox user and all of this is working perfectly.

now that I included an iMessage app extension, the same in-app purchase products return invalidProduct Id, but continues working well inside the main app.

could be because the bundle id?

mainapp: com.whatever.bundleid
app iMessage: com.whatever.bundleid.iMessage
iMessage extension: com.whatever.bundleid.iMessage.MessagesExtension

btw, i'm using the SwiftyStoreKit pod.

if let inappIndentifier = stickerPackage.inAppPurchaseId {
        SwiftyStoreKit.retrieveProductsInfo([inappIndentifier]) { result in
            if let product = result.retrievedProducts.first {
                let priceString = product.localizedPrice!
                completion(true, priceString)
            } else if let _ = result.invalidProductIDs.first {
                completion(false, nil)
            } else {
                print("Error: \(result.error)")
                completion(false, nil)
            }
        }
    }

enter image description here

Upvotes: 3

Views: 676

Answers (1)

Ponja
Ponja

Reputation: 663

I made a huge mistake, instead of creating an iMessage extension, I've created an iMessage app extension. Once I removed the "iMessage app" the in-app purchases started working correctly.

Upvotes: 1

Related Questions