Timothy Lock 60800c1f90 Have app store hit prod and then sandbox if 21007
According to https://developer.apple.com/library/content/technotes/tn2413/_index.html#//apple_ref/doc/uid/DTS40016228-CH1-RECEIPTURL

Always verify your receipt first with the production URL; proceed to verify with the sandbox URL if you receive a 21007 status code. Following this approach ensures that you do not have to switch between URLs while your application is being tested or reviewed in the sandbox or is live in the App Store.
2017-12-11 17:05:53 -05:00
2017-07-25 17:49:48 +09:00
2017-04-11 10:33:28 +09:00
2014-12-04 16:40:11 +09:00
2016-06-08 17:47:51 +09:00
2017-07-25 17:49:48 +09:00

go-iap

Build Status codecov.io

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

Current API Documents:

  • AppStore: GoDoc
  • GooglePlay: GoDoc
  • Amazon AppStore: GoDoc

Dependencies

go get golang.org/x/oauth2
go get golang.org/x/oauth2/google
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
go get github.com/dogenzaka/go-iap/amazon

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 := &appstore.IAPResponse{}
	err := client.Verify(req, resp)
}

In App Billing (via GooglePlay)

import(
    "golang.org/x/oauth2"

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

func main() {
	// You need to prepare a public key for your Android app's in app billing
	// at https://console.developers.google.com.
	jsonKey, err := ioutil.ReadFile("jsonKey.json")
	if err != nil {
		log.Fatal(err)
	}

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

In App Purchase (via Amazon App Store)

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

func main() {
	client := amazon.New("developerSecret")

	resp, err := client.Verify("userID", "receiptID")
}

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.

In App Purchase (Amazon)

This validator uses RVS for IAP v2.0.

License

go-iap is licensed under the MIT.

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