Skip to content

Commit 2f4f795

Browse files
committed
docs(readme): add get transaction info sample
1 parent 634fc34 commit 2f4f795

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

+33
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,39 @@ go get github.com/richzw/appstore
2323
> - Enter a name for the key. The name is for your reference only and isn’t part of the key itself. Click Generate.
2424
> - Click Download API Key next to the new API key. And store your private key in a secure place.
2525
26+
### Get Transaction Info
27+
28+
```go
29+
import(
30+
"github.com/richzw/appstore"
31+
)
32+
33+
// ACCOUNTPRIVATEKEY is the key file generated from previous step
34+
const ACCOUNTPRIVATEKEY = `
35+
-----BEGIN PRIVATE KEY-----
36+
FAKEACCOUNTKEYBASE64FORMAT
37+
-----END PRIVATE KEY-----
38+
`
39+
func main() {
40+
c := &appstore.StoreConfig{
41+
KeyContent: []byte(ACCOUNTPRIVATEKEY),
42+
KeyID: "FAKEKEYID",
43+
BundleID: "fake.bundle.id",
44+
Issuer: "xxxxx-xx-xx-xx-xxxxxxxxxx",
45+
Sandbox: false,
46+
}
47+
transactionId := "FAKETRANSACTIONID"
48+
a := appstore.NewStoreClient(c)
49+
response, err := a.GetTransactionInfo(context.TODO(), transactionId)
50+
51+
transantion, err := a.ParseSignedTransaction(response.SignedTransactionInfo)
52+
53+
if transaction.TransactionId == transactionId {
54+
// the transaction is valid
55+
}
56+
}
57+
```
58+
2659
### Look Up Order ID
2760

2861
```go

0 commit comments

Comments
 (0)