ios - Differentiating between initial buy and free "re-buy" in StoreKit/In-App Purchase -


from storekit guide:

if user attempts purchase nonconsumable product or renewable subscription have purchased, application receives regular transaction item, not restore transaction. however, user not charged again product. application should treat these transactions identically of original transaction.

this presents huge problem in app working on. have licensed large body of content publisher sale through in-app purchase. require every time sell piece of content (i.e. user pays us), our server calls api on servers report transaction. accounting purposes , used determine how pay them @ end of month, per our agreement them.

i have read several suggestions on , elsewhere calling restorecompletedtransactions rather , maintaining local understanding, on device, of user has purchased cannot allowed purchase again. me seems should able implemented on server side. however, receipts getting apple servers same buy , re-buy, promised storekit guide.

if payment callbacks storekit cannot trusted valid accounting mechanism in kind of situation ("you got paid" vs. "you didn't paid"), other real-time insights transaction traffic available? don't think publisher working going happy if tell them have wait 45 days after end of month real paid dollar amount out of itunes connect.

i have looked same problem. in case, wanted implement accurate revenue tracking using mobile app tracking track revenue generated different customer acquisition campaigns.

fortunately enough, there way it. should noted skpaymenttransactionstatepurchased vs. skpaymenttransactionstaterestored solely depends on initating action, e.g. whether initiated restore or (re-)purchase, doesn't work.

what work instead checking skpaymenttransaction.originaltransaction != nil restores and re-purchases. latter unfortunately undefined behavior (docs). i'd consider null check fair enough though.

another option validate transaction-receipt of transactions skpaymenttransactionstatepurchased , check original_transaction_id property in returned, validated receipt matches transaction_id.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -