6

I would like to find out what price a user paid for my app on the app store for downloading it as i would like to show ads to users that downloaded the app for free an hide those ads from those users who paid for something for the app. As I was not able to achieve this in SWIFT with the SKProduct or Transaction receipt requests i was wondering if anybody can help me with an solution for this?

Thanks!

Martin
  • 61
  • 2
  • Do you mean people whom got a redeem code (thus the app for free) vs. people whom actually paid for it? I'm not fully following your question. Otherwise the price of the product is on the `SKProduct` class. See: http://stackoverflow.com/a/2900276/406677 (obj-c example). – Paul Peelen Aug 25 '16 at 11:14
  • Are you talking about in-app purchase to remove ads? If you don't want to write everything your own then just use this [framework](https://github.com/bizz84/SwiftyStoreKit) – rootcoder Aug 25 '16 at 11:48
  • I want to find out about the purchase price a user paid on the Apple App Store when downloading the app - not an In App Purchase. Eg: I currently sell my app for 99 cents, but sometimes change the price to free. I want to detect those Downloads that have been made for free, to show them ads while leaving out the ads on users that paid. I know i could make a IAP to solve this, but my app is already out - i dont want to upset those users that already paid. As far as i tried and know i only get localized price for IAP Products and not App Store prices and last receipts show me only purchased IAP – Martin Aug 26 '16 at 12:00
  • @Martin were you able to find a solution for this ? – Rukshan Nov 13 '17 at 17:38

1 Answers1

0

You can see answers for your question under below links, i think will help you for SDK Product

Price of in-app purchases shown on screen(with currency)

in

import StoreKit

extension SKProduct {

        func localizedPrice() -> String {
            let formatter = NSNumberFormatter()
            formatter.numberStyle = .CurrencyStyle
            formatter.locale = self.priceLocale
            return formatter.stringFromNumber(self.price)!
        }

    }

or

Latest receipt info you can get

IAPs actually validating the receipt (Swift)

if let receiptInfo: NSArray = parseJSON["latest_receipt_info"] as? NSArray {
                       let lastReceipt = receiptInfo.lastObject as! NSDictionary

                        // Get last receipt
                        println("LAST RECEIPT INFORMATION \n",lastReceipt)
}

Also

http://www.brianjcoleman.com/tutorial-receipt-validation-in-swift/

I think will help you.

Community
  • 1
  • 1
SwiftDeveloper
  • 7,244
  • 14
  • 56
  • 85