awa / go-iap

go-iap verifies the purchase receipt via AppStore, GooglePlayStore, AmazonAppStore and Huawei HMS.
MIT License
872 stars 246 forks source link

how to parse transaction id by receipt ?? #258

Open SFLAQiu opened 7 months ago

SFLAQiu commented 7 months ago

App store Server API /inApps/v1/history/{TransactionId} need TransactionId

Our ideas: app -> receipt => server -> receipt=> parse transaction id => appsotre-api

but: server parse transaction id Blocked

appstore => App Store Server LibraryReceiptUtility::getTransactionldFromAppReceipt appstore had Java、Swift、Python、Node.js SDK,but no go

go-iap Is it supported ? I couldn't find it

richzw commented 7 months ago

Per history API https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history

GET https://api.storekit.itunes.apple.com/inApps/v1/history/{transactionId}

The transactionId should be used in this API, and as far as I know, there is no API to reflect the transctionID from the raw receipt. Please correct me if something is missing.

One work around could be, first call client.Verify with raw receipt, and get the transactionId from this API. Then call the history API with this transactionId.


As for retrieving the transactionId from the receipt on the app (client side), the transactionIdentifier of SKPaymentTransaction is the transactionId.

Then, the client sends the transactionId to the server, and this transactionId is used to ios server API on the server side.


Could you please share some logic of App Store Server LibraryReceiptUtility::getTransactionldFromAppReceipt ?

SFLAQiu commented 7 months ago

Per history API https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history

GET https://api.storekit.itunes.apple.com/inApps/v1/history/{transactionId}

The transactionId should be used in this API, and as far as I know, there is no API to reflect the transctionID from the raw receipt. Please correct me if something is missing.

One work around could be, first call client.Verify with raw receipt, and get the transactionId from this API. Then call the history API with this transactionId.

As for retrieving the transactionId from the receipt on the app (client side), the transactionIdentifier of SKPaymentTransaction is the transactionId.

Then, the client sends the transactionId to the server, and this transactionId is used to ios server API on the server side.

Could you please share some logic of App Store Server LibraryReceiptUtility::getTransactionldFromAppReceipt ?

感谢老铁的回复。直接CH 交流吧。

早前我接入的是 verifyReceipt API,看官方文档已经弃用,客户端上传给服务端的是票据。 然后看到一篇文章是可以通过票据解析出transation_id,没有go,也查不到相关开源的实现,所以这里就疑惑了。 App Store Server LibraryReceiptUtility::getTransactionldFromAppReceipt ,这个我是看掘金的一篇文章: 文章地址 Snipaste_2024-01-22_18-50-10

官方提供的 SDK 里确实也是有提供 getTransactionldFromAppReceipt 方法,直接把票据解码出来。

在这之前我是不确定在交易后客户端能否拿到 transation_id 现在也还在和客户端确认中,看文档应该是可以在客户端拿到吧? 最终确认下,你做过苹果的订阅的流程是走客户端上报:transaction_id 吗?

richzw commented 7 months ago

Per history API https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history

GET https://api.storekit.itunes.apple.com/inApps/v1/history/{transactionId}

The transactionId should be used in this API, and as far as I know, there is no API to reflect the transctionID from the raw receipt. Please correct me if something is missing. One work around could be, first call client.Verify with raw receipt, and get the transactionId from this API. Then call the history API with this transactionId. As for retrieving the transactionId from the receipt on the app (client side), the transactionIdentifier of SKPaymentTransaction is the transactionId. Then, the client sends the transactionId to the server, and this transactionId is used to ios server API on the server side. Could you please share some logic of App Store Server LibraryReceiptUtility::getTransactionldFromAppReceipt ?

感谢老铁的回复。直接CH 交流吧。

早前我接入的是 verifyReceipt API,看官方文档已经弃用,客户端上传给服务端的是票据。 然后看到一篇文章是可以通过票据解析出transation_id,没有go,也查不到相关开源的实现,所以这里就疑惑了。 App Store Server LibraryReceiptUtility::getTransactionldFromAppReceipt ,这个我是看掘金的一篇文章: 文章地址 Snipaste_2024-01-22_18-50-10

官方提供的 SDK 里确实也是有提供 getTransactionldFromAppReceipt 方法,直接把票据解码出来。

在这之前我是不确定在交易后客户端能否拿到 transation_id 现在也还在和客户端确认中,看文档应该是可以在客户端拿到吧?

Yes

最终确认下,你做过苹果的订阅的流程是走客户端上报:transaction_id 吗?

Yes