Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to parse transaction id by receipt ?? #258

Open
SFLAQiu opened this issue Jan 22, 2024 · 3 comments
Open

how to parse transaction id by receipt ?? #258

SFLAQiu opened this issue Jan 22, 2024 · 3 comments

Comments

@SFLAQiu
Copy link

SFLAQiu commented Jan 22, 2024

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

@SFLAQiu SFLAQiu changed the title how to parse transaction id by receipt how to parse transaction id by receipt ?? Jan 22, 2024
@richzw
Copy link
Collaborator

richzw commented Jan 22, 2024

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
Copy link
Author

SFLAQiu commented Jan 22, 2024

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
Copy link
Collaborator

richzw commented Jan 22, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants