Skip to content

Commit 9c4044f

Browse files
authored
Merge pull request #204 from richzw/master
docs(readme): add ParseNotificationV2 of appstore usage sample to readme
2 parents 1ca35f3 + 2882435 commit 9c4044f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,26 @@ func main() {
131131
}
132132
```
133133

134+
### Parse Notification from App Store
135+
136+
```go
137+
import (
138+
"github.com/awa/go-iap/appstore"
139+
"github.com/golang-jwt/jwt/v4"
140+
)
141+
142+
func main() {
143+
tokenStr := "SignedRenewalInfo Encode String" // or SignedTransactionInfo string
144+
token := jwt.Token{}
145+
client := appstore.New()
146+
err := client.ParseNotificationV2(tokenStr, &token)
147+
148+
claims, ok := token.Claims.(jwt.MapClaims)
149+
for key, val := range claims {
150+
fmt.Printf("Key: %v, value: %v\n", key, val) // key value of SignedRenewalInfo
151+
}
152+
```
153+
134154
# ToDo
135155
- [x] Validator for In App Purchase Receipt (AppStore)
136156
- [x] Validator for Subscription token (GooglePlay)

0 commit comments

Comments
 (0)