views:

106

answers:

2

i wish to set up an online site that sells 'expansion packs' for an iphone app im having made. when an expansion pack is purchased on my site, i need a random 'authorization' code generated that is unique to that transaction. this random code enables that user to download the through the iphone app when they input the code into the app. anyone know how to program a site to do this?

A: 

yes.... but doesn't this break the terms and conditions?

Tony Lambert
no, because it downloads to the apps internal memory. information is downloaded to the app, NOT any programs etc
+1  A: 

I would just have a random string creation algorithm.

Store that string in the database as an order item relating to the expansion pack and the user's account. Also whether or not they have downloaded the content, although be prepared for the case that someone has the iPhone wiped or stolen and wants to download it again - maybe have a download limit per year of 3 times).

Then your application can just require the user's account details and the random string to access the download.

Presumably you want the string to be short enough to be easily typed in. I was going to suggest having an MD5 hash of something along the lines of "Username:ExpansionPackName:RandomString" but that would be 32 characters long.

Maybe just let your iPhone app order the packs inline with the application... either using the webkit control, or a custom interface that communicates via a web service or JSON or whatever the iPhone provides.

JeeBee