feat(iap/apple): 添加BundleID支持以增强苹果交易验证

在ServerAPIConfig中添加BundleID字段,用于苹果服务器API验证
当BundleID未配置时,尝试从站点自定义数据中获取
删除过时的测试文件
This commit is contained in:
2025-12-16 01:46:47 -08:00
parent 51765c794a
commit ceb3b16dc5
3 changed files with 22 additions and 87 deletions
+4
View File
@@ -19,6 +19,7 @@ type ServerAPIConfig struct {
IssuerID string
PrivateKey string
Sandbox bool
BundleID string
}
func buildAPIToken(cfg ServerAPIConfig) (string, error) {
@@ -34,6 +35,9 @@ func buildAPIToken(cfg ServerAPIConfig) (string, error) {
"exp": now + 1800,
"aud": "appstoreconnect-v1",
}
if cfg.BundleID != "" {
payload["bid"] = cfg.BundleID
}
hb, _ := json.Marshal(header)
pb, _ := json.Marshal(payload)
enc := func(b []byte) string {