Promotional Offers

This guide will help you to configure Promotional Offers to use in your app.

πŸ“˜

iOS Only

This guide applies to iOS only.

Apps with auto-renewable subscriptions can offer a discounted price or free period for existing or lapsed customers. This feature is called a subscription offer and is available for users with iOS 12.2 or higher. Unlike introductory offer, subscription offers can be applied as many times as you decide but requires generating a signature on your server before purchasing. Apphud does the job for you.

Set up Subscription Offers in App Store Connect

To create a new subscription offer go to App Store Connect, then go to your app's subscription product page. Click on the "+" option under Subscription Prices and then click on Create Promotional Offer:

You will need to specify the Reference Name, which is just a title, and the Promotional Offer Product Code, which is actually your offer's identifier:

Then you will need to specify pricing and promotional offer type. Offer types are the same as in introductory offers:

  • pay as you go;
  • pay upfront;
  • free.

Don't forget to save the changes.

Subscription Keys

As said above, a special signature must be generated before purchasing a subscription offer. Apphud will do the job, but you will need to create a subscription key and upload it to Apphud.

Go to "Users and Access" section, then select Keys tab. If you don't have any subscription keys, click on "Generate Subscription Key". You will be prompted to enter its name.

Once created, click on "Download API Key" and move the downloaded file to a safe place. You will need to upload it to Apphud.

πŸ“˜

Note

Subscription Key file name has the following format: SubscriptionKey_[KEY_ID].p8, where KEY_ID is your Key Identifier.

❗️

Important Note

Please do not rename Subscription Key file.

Upload Subscription Key to Apphud

Go to Apphud and open "App settings", there click on "Products" tab. There you will see "Upload" button for subscription key file. Just upload your Subscription Key file here:

Redeem Subscription Offer

You decide the criteria for which subscribers qualify for an offer. In your app, the details of the offers you set up in App Store Connect will appear in the discounts array in SKProduct object.

You may check user eligibility to purchase promotional offers using this SDK call:

Swift

// Checking eligibility for promotional offer
Apphud.checkEligibilityForPromotionalOffer(product: myProduct) { result in
  if result {
    // User is eligible to purchase a promotional offer
  }
}

To initiate a purchase, just call the following method:

Swift

// inside your purchase method, where discountID is identifier of SKProductDiscount object
Apphud.purchasePromo(product, discountID: discountID) { result in
    // handle result
}
static Future<ApphudPurchaseResult> purchasePromo({
    required String productId,
    required String discountID,
  })

This method automatically submits the App Store receipt to Apphud, so you don't need to call submitReceipt method.