Implementation of promotional offers in iOS. How to earn on subscriptions more?







In iOS 12.2, Apple added a cool new feature - promotional offers. Auto-renewable subscription apps can now offer current or former customers personalized discounts or an additional free period. Promotional offers apply to paying, paying, being in the trial and canceling the trial users. Unlike an introductory offer, a promotional offer can be purchased as many times as desired at the developer's discretion. But the implementation requires a server to generate a digital signature.







Set up promotional offers on the App Store Connect



To create a new promotional offer, go to the App Store Connect and open the page with your subscription. Click "+" in the subscription price section and select "Create Promotional Offer" :













Indicate the original name of the promotion and its identifier - Product Code :













Indicate the cost and type of promotional offer:









Save the changes.







Subscription key



To use promotional offers, you need to generate a digital signature using the subscription key. You need to create it in the App Store Connect.







Go to the "Users and Access" section, then to the "Keys" tab. Create a new Subscription Key by specifying its name.













After creating the key, click "Download API Key" and save the file in a safe place.













The subscription key downloaded from App Store Connect has the following name format: SubscriptionKey_ [KEY_ID] .p8, where KEY_ID is the key identifier.


Signature Generation



Here begins the most difficult and, in my opinion, unnecessary. Apple were reinsured by adding signature generation so that the user could not hack into StoreKit and place a promotional offer without the knowledge of the developer. Let me remind you that these discounts are available only to paying users. Will current customers try to hack the system for a discount?







From the point of view of the mobile client, signature generation is necessary so that, having the SKProductDiscount



class, create the SKPaymentDiscount



class, which will be added to SKMutablePayment



to make a purchase. Let's consider in more detail.







SKProductDiscount



Objects of this class are stored in the discounts



array of SKProduct



. All created promotional offers are objects of the SKProductDiscount



class. As in the case of introductory offers, you can get the duration, price and number of promotional periods. It turns out that this class is needed to display the purchase conditions in the application interface.







SKPaymentDiscount



This class is created by the developer using data received from your server. Take a look at the source files and see the only initialization method:







 public init(identifier: String, keyIdentifier: String, nonce: UUID, signature: String, timestamp: NSNumber)
      
      







The code itself for generating a signature on the server is not an easy task, but Apple has provided sample code on Node.js. The signature key must be uploaded to your server and you must return all of the above data to the mobile client.







Read more about signature generation here .







Checkout



A promotional offer is bought in the same way as a regular purchase. The only difference is the addition of an object of class SKPaymentDiscount



.







 let payment = SKMutablePayment(product: product) payment.paymentDiscount = discount SKPaymentQueue.default().add(payment)
      
      





What's next?



You managed to successfully generate a signature and place your first purchase at Sandbox. It is wonderful! But the promotional offers themselves will not solve the problem of increasing profits and returning users. Your task is to show them to the user at the right time. In which? For example, you can try to return users who have canceled their subscription by sending them a notification.







Return of failed customers



With the help of promotional offers you can try to return the departed customers. To do this, you need to implement a whole range of functions: promotional offers, server notifications about subscription statuses, push notifications, storing user checks on the server and searching for a user by transaction number. It is not simple.







Survey of fallen customers



Attracting a new user is many times more expensive than retaining an existing customer. Therefore, it is especially important to understand the motives that force users to cancel trial and subscriptions.







Many users unsubscribe because they no longer need an application, and your discount may not work. In this case, instead of offering a discount, you should find out what he does not like and what might affect his decision to return to the application.







Offer discounts in exchange for action



Most often, this is an invitation to a friend in exchange for a discount or free use. It may really work, but it will take a lot of time to implement the referral system.







How it is implemented in Apphud



Apphud tracks unsubscribes, polls past users, and offers discounts without writing code. Discount screens are created in the designer in your account. For the user, it looks like this:









Apphud displays a survey screen when a trial or subscription is canceled and, if necessary, immediately offers a discount.







We named each individual mechanics for user return as a rule . Read more about how to configure the rules here .







Conclusion



The subscription business model has already become the standard in non-gaming mobile applications. User retention and understanding of the reasons for their departure is an important task that needs to be addressed already at the stage of launching a mobile project. Apphud will help with this. Try it, it's free.








All Articles