Skip to content

Latest commit

 

History

History
45 lines (37 loc) · 933 Bytes

README.md

File metadata and controls

45 lines (37 loc) · 933 Bytes

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)
   }
}