钱包(Apple 和 Google)
直接向Apple Wallet或Google Wallet发放品牌会员卡——在服务器端签名,无需应用程序。Apple卡会在会员积分或等级变更时自动更新。
签发 两个平台 以及全部 Apple PassKit 更新 Web 服务 今天就活在代码里他们需要你的钱包凭证(Apple 通行证类型:ID + 签名证书; Google 发行方 + 服务帐户)已由 SocialHub 团队配置。
您将获得什么
服务器端发行实时
签名的 .pkpass 在服务器端生成并流式传输给会员 - 您的应用程序中没有本机通行证签名代码,也没有应用程序版本来更改卡设计。
自动卡更新实时
积分或等级变更 → 静默推送 APNs 更新 → 设备重新获取通行证。会员卡无需任何应用代码即可保持有效。
清洁生命周期实时
已移除成员的通行证序列号返回 410 Gone,因此 Wallet 会优雅地删除该过期卡。一个定时任务会监控您的签名证书的到期时间。
Apple + Google实时
两个平台目前都从同一个端点发布:Apple 返回已签名的 .pkpass;Google 返回保存链接。(Apple PassKit 提供静默自动更新;Google 卡片在打开时刷新。)
发行卡片 实时
从已登录成员的 WebView 中调用此函数——有关会话流程,请参阅《成员门户嵌入》指南。
// The signed-in member's app requests their card. teamId + memberId come from the
// consumer SESSION (never the body) — the body only selects the platform.
POST https://flash.socialhub.ai/api/consumer/wallet/issue
Content-Type: application/json
{ "platform": "apple" } // "apple" | "google"
// Apple → 200 Content-Type: application/vnd.apple.pkpass
// Content-Disposition: attachment; filename="loyalty-<serial>.pkpass"
// (the response body IS the signed .pkpass — hand it to "Add to Apple Wallet")
// Google → 200 { "saveUrl": "https://pay.google.com/gp/v/save/…" }
// (redirect the member to saveUrl → "Save to Google Wallet")
//
// Wallet not configured for that platform → DomainError WALLET_NOT_CONFIGURED.更新会自动进行。 实时
// You do NOT write update code. SocialHub hosts the standard Apple PassKit update
// web service, so the card stays current on its own:
//
// 1. The pass registers the device when added to Wallet
// POST /api/wallet/apple/v1/devices/{deviceId}/registrations/{passTypeId}/{serial}
// 2. A points / tier change enqueues a silent APNs push to the device
// 3. The device re-fetches the latest pass
// GET /api/wallet/apple/v1/passes/{passTypeId}/{serial}
//
// These endpoints are called by Apple's device, not by your app — listed here for
// transparency. A removed / unenrolled member's serial returns 410 Gone (not 500),
// so Wallet cleanly drops a stale card.上线前
Apple 通行证类型 ID
在您的 Apple 开发者帐户中注册通行证类型 ID(标识符→通行证类型 ID)并与您的 SocialHub 团队共享。
通过签名证书
生成该通行证类型 ID 的通行证签名证书。每个 .pkpass 都在服务器端进行签名; cron 会监视它的到期时间,因此它永远不会默默地失效。
APNs 授权密钥 (.p8)
提供 APNs 身份验证密钥(密钥 ID + 团队 ID),以便 SocialHub 可以推送静默更新通知,使 Apple 卡保持最新状态。
Google Wallet发行人
对于 Google 卡,请提供您的 Google Wallet 发卡机构 ID 和服务帐户密钥。 SocialHub 在服务器端生成签名的保存链接。
注意:需要付费 Apple 开发者计划中的 Apple 开发者帐户才能创建通行证类型 ID 和通行证签名证书。
验收清单
通过 POST /wallet/issue(平台:苹果)发出的真实 .pkpass 文件会安装到设备上,并显示会员当前的积分/等级。
请求平台:Google 返回一个 saveUrl,用于将卡片添加到 Google Wallet。
更改会员积分会在几秒钟内刷新已安装的Apple卡——无需任何应用交互。
向未配置凭证的平台发出请求会返回 WALLET_NOT_CONFIGURED 错误,而不是文件损坏。
被移除会员的 Apple 通行证序列号返回 410 Gone,钱包会删除该卡——绝不会返回 500。