Skip to content

Golang library for validating huawei store in app purchases

License

Notifications You must be signed in to change notification settings

gokhanm/huawei-iap

Repository files navigation

huawei-iap

huawei-iap verifies the purchase receipt via Huawei Store

Current API Documents: https://developer.huawei.com/consumer/en/doc/development/HMSCore-References/api-summary-desc-0000001063744095

Installation

go get github.com/gokhanm/huawei-iap

Verify Subscription

import (
    hms "github.com/gokhanm/huawei-iap"
)

func main() {
	client := hms.New()
	req := hms.IAPRequest{
		PurchaseToken:  token,
		SubscriptionID: subscriptionID,
		ClientID:       clientID,
		ClientSecret:   clientSecret,
	}

	purchaseData, err := client.VerifySubscription(context.TODO(), req)
}

Verify Signature

import (
	"fmt"
    hms "github.com/gokhanm/huawei-iap"
)

func main() {
   if err := hms.VerifySignature("receipt", "signature", "publicKey"); err != nil {
	   fmt.Printf("huawei verify signature error. error: %v", err)
   }
}

About

Golang library for validating huawei store in app purchases

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages