Skip to content

Instantly share code, notes, and snippets.

@mltucker
mltucker / playstore.go
Created December 16, 2016 19:20
Standalone (Play Store only) go-iap for GAE
package yourgaeproject
// go-iap doesn't work for GAE since we need to use urlfetch
//
// Copy this source file to your GAE to your project.
//
// The API is mostly the same as go-iap. I prefixed some stuff since this file lives within my GAE project's package.
// client, err := PlaystoreNew(ctx, jsonKey)
//
// purchase, err := client.VerifyProduct("com.you.yourapp", productId, purchaseToken)
var sig = new KJUR.crypto.Signature({ alg: "SHA224withECDSA" });
var ecdsa = new KJUR.crypto.ECDSA({ curve: "secp224r1" });
ecdsa.setPrivateKeyHex(b64tohex(this.keys.client.priv));
sig.init(ecdsa);
return sig.signHex(message);