Sub MyStore_PurchaseCompleted (Success As Boolean, Product As Purchase)
LogColor("Purchase completed",Colors.Magenta)
Log("DateTime.Now-Product.TransactionDate "&((DateTime.Now-Product.TransactionDate)/DateTime.TicksPerHour))
If Product.IsInitialized Then
Log("Product: " & Product.ProductIdentifier & ", date=" & DateTime.Date(Product.TransactionDate) & _
", Transaction identifier=" & Product.TransactionIdentifier)
PurchasedProduct.Initialize
PurchasedProduct.ProductId=Product.ProductIdentifier
PurchasedProduct.PurchaseDate=Product.TransactionDate
PurchasedProduct.TransactionID=Product.TransactionIdentifier
Dim no As NativeObject = Product
Dim b() As Byte
If no.IsInitialized Then b = no.NSDataToArray(no.GetField("transactionReceipt"))
Dim stringu As StringUtils
Log(stringu.EncodeBase64(b))
' Receipt=BytesToString(b,0,b.Length,"UTF8")
' StateManager.SetSetting("receipt",Receipt)
' If DateTime.Now-Product.TransactionDate<60000 Then EnableProMode
End If
Log("Success = " & Success)
If Not(Success) And Product.IsInitialized Then
Msgbox(Main.loc.Localize("Unable to complete purchase at this time."),Main.loc.Localize("We're sorry"))
Else
'may want to add a server call here to store subscription info
' If DateTime.Now-Product.TransactionDate<60000 Then EnableProMode
EnableProMode(True)
End If
End Sub