Using an in-app purchase

I am finishing work on an iOS application that allows users to browse, buy and download items from a large multimedia library hosted on the Internet in the rails application. Currently, the library has hundreds of items available for purchase, and in the future it will expand significantly.

At first, I intended to create an integral part of the purchase of the application (in iTunes Connect) for each item in the library. However, I decided it would be painful to create all these hundreds of in-app purchases. In addition, I want to be able to add add-ons and changes to purchased items through my CMS, without also making changes to iTunesConnect.

Instead, I now have an application that creates an account in a rails application. When they go to purchase an item, they first buy a common item in the application. After completing this transaction, the application connects to my rail application, records the purchase, and downloads the purchased content.

One thing that makes me nervous about this approach is that the user can successfully make a purchase in the Apple application, but then somehow cannot successfully connect to the rails application. In this case, the purchase will not be recorded, and the content will not be downloaded, even if the user made the payment. In addition, Apple’s built-in recovery methods will not work because the purchase item is a common one. Only my rails app will remember which items the user has purchased.

So, I am going to add a lot of errors and restore state around this whole process. To make sure that he can recover if he encounters difficulties.

I just wanted to express it there if someone has an opinion or some advice to share.

Thanks!

Charlie

UPDATE

It was a long time ago, but I did not use the general purchase in the application. It just seemed like too much risk. In the end, with individual in-app purchases, Apple tracks purchases and provides a way to recover them. Therefore, it makes sense to take advantage of this, and not force yourself to maintain your own database of users and their purchases.

It was a real pain in the ass, to add all those that were in shopping for goods in iTC. the iTC interface is so terrible. I have a lot of problems. But in the end they all went in there, and now everything works more or less smoothly.

So, in the end, I would say that even if it’s a pain to create all these purchases, it’s worth it. Rather, it's worth it. If creating such a purchase record in iTC does not seem to be worth what you expect to do by selling it, then you probably have big problems with your business model!

+4
source share
2 answers

As soon as a successful message in the application returns from apple ...

1. It is better to save ProductID in the dictionary and remove ProductID from the dictionary as soon as you successfully upgrade the server.

2. Ignore any events until the transaction is completed.

3.Better track transactions, that is, store transaction information (ProductID, user, transaction record) on the server side.

3. Perhaps you can provide the service from the website, so the user can send you an email if he lost money during the purchase of the application.

+1
source

One thing you can do as soon as the transaction is completed is to save the purchase receipt locally (in NSUserDefaults or some other save method that you use) so that if you cannot "complete the purchase "(i.e. record it and download content from the server), you can always resume it later.

If you are still worried that this (for example, saving a purchase receipt locally before updating the server) may for some reason lead to a crash or even to the fact that the user can uninstall / reinstall the application after payment and before will be able to write it to your server, you can always record on your server that the user initiated a purchase in the application before doing this, and then update its state after it completes / cancels it.

Btw, you didn’t mention it, but just to be safe: you only send the purchase receipt from your client to the server, right? This is the only thing you need from the transaction, since you can (and should) then check the receipt with Apple and use it to extract all other purchases information (for example, product identifier, etc.).

+1
source

Source: https://habr.com/ru/post/1345534/


All Articles