How to Test In App Purchase Promo Code?

I wish to know that there is a way for us to make sure the In App Purchase Promo Code works, Currently I had already implemented it but it doesn't works in Live. I don't think it is appropriate to do the testing on live, is there a way for testing the In App Purchase Promo Code?


Thank you Very much.

Replies

Promo codes can only be tested in the production store. Only the production store recoginzes the redeemed promo codes. What you can do -

Submit your app for App Review.

Set the release date of the App sometime in the future so that once App Review approves the app, it's not avaialble to the general user. However, it will still work with promo codes

Use an app promo code to install the app

Use the in app promo code. (BTW, immediately after app review approval, the in app identifiers may not be validated using the SKProductsRequest command. Give things 48 hours for the in app purchase identifiers to be activated on the store.)


If the in_app promo codes aren't activating after the SKProductsRequest works, I'd verify that the transactionObserver is active at launch time.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

Hello rich,


I have a macOS product reviewed and ready for release. It has In-App purchases. I have generated promo codes for the app and for IAP as well. The promo codes for the app work fine, but the app is not fetching SKProducts using SKProductRequest. Is it because the product IDs are not yet activated? How long before they work?

Please take a look at Tech Note 2413 "In-App Purchase FAQ"

<https://developer.apple.com/library/archive/technotes/tn2413/_index.html#//apple_ref/doc/uid/DTS40016228-CH1-TROUBLESHOOTING-APP_REVIEW_HAS_RECENTLY_APPROVED_MY_APPLICATION__BUT_MY_IN_APP_PURCHASE_IDENTIFIERS_IN_THE_PRODUCTION_VERSION_OF_THE_APPLICATION_ARE_BEING_RETURNED_IN_THE_INVALIDPRODUCTIDENTIFIERS_ARRAY_>


App Review has recently approved my application, but my In-App Purchase identifiers in the production version of the application are being returned in the invalidProductIdentifiers array.


When an application is approved, the developer must also approve the application for release to the App Store. On approval, the application ID is activated to the App Store. The same activation is required for the in-app purchase identifiers and can only take place once the application is activated. In some cases, the activation of the In-App Purchase identifiers may lag up to 48 hours following the activation of the application.


If the developer does not approve the release of the production application to the App Store, then any new in-app purchase identifiers will not be activated. This is an issue when a developer wants to verify the application prior to activating it on the App Store. If the desire is to test the in-app purchase process for the new items, the application must be activated to the App Store. This is only an issue for new in-app purchase identifiers in a corresponding application submission. Once these in-app purchase identifiers have been activated, application updates to the submission will find that these in-app purchase identifiers are validated, even if the update is not activated.


If after 48 hours of production release, the identifiers are still returned in the invalidProductIdentifiers array, this is a bug report.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

Hi Rich,


In your suggested method to test apps which are not available on App Store but has been approved using promo codes, you mentioned the step:


Submit your app for App Review.


Does the app have to be a "new" app or can it be an "update" to an app?


Thanks

aystv,


In response to your question, you must use the production version of the app to test promo codes. It can be an update as well.


I need to correct an error which my earlier response made. In the production environment, promo codes should work once App Review has approved an app, but before the app has been officially released by the developer to the production App Store. In the promo code redemption process, the user uses iTunes to redeem the promo code. When the App Store receives the promo code redemption request, the App Store sets up an incompleteTransaction for the application ID/iTunes User, in the same way that it handles an auto-renewable subscription renewal.


When the production app is launched, it should install the transactionObserver, which will query the App Store for any pending incompleteTransaction. If one is found, the Authentication dialog is presented, the the purchase is processed in the same way as if the user had just use the "Buy" button. The updatedTransactions delegate method is called with the successful purchase state and the app processes the transaction.


What is a problem is that for an newly approved application where a new In-App Purchase identifier is included, the identifier will not be activated until the application is activated. In this case, the SKProductsRequest will fail to validate the new identifier until the app is approved for release by the developer. In addition, the new identifier may take up to 48 hours to be activated after the application is activated.


rich kubota - rkubota@apple.com


developer technical support CoreOS/Hardware/MFI

Hey Rich,


If we release the app and pull it once the product id's are available will the product id's still be available if we have an app ready for release.


We want to do some limited product testing and it requires a subscription is there a solution that we can use? Would external Testers in testflight have to resubscribe every 5 minutes?


It's a user test of 50 people before we push it live as a pilot project

Hi Rich,
does this limitation also apply to subscription offer codes introduced with iOS 14? Is there any way to test these before launching the app in production?

Thanks, Ortwin
Hi @ortwin, did you manage to find a way to test subscription offer codes in the sandbox?

I've implemented presentCodeRedemptionSheet() in an app to accept codes and generated some in App Store Connect, but if I run the app locally in debug and try to enter a code it asks me to download the App Store version of the app.

I'm signed in with a sandbox user on the device and can test the normal In App Purchase flow fine but can't find any information anywhere on how to test these new iOS14 offer codes.

We have to validate the receipt after a subscription is successful and send some data to a server so need to test it before going to production.

Surely there's a way to test this before prod?
  • @charon1664

    You can try to restart the phone or update the phone system to solve this problem,after I updated iOS14.7,it work fine

  • HI @charon1664 can you explain me how to generate redeem codes for sandbox? Does that codes is same like production codes and you generate in AppStoreConnect > MyApps > Features > Promo Codes > Generate tab ?

  • Hi @charon16664, have you find way to test this offer code in sandbox, every-time i try to redeem my code by using presentCodeRedemptionSheet(), its showing me try another code error

Add a Comment

@charon1664 I did not find any way to test offer code in sandbox. Even in .storekit file there are only Introductory Offer and Promotional Offer sections.

  • Hey, Has anyone found a way to test the offer codes before submitting the build to App Store? Please share. Thanks.

  • also interested in this. The apple docs tutorial cannot be followed, because my App Store connect looks different. Presumably because the app was not yet submitted for review.

Add a Comment

Hey,

I have implemented auto renewable subscription. I would like to give Promo Code offer on same. I've implemented presentCodeRedemptionSheet() in an app to accept codes and generated some in App Store Connect.

As per this thread, I have submitted app for approval and got approval. Now, even after approval from apple, unable to move forward after entering promo code.

Currently, testing on build from TestFlight, which is not taking forward after entering promo code. Please guide here, how to move forward??

Thanks in advance for help.

  • @DimpleAShah, Did it work for you? We're in the same situation and unable to move forward after user enters the Offer code.

  • did you find any solution for this issue? same issue we are also facing

Add a Comment

Can someone please explain how to test custom codes in sandbox? Does nobody think about that case? For me it tells me to download the app too! Maybe there is no way to do so in testflight as they don't use a sandbox app store user. But please just explain how that works @apple! Your documentation doesn't say anything!

Add a Comment

Hello guys, if you create a "Custom Code" instead of "One time code", the code will be added to the StoreKit file and you would be able to test it locally.