Android Question InApp billing Purchase TimeStamp

Robert Valentino

Well-Known Member
Licensed User
Longtime User
When I do a order in my program the Google Purchase TimeStamp is my timezone Eastern Standard Time but the TimeStamp that shows up on the Google Order in my Google Merchant account is based Pacific Standard Time (I assume because Google is in California)

(in Android - B4A)
Example: I get the time stamp of 1475421576874 which equals 10/02/2016 11:19:36 AM
Google Shows 10/02/2016 08:19:36 AM
Which is the 3 hour difference

If the user requests a refund or cancellation I use B4J to generate a file containing Invalid timestamps using the Google Merchant TimeStamp (as I do not know the Android Timestamp)

IS it safe for me to do ( BJ4 ):

B4X:
Dim PST            as Long = (DateTime.TicksPerDay / 24) * 3

To calculate the difference in Timestamps (what would be a 3 hour difference amount).


I use this timestamp to handle cancellations. It takes google so long to do a cancellation and in my software the user could make a lot of money while waiting for the cancellation to take place. So I create a file on my server with their MacAddress as the name and in the file it contains an array of Invalid transactions time stamps. When processing ownedproducts I skip the ones that have a Invalid timestamp. Only reason I am wasting my time doing this is that it has been 3 days since I cancelled an order in Google Merchant and it is still coming to my program as purchased. NOT Good.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use DateTime.TicksPerHour instead of TicksPerDay.

There is a problem here. Your code will not handle daylight saving time shifts. It is also dangerous to assume that the ticks will be exactly the same as the ticks resolution is milliseconds not seconds.

Is the purchase date the only information you get from Google? What about the order id or developer payload?
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Yes pretty much
I get the date, this GPA number, My SKU number and My SKU Descriptions and where it was purchases from Zip Code
Oct 2, 2016 2:09:17 PM
GPA.1358-3331-5674-17961

I will handle the Daylight Saving Shift and was only going to bring the order down to the HH:MM (I do not believe they will / can do more then an order a minute).

But I am also working on changing the program so that when they purchase something, I sent an Email to me with the exact purchase time as far as the program got back from google. Sure wish I would get the Developer Payload information because I could embed something there.

Thanks

BobVal
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
As per this conversation

Holding the mouse over a Google Purchase shows the following:
upload_2016-10-16_21-3-4.png


Doing the following code
B4X:
          Dim r As Reflector
           r.Target = GooglePurchase
           Dim token As String = r.GetField("mOrderId")

This allows me to get the GPA.... OrderId that google sends me

IS there anyway to get these fields exposed so that we do not have to use reflector?

Just would be a little nicer. Is this something I can WISH for or not possible?

Thanks

BobVal
 

Attachments

  • upload_2016-10-16_20-57-43.png
    upload_2016-10-16_20-57-43.png
    5.5 KB · Views: 160
Upvote 0
Top