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

ios prod、sandbox验单 #264

Closed
kkfrank2 opened this issue Feb 2, 2024 · 5 comments
Closed

ios prod、sandbox验单 #264

kkfrank2 opened this issue Feb 2, 2024 · 5 comments

Comments

@kkfrank2
Copy link

kkfrank2 commented Feb 2, 2024

苹果审核的时候是使用sanbox进行验单,但是送审的app又是生产环境的。网上查有人说先在生产环境进行验单,如果返回21007,再去sandbox验单。我现在验单使用的方法是GetTransactionInfo和ParseSignedTransaction。从这两个方法里能拿到21007吗。还是说不管21007,只要生产环境拿不到Transaction,就去sandbox环境去拿?或者说还有其他方法?

@richzw
Copy link
Collaborator

richzw commented Feb 2, 2024

First, during the review, it should be the orders in the production environment.

Secondly, 21007 is the return value that has been deprecated for the interface Verify.

And for the interface GetTransactionInfo, the distinction between whether it is a production environment is based on the URL.

HostSandBox    = "https://api.storekit-sandbox.itunes.apple.com"
HostProduction = "https://api.storekit.itunes.apple.com"

Based on the documentation of error codes https://developer.apple.com/documentation/appstoreserverapi/error_codes, there is no 21007. @kkfrank2

@kkfrank2
Copy link
Author

kkfrank2 commented Feb 4, 2024

多谢及时回复。
审核期间,apple用什么环境验单有文档吗。我从之前的文档中看,他们是用的sandbox环境验单(可能已经deprecated)。
https://developer.apple.com/documentation/storekit/in-app_purchase/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc

Use the test environment URL https://sandbox.itunes.apple.com/verifyReceipt when testing your app in the sandbox and while your app is in review

然后最新的文档中我并没有找到审核期间用的什么环境,不过文档中说
(https://developer.apple.com/documentation/appstoreserverapi?language=objc)

If you don’t have environment information, follow these steps:

  1. Call the endpoint using the production URL. If the call succeeds, the transaction identifier belongs to the production environment.
  2. If you receive an error code 4040010 TransactionIdNotFoundError, call the endpoint using the sandbox environment.

那我是不是可以在call GetTransactionInfo的时候,处理下4040010,如果在prod没找到transaction,再去sanbox环境去找
@richzw

@richzw
Copy link
Collaborator

richzw commented Feb 5, 2024

多谢及时回复。 审核期间,apple用什么环境验单有文档吗。我从之前的文档中看,他们是用的sandbox环境验单(可能已经deprecated)。 https://developer.apple.com/documentation/storekit/in-app_purchase/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc

Use the test environment URL https://sandbox.itunes.apple.com/verifyReceipt when testing your app in the sandbox and while your app is in review

Sorry for misunderstanding your question before. I thought your question was about the sandbox receipt validation in the production environment. IMO, since whether the sandbox order is used in the review mode in the document, both the sandbox receipt and non-sandbox receipt should be verified on the server side.

然后最新的文档中我并没有找到审核期间用的什么环境,不过文档中说 (https://developer.apple.com/documentation/appstoreserverapi?language=objc)

If you don’t have environment information, follow these steps:

  1. Call the endpoint using the production URL. If the call succeeds, the transaction identifier belongs to the production environment.
  2. If you receive an error code 4040010 TransactionIdNotFoundError, call the endpoint using the sandbox environment.

那我是不是可以在call GetTransactionInfo的时候,处理下4040010,如果在prod没找到transaction,再去sanbox环境去找

Yes, you are right. You can follow the documentation to implement it.

@kkfrank2
Copy link
Author

kkfrank2 commented Feb 5, 2024

多谢。不过感觉苹果这个机制好low 😂。 @richzw 文档里或许可以补充说明一下,让大家少踩坑(虽然他们审核的时候不一定能测到iap相关的功能..)

@richzw
Copy link
Collaborator

richzw commented Feb 5, 2024

多谢。不过感觉苹果这个机制好low 😂。 @richzw 文档里或许可以补充说明一下,让大家少踩坑(虽然他们审核的时候不一定能测到iap相关的功能..)

That's a great suggestion. Let me add it to the documentation. Thank you very much for your suggestion.

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