go-iap
go-iap verifies the purchase receipt via AppStore or GooglePlayStore.
Current API Documents:
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(
"code.google.com/p/goauth2/oauth"
"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
oauth := &oauth.Token{
RefreshToken: "your refresh token",
}
client := playstore.New(oauth)
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.