Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

In app promo codes with dreamlo
Started by Scott Harrison Feb 10 2016 09:27 PM

1 reply to this topic
promo codes
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,765 posts
  • Enterprise

Check out this sample for putting in app promo codes using http://www.dreamlo.com

--Main.lua
local isHttps= false
local publicCode = ""
local returnString = ""
local function getCode( code, lis )
	if (code) then
		local httpSting = "http://"
		if (isHttps == true) then
			httpSting = "https://"
		end
		local function networkLis( e )
			if (e.isError) then
				lis("Cannot Connect")
			else
				if (e.response=="ERROR|Unknown Code") then
					lis("Unknown Code")
				elseif (e.response:sub(1,3 ) == "OK|") then
					lis("Code Redeemed", e.response:sub(4))
				elseif (e.response=="ERROR|Code Already Used") then
					lis("Code Already Used")
				end
			end
		end
		network.request(httpSting.."dreamlo.com/pc/"..publicCode.."/redeem/"..code , "GET", networkLis )
	else
		return "No Code"
	end
end
--
local function codeLis( results, value )
	print( results )
	if (value) then
		print( value )
	end
end
getCode("", codeLis)

Thanks,

Scott

 

This works well with Jason's blog post

 

PS: Corona I have two plugins stuck in limbo(you have not contacted me in a week)



[TOPIC: post.html]
#2

attudesign

[GLOBAL: userInfoPane.html]
attudesign
  • Contributor

  • 122 posts
  • Enterprise

I did something just like this in my last game, my own website though.  On top of using the url schemes that Jason uses you can setup your promo system to purchase a free iap on IOS. Then if your user uninstalls/removes the app for some reason and comes back they get everything again thru a restore call. 




[topic_controls]
[/topic_controls]