Verify transactions signed by Xcode (StoreKit Testing)
mainWhen testing with StoreKit in Xcode, transactions are signed by a local CA instead of Apple. To verify these, you must pass the SHA256 fingerprint of the Xcode root certificate to the decoding functions.
Use APPLE_ROOT_CA_G3_FINGERPRINT for production and your local fingerprint for development.
import { decodeTransactions, APPLE_ROOT_CA_G3_FINGERPRINT } from "app-store-server-api"
const LOCAL_ROOT_FINGERPRINT = "AA:BB:CC:DD:..."
const fingerprint = process.env.NODE_ENV === "production"
? APPLE_ROOT_CA_G3_FINGERPRINT
: LOCAL_ROOT_FINGERPRINT
const transactions = await decodeTransactions(response.signedTransactions, fingerprint)