Hi, I am testing a consumable in-app purchase on my app, with a Sandbox account on an iPad device.
The transaction was successful, as I saw "You're all set. Your purchase was successful. [Environment: Sandbox].
I set a break point in Xcode after the line await transaction.finish() in following code
private func handle(transactionVerification result: VerificationResult ) async {
switch result {
case let .verified(transaction):
guard
let product = self.products.first(where: {
$0.id == transaction.productID
})
else {
return
}
self.addPurchased(product)
await transaction.finish()
return. <----- breakpoint
And I saw those property values for the transaction
id UInt64 88*****848
originalID UInt64 437****2496
.
Then I use the originalID value 437*****2496 in a server library call in node.js
....
const environment = Environment.SANDBOX
....
const client = new AppStoreServerAPIClient(encodedKey, keyId, issuerId, bundleId, environment)
....
const response = await client.getTransactionInfo("4379072496")
I got
apiError: 4040010, errorMessage: 'Transaction id not found.'
Could someone please tell me if I use the library call correctly with the right id? And why I got the error?
Thank you very much!
Kind regards,
Shih-Chin Yang
[Edited by Moderator]
Post
Replies
Boosts
Views
Activity
Hi,
I am testing an consumable in-app purchase for my app on an iPad, whenever I select to purchase, it always shows "For testing purpose only. You will not be charged for confirming this purchase.". Then I touch the blue Purchase button. It instantly shows "Done", then alerts "You're all set. Your purchase was successful. [Environment: Xcode]. It never asks me to enter a Sandbox account.
I followed the instructions on "Testing in-app purchases with sandbox" page, but I can not find the sandbox account in Settings > App Store.
I expected to see [Environment: Sandbox] so I could get the transaction id for App Store Server API.
My iPadOS version is 17.4.1. My Xcode version is 15.1 and I use StoreKit with SwiftUI view.
Can someone please shed some light on why I always get [Environment: Xcode]? I googled a lot, the process to test with Sandbox seems to be straightforward, But I just could not get it right.
Thank you very much!
KInd Regards,
Shih-Chin Yang