iOS OfferCode testing in outside the app .

In my app, I need the user to redeem a code outside the app and then capture the transaction in the callback/response from the App Store. How can I test this process?

Here's my function for opening a URL:

    if UIApplication.shared.canOpenURL(url) {
        UIApplication.shared.open(url, options: [:], completionHandler: nil)
    }
}

I am trying to get the transaction object in the TransactionObserver class:

    // Implementation details...
}

Here is the link to this class.

However, I am not receiving the expected callback in this observer.

I am testing on a TestFlight build. My question is: Is it possible to test offer codes in TestFlight? Or is there something wrong with my implementation?

Answered by DTS Engineer in 812528022

The Testing at all stages of development with Xcode and the sandbox article describes all the various scenarios you can test in the sandbox and the local test environment. TestFlight uses the sandbox for in-app purchases. Per this article, you can test redeeming an offer code for an auto-renewable subscription in the local test environment. You can't perform this test in the sandbox environment.

How can I test this process?

Be sure to follow the instructions in Supporting subscription offer codes in your app.

The Testing at all stages of development with Xcode and the sandbox article describes all the various scenarios you can test in the sandbox and the local test environment. TestFlight uses the sandbox for in-app purchases. Per this article, you can test redeeming an offer code for an auto-renewable subscription in the local test environment. You can't perform this test in the sandbox environment.

How can I test this process?

Be sure to follow the instructions in Supporting subscription offer codes in your app.

Thank you for your reply. We have implemented all the necessary code to listen for transactions that occur outside the app. Our app has already been reviewed in the App Store, but we have not published it yet. We have waited 48 hours after activating all identifiers, but our padlock is still not being called as an observer when we attempt to redeem outside the app. We are performing the redemption via URL. To listen for transactions, we used

for await verificationResult in Transaction.updates {
                await self.handleUpdate(updatedTransaction: verificationResult)
            }

We also then tried with

for await verificationResult in Transaction.all {
                await self.handleAll(transaction: verificationResult)
            }

, but we still haven't had any success. Is there any other way to listen for transactions? One question: Do we need to set SKIncludeConsumableInAppPurchaseHistory to true for offer codes? Does Apple consider offer codes to be consumable or non-consumable?

iOS OfferCode testing in outside the app .
 
 
Q