@@ -7,12 +7,13 @@ import (
7
7
"crypto/x509"
8
8
"encoding/json"
9
9
"fmt"
10
- "github.com/golang-jwt/jwt/v4"
11
10
"io"
12
11
"net/http"
13
12
"net/url"
14
13
"strings"
15
14
"time"
15
+
16
+ "github.com/golang-jwt/jwt/v4"
16
17
)
17
18
18
19
const (
@@ -21,6 +22,7 @@ const (
21
22
22
23
PathLookUp = "/inApps/v1/lookup/{orderId}"
23
24
PathTransactionHistory = "/inApps/v1/history/{originalTransactionId}"
25
+ PathTransactionInfo = "/inApps/v1/transactions/{transactionId}"
24
26
PathRefundHistory = "/inApps/v2/refund/lookup/{originalTransactionId}"
25
27
PathGetALLSubscriptionStatus = "/inApps/v1/subscriptions/{originalTransactionId}"
26
28
PathConsumptionInfo = "/inApps/v1/transactions/consumption/{originalTransactionId}"
@@ -164,6 +166,31 @@ func (a *StoreClient) GetTransactionHistory(ctx context.Context, originalTransac
164
166
return
165
167
}
166
168
169
+ // GetTransactionInfo https://developer.apple.com/documentation/appstoreserverapi/get_transaction_info
170
+ func (a * StoreClient ) GetTransactionInfo (ctx context.Context , transactionId string ) (rsp * TransactionInfoResponse , err error ) {
171
+ URL := HostProduction + PathTransactionInfo
172
+ if a .Token .Sandbox {
173
+ URL = HostSandBox + PathTransactionInfo
174
+ }
175
+ URL = strings .Replace (URL , "{transactionId}" , transactionId , - 1 )
176
+
177
+ statusCode , body , err := a .Do (ctx , http .MethodGet , URL , nil )
178
+ if err != nil {
179
+ return nil , err
180
+ }
181
+
182
+ if statusCode != http .StatusOK {
183
+ return nil , fmt .Errorf ("appstore api: %v return status code %v" , URL , statusCode )
184
+ }
185
+
186
+ err = json .Unmarshal (body , & rsp )
187
+ if err != nil {
188
+ return nil , err
189
+ }
190
+
191
+ return
192
+ }
193
+
167
194
// GetRefundHistory https://developer.apple.com/documentation/appstoreserverapi/get_refund_history
168
195
func (a * StoreClient ) GetRefundHistory (ctx context.Context , originalTransactionId string ) (responses []* RefundLookupResponse , err error ) {
169
196
baseURL := HostProduction + PathRefundHistory
0 commit comments