Check and Charge Customer - Where to call functions from
Hello ... I have two functions I need to call to see if a person has the correct amount of tokens to play something and if they do then charge them when they hit play. The functions are listed below:
This one just pulls the amount of tokens a customer has in their account and compares to item.cost in XML feed:
Function tokenValidation() As Integer sn = GetDeviceESN() xfer = CreateObject("roURLTransfer") xfer.SetURL("http://allbabestv.com/mcams/roku/getCredits.php?deviceID=" + sn) response = xfer.GetToString() xml = CreateObject("roXMLElement") if xml.Parse(response) if (strtoi(xml.tokens) > item.cost) return 0 end if end if return 1 end Function
and it the first function passes I want the feed to play and then run the second function. If the first function fails I want the feed to not allow play:
Function chargeCustomer() sn = GetDeviceESN() cost = item.cost model = item.modelId xfer = CreateObject("roURLTransfer") xfer.SetURL("http://allbabestv.com/mcams/roku/chargeCustomer.php?deviceID=" + sn + "&cost=" + cost + "&model=" + model) response = xfer.GetToString() end Function
Any help would be greatly appreciated ... Thank you.