Skip to content

Commit 07cf82b

Browse files
committed
docs(readme): add ParseNotificationV2WithClaim to readme
1 parent afdd2f5 commit 07cf82b

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

README.md

+23-2
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,8 @@ func main() {
178178
Sandbox: false,
179179
}
180180
tokenStr := "SignedRenewalInfo Encode String" // or SignedTransactionInfo string
181-
token := jwt.Token{}
182181
a := appstore.NewStoreClient(c)
183-
err := a.ParseNotificationV2(tokenStr, &token)
182+
token, err := a.ParseNotificationV2(tokenStr)
184183

185184
claims, ok := token.Claims.(jwt.MapClaims)
186185
for key, val := range claims {
@@ -189,6 +188,28 @@ func main() {
189188
}
190189
```
191190

191+
```go
192+
import (
193+
"github.com/richzw/appstore"
194+
"github.com/golang-jwt/jwt/v4"
195+
)
196+
197+
func main() {
198+
c := &appstore.StoreConfig{
199+
KeyContent: []byte(ACCOUNTPRIVATEKEY),
200+
KeyID: "FAKEKEYID",
201+
BundleID: "fake.bundle.id",
202+
Issuer: "xxxxx-xx-xx-xx-xxxxxxxxxx",
203+
Sandbox: false,
204+
}
205+
tokenStr := "JWSTransactionDecodedPayload Encode String"
206+
a := appstore.NewStoreClient(c)
207+
208+
jws, err := a.ParseNotificationV2WithClaim(tokenStr)
209+
// access the fields of JWSTransactionDecodedPayload from jws directly
210+
}
211+
```
212+
192213
# Support
193214

194215
App Store Server API [1.8](https://developer.apple.com/documentation/appstoreserverapi)

0 commit comments

Comments
 (0)