Giter VIP home page Giter VIP logo

iab's Introduction

iab

This library provides a receipt verification feature.

Android

package main

import (
        "fmt"
        "github.com/mokelab-go/iab/android"
)

func main() {
        // Receipt JSON string given by Android In-app billing response
        input := `{"orderId":"12999763169054705758.1371073745894165","packageName":"com.mokelab.dummyApp","productId":"dummy_app_item","purcha\
seTime":1367655044246,"purchaseState":0,"purchaseToken":"epprpkcryioqkjdpbmflohvh.AO-J1OwKL0OEHgT_H1hezDIw8pBZuT_6JfZHWiwBLtAXCPLlkjUwfszTqt59\
mBEulqp4WAsqPsJlG4T6nD-1Er53w9LicLloOTVOOyzwX0U02gLBH2ZS_WxQXlfLGvDDIdZoFkDsZwvN"}`

        // Receipt signature given by Android In-app billing response
        signature := `ko28oNiLOOJ1FOeZTJSj4I3U6t125X1OAz/IFPzrOLMDj7FXF3y+TZcY38VK58ZAIWHypgS0pKLisOYpeR+KPEtFNvEevNiUbsc/a6NnNfI+LyJ3FrB1weqO\
iYUgU3C0B03SRwXmcWB1cN/eac1fKNOsjxIW07CrRHDailN1lxM=`

        // You can get your public key on Developer console.
        publicKey := `__PUT_YOUR_PUBLIC_KEY__`
        v := android.NewVerifier(publicKey)
        receipt, err := v.Verify(input, signature)
        if err != nil {
                fmt.Printf("Failed to verify : %s", err)
                return
        }
        // Receipt is parsed as android.Receipt object.
        fmt.Printf("order id=%s\n", receipt.OrderId)
}

iab's People

Contributors

fkmhrk avatar

Stargazers

 avatar bo-tao avatar  avatar

Watchers

James Cloos avatar  avatar bo-tao avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.