Question

Their Python example seems to be the simplest, although I disagree with using the variable named cakeToken because that's confusing me with the Item Name being purchased:

cakeToken = jwt.encode(
  {
    "iss" : sellerIdentifier,
    "aud" : "Google",
    "typ" : "google/payments/inapp/item/v1",
    "exp" : int(time.time() + 3600),
    "iat" : int(time.time()),
    "request" :{
      "name" : "Piece of Cake",
      "description" : "Virtual chocolate cake to fill your virtual tummy",
      "price" : "10.50",
      "currencyCode" : "USD",
      "sellerData" : "user_id:1224245,offer_code:3098576987,affiliate:aksdfbovu9j"
    }
  },
  SELLER_SECRET)

Q: Where are they getting jwt from, or is that a variable that is being created?

I suppose SELLER_SECRET is a variable, populated from the sandbox settings page.

I think we would use dateadd('s',3600,now()) instead of time.time()+3600.

They also advise to use Google OpenID instead of rolling your own login, but that seems to be quite complex.

Was it helpful?

Solution

The python example uses the pyjwt library. The Java version (which I imagine could be done easily in ColdFusion) uses the jsontoken library. I don't see a jar download for the library, but it includes a Maven build file you could use to build one yourself. All the libraries Google suggests are listed here: https://developers.google.com/in-app-payments/docs/libraries

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top