I use the RMStore library - here, what I have.
1) Purchase an automatic renewable subscription and confirm the return receipt.
[[RMStore defaultStore]addPayment:[Environment environment].premiumProductIAPId success:^(SKPaymentTransaction *transaction) { [[RMStore defaultStore].receiptVerificator verifyTransaction:transaction success:^{
2). Each time the application starts, the subscription check is active for the date and includes a premium service, if it is
RMAppReceipt *appReceipt = [RMAppReceipt bundleReceipt]; if (appReceipt){ NSInteger isActive = [appReceipt containsActiveAutoRenewableSubscriptionOfProductIdentifier:[Environment environment].premiumProductIAPId forDate:[NSDate date]];
3) If the user launches the application on another device, he allows them to restore purchases, updating the receipt, if it exists, and checks if there is an active subscription for purchases.
"In most cases, all your app needs to do is refresh its receipt and deliver the products in its receipt."
- This is from the manual. Here is the code:
[[RMStore defaultStore]refreshReceiptOnSuccess:^{ if ([receipt containsActiveAutoRenewableSubscriptionOfProductIdentifier:[Environment environment].premiumProductIAPId forDate:[NSDate date]]){ //enable }else{ //no longer active } } failure:^(NSError *error) { }];
My questions:
- When RMStore checks if the subscription is active, it can return no, I look at the receipts, and thatβs right, and I assume that it was not automatically updated. When I go to buy another subscription, I get a message from itunes that I have already signed up. The next time I start, I see a new receipt. This means that the receipt must be updated at startup, but I do not want to update it, because it causes a username and password that are not needed. What is the best practice here?
- Am I restoring subscriptions to another device correctly? It seems that sometimes it takes several attempts to restore a subscription.
- Is there a need, besides keeping records, to store the subscription on my server?
source share