Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Promo Code IAP (not offer code) on the SKPaymentQueue using SwiftyStoreKit #714

Open
adriandev78 opened this issue Sep 1, 2024 · 0 comments

Comments

@adriandev78
Copy link

adriandev78 commented Sep 1, 2024

Question

I'm trying to get Promo Codes Redeemed from the app store to work inside my iOS app. Please note that these are different from offer codes - which are used for subscriptions and work with presenting an UI.

After I generate a promo code from appstoreconnect the flow from a user perspective is:

  1. Go to App Store -> Profile
  2. Go to Redeem Gift Card or Code
  3. Input code
  4. Tap Open App
  5. My app opens but no IAP is triggered by SwiftyStoreKit.completeTransactions .

I'm using SwiftyStoreKit and in applicationDidFinishLaunching I've put the code:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // see notes below for the meaning of Atomic / Non-Atomic
    SwiftyStoreKit.completeTransactions(atomically: true) { purchases in
        for purchase in purchases {
            switch purchase.transaction.transactionState {
            case .purchased, .restored:
                if purchase.needsFinishTransaction {
                    // Deliver content from server, then:
                    SwiftyStoreKit.finishTransaction(purchase.transaction)
                }
                // Unlock content
            case .failed, .purchasing, .deferred:
                break // do nothing
            }
        }
    }
    return true
}

and handle the delivering functionality of the IAP before calling :

SwiftyStoreKit.finishTransaction(purchase.transaction)

But there seems there is no call to the SwiftyStoreKit.completeTransactions callback.

Isn't this the method that should get called to make redeeming promo codes work ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant