Apple促销优惠购买报错:SKErrorDomain 12与ASDServerErrorDomain 3903求助
Apple促销优惠支付失败排查问题
已成功显示Apple促销优惠,但完成支付流程(输入密码并确认购买)后,弹出提示“无法购买。请联系开发者了解更多信息。”的错误弹窗。
日志错误信息
- SKErrorDomain Code=12 "(null)"
- ASDServerErrorDomain Code=3903 "Unable to Purchase"
签名字符串拼接规则及参数
签名字符串格式:appBundleId + '\u2063' + keyIdentifier + '\u2063' + productIdentifier + '\u2063' + offerIdentifier + '\u2063' + appAccountToken + '\u2063' + nonce + '\u2063' + timestamp
使用的参数示例:
- appBundleId: com.app.myapp
- keyIdentifier: 从App Store Connect复制的密钥ID
- productIdentifier: product_identifier
- offerIdentifier: offer_identifier
- appAccountToken: 已尝试使用UUID和空字符串
- nonce: 转为小写的UUID
- timestamp: UNIX时间戳
Java签名生成逻辑
/* promotionalOfferKey = value between "-----BEGIN PRIVATE KEY-----" and "-----END PRIVATE KEY-----" from the downloaded p8 file from App Store Connect associated with the keyIdentifier parameter above */ // stringToSign = the combined string above byte[] encoded = Base64.getDecoder().decode(promotionalOfferKey); KeyFactory keyFactory = KeyFactory.getInstance("EC"); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encoded); Signature ecdsaSign = Signature.getInstance("SHA256withECDSA"); ecdsaSign.initSign(keyFactory.generatePrivate(keySpec)); ecdsaSign.update(stringToSign.getBytes(StandardCharsets.UTF_8)); byte[] signature = ecdsaSign.sign(); signatureToReturn = Base64.getEncoder().encodeToString(signature);
请问我哪里操作有误?感谢您的帮助。
内容的提问来源于stack exchange,提问作者Renz
相关产品推荐
相关产品推荐

