2015-05-26 17:35:15 +09:00
2015-03-30 21:00:25 +09:00
2015-05-26 17:29:34 +09:00
2014-12-04 16:40:11 +09:00
2014-12-04 16:40:11 +09:00
2015-05-26 17:29:34 +09:00

go-iap

Build Status codecov.io

go-iap verifies the purchase receipt via AppStore or GooglePlayStore.

Current API Documents:

  • AppStore: GoDoc
  • GooglePlay: GoDoc

Dependencies

go get github.com/parnurzeal/gorequest
go get golang.org/x/net/context
go get golang.org/x/oauth2
go get google.golang.org/api/androidpublisher/v2

Installation

go get github.com/dogenzaka/go-iap/appstore
go get github.com/dogenzaka/go-iap/playstore

Quick Start

In App Purchase (via App Store)

import(
    "github.com/dogenzaka/go-iap/appstore"
)

func main() {
	client := appstore.New()
	req := appstore.IAPRequest{
		ReceiptData: "your receipt data encoded by base64",
	}
	resp, err := client.Verify(req)
}

In App Billing (via GooglePlay)

import(
    "golang.org/x/oauth2"

    "github.com/dogenzaka/go-iap/playstore"
)

func main() {
    // You need to prepare an authorization code or a refresh token.
    // If you have a refresh token, you can generate an oauth token like this.
    token := &oauth2.Token{
		RefreshToken: "your refresh token",
	}

	client := playstore.New(token)
	resp, err := client.VerifySubscription("package", "subscriptionID", "purchaseToken")
}

ToDo

  • Validator for In App Purchase Receipt (AppStore)
  • Validator for Subscription token (GooglePlay)
  • Validator for Purchase Product token (GooglePlay)
  • More Tests

Support

In App Purchase

This validator supports the receipt type for iOS7 or above.

In App Billing

This validator uses Version 3 API.

License

go-iap is licensed under the MIT.

Description
No description provided
Readme MIT 312 KiB
Languages
Go 99.6%
Makefile 0.4%