Question

Subscription promotional offer and StoreKit testing on iOS

  • 24 November 2021
  • 10 replies
  • 1177 views

Badge +1

I’m trying to use StoreKit testing to test purchase of a promotional offer on a subscription product. I can purchase the initial subscription, but when I come to purchase the promotional offer I see the following error:

 

[Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: redacted (null) (Error Domain=SKErrorDomain Code=12 "(null)" UserInfo={NSUnderlyingError=0x600001f34390 {Error Domain=ASDServerErrorDomain Code=3903 "The server encountered an error" UserInfo={NSLocalizedDescription=The server encountered an error}}}) (null) - 2

 

From what I can see, code 12 is a problem with the signature generated for the `SKPaymentDiscount`. Since generation of the signature is handled by the RevenueCat SDK, what are the options for me to fix the problem?

 

I have uploaded the public certificate to my RevenueCat dashboard. Maybe related: there is “Subscription Offers Key” also in Xcode that isn’t used in any way. Perhaps there is some missing configuration in RevenueCat for promotional offers and StoreKit testing files?

 

I’m using Xcode 13 and SDK version 3.12.8.

 

Thanks in advance!


10 replies

Badge

Hello, I also encountered the same problem, have you solved it?

Badge +1

Hello, I also encountered the same problem, have you solved it?

No, I haven’t. Hopefully someone from RevenueCat can respond and let us know if this is a limitation that will be addressed soon, or if we’re doing something wrong.

Userlevel 5
Badge +9

Hey @software_developer and @AzazQ

Are you able to test on a physical device instead of a simulator to rule out any simulator or StoreKit config file issues? 

There is a .p8 file you upload to the RevenueCat dashboard that’s used to sign promotional offer keys. Can you double check you’ve generated that in App Store Connect and uploaded to RevenueCat? https://docs.revenuecat.com/docs/ios-subscription-offers#2-uploading-the-subscription-key-to-revenuecat

Badge +1

Hi Ryan, thanks for getting back to me. Promotional offers work correctly for us in production and sandbox, and the .p8 file is used in those scenarios to sign the offers. However, when using StoreKit testing, my understanding is that RevenueCat should not use the production .p8 file, instead it should use a different key for signing the offers specifically for the StoreKit configuration file (see screenshot below). I believe the reason that it’s not possible to purchase a promotional offer using StoreKit testing is because RevenueCat is trying to sign the offer using the production key instead of the testing key, which it knows nothing about as there is nowhere to upload it to.

Interested to hear your thoughts.

Best,

Alex

 

 

Userlevel 5
Badge +9

@software_developer ah thanks for the extra info! I had no idea there was a separate key for StoreKit testing. Let me see if I can get an answer from someone else here.

Userlevel 5
Badge +9

Have you uploaded the StoreKit testing certificate into the RevenueCat dashboard? You’ll need to re-upload a new certificate any time you make changes.

 

Badge +1

Thanks Ryan, yes, we’ve uploaded a p8 file, and that is being used right now for vanilla purchases (e.g. subscriptions).  For promotional offers, we encounter an error (see first post in this thread). Looking at the Apple documentation https://developer.apple.com/documentation/xcode/setting-up-storekit-testing-in-xcode, it says this about “Subscription Offers Key” (emphasis mine):


Provides a key that you use for signing a subscription offer in the test environment. Use this key instead of your regular key to generate the signature on your server. See Generating a Signature for Promotional Offers for more information.

 

Badge +2

Any update on this? I’m trying to test a Promotional Offer with StoreKit Testing (in app and unit testing).

  • Local .storekit file with the promotional offer
  • Reading promotional offers via RevenueCat SDK returns the expected offer for a product
  • Purchasing with the offer returns an error (log below)

RevenueCat is configured:

  • StoreKit testing framework: uploaded the local ‘StoreKitTestCertificate.cer’
  • P8 key file from App Store Connect: tried two things:
    • Uploaded the production p8 file
    • Uploaded a file created by Select ‘.storekit’ file > Editor > Subscription Offers Key

Following this thread, two questions?

  1. Should I expect this to work? If so what’s the correct way to configure?
  2. If it works for test but requires a different p8 file doesn’t that break production?

 

2022-10-21 13:29:45.704205-0700 StoreKitIntegration[33163:9115447] [Default] [StoreKit] Purchase did not return a transaction: Error Domain=ASDServerErrorDomain Code=3903 "The server encountered an error" UserInfo={storefront-country-code=USA, client-environment-type=XcodeTest(/Users/rcarver/Library/Developer/CoreSimulator/Devices/98BF23F3-F43D-4836-99CE-EC4FA1EAAA29/data/Containers/Shared/AppGr ... d.Series), AMSServerErrorCode=3903, NSLocalizedDescription=The server encountered an error}

2022-10-21 13:29:45.706388-0700 StoreKitIntegration[33163:9115447] [Purchases] - ERROR: 😿‼️ The information associated with this PromotionalOffer is not valid.

See https://rev.cat/ios-subscription-offers for more info.

2022-10-21 13:29:45.707513-0700 StoreKitIntegration[33163:9115447] [Purchases] - ERROR: 💰 Product purchase for 'Series.Monthly.v1' failed with error: PurchasesError(error: The information associated with this PromotionalOffer is not valid.

See https://rev.cat/ios-subscription-offers for more info., userInfo: ["NSUnderlyingError": StoreKit.Product.PurchaseError.invalidOfferSignature, "source_file": "RevenueCat/ErrorUtils.swift:407", "NSLocalizedDescription": "The information associated with this PromotionalOffer is not valid.\nSee https://rev.cat/ios-subscription-offers for more info.", "source_function": "invalidPromotionalOfferError(error:fileName:functionName:line:)", "readable_error_code": "INVALID_PROMOTIONAL_OFFER_ERROR"])

purchase error Error Domain=RevenueCat.ErrorCode Code=34 "The information associated with this PromotionalOffer is not valid.

See https://rev.cat/ios-subscription-offers for more info." UserInfo={NSUnderlyingError=0x6000023feb20 {Error Domain=StoreKit.Product.PurchaseError Code=6 "Unable to Complete Purchase"}, source_file=RevenueCat/ErrorUtils.swift:407, NSLocalizedDescription=The information associated with this PromotionalOffer is not valid.

See https://rev.cat/ios-subscription-offers for more info., source_function=invalidPromotionalOfferError(error:fileName:functionName:line:), readable_error_code=INVALID_PROMOTIONAL_OFFER_ERROR}

System Specifications:

  • Xcode : 15
  • iPhone: XR
  • iOS: 16.3
  • MacOS: Sonoma 14.0
  • RevenueCat Pod Version: (4.25.6)
  • Language: Swift

 

Hi @ryan @software_developer  any update on this issue?

@ryan I am testing on Real Device and after successfully purchasing Auto-Renewable Subscription I am trying to purchase a Promotional Offer and I am getting same error as below mentioned:

The information associated with this PromotionalOffer is not valid.

See https://rev.cat/ios-subscription-

offers for more info.

 

I have also created StoreKit Certificate from Xcode and uploaded on RevenueCat still no change.

 

Please help me out of this issue. 

Userlevel 3
Badge +6

@yogesh-bhatt26 

Sorry for the late response

To test promotional offers with storekit configuration file, you also need to configure this section on RevenueCat dashboard

 

Reply