You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 14:17:25