一个零依赖, 多语言, 多币种, 多租户的 apple 退款管理助手
开源地址
简述
本服务构建于 Laravel / Filament 多租户架构之上, 通过即时处理 Apple 的 CONSUMPTION_REQUEST 通知并异步回传消费数据,有效帮助开发者防范欺诈退款。
- 多租户支持
- 多语言支持 (中文 / English / Español / हिन्दी / العربية / Português / Русский / 日本語 / Français)
- 多币种支持
- 零依赖 File+SQLite
or upgrade to Redis+MySQL
- 100% 测试覆盖率
- 应用密钥自持 私钥仅保存在你的数据库
apps
表中(会进行对称加密,密钥由你的应用生成) - 12 个消费字段 - 计算所有必需的 Apple 字段
- notification 消息转发 苹果服务器发送到当前服务,当前服务转发到你的正式服务器
在线演示
🌐 演示地址: apple-refund-assistant.shiguopeng....
⚠️ 注意: 系统每 30 分钟会重置一次。
截图
设置配置
快速开始
使用已经构建好的镜像
docker run -d
-p 8080:8080
--name apple-refund-assistant
--restart=always
ghcr.io/seth-shi/apple-refund-assistant:latest
本地构建运行
git clone https://github.com/seth-shi/apple-refund-assistant
cd apple-refund-assistant
## 构建镜像并部署
./deploy.sh
如果需要挂载数据
touch database.sqlite
docker run -d
-p 8080:8080
-v $(pwd)/database.sqlite:/var/www/html/database/database.sqlite
--name apple-refund-assistant
--restart=always
ghcr.io/seth-shi/apple-refund-assistant:latest
消费字段策略
- 文档地址: developer.apple.com/documentation/...
- 策略代码: ConsumptionService.php
users
表字段可由其他系统更新
字段 | 描述 | 数据表来源 | 计算规则 |
---|---|---|---|
accountTenure | 用户注册天数 | users.register_at |
当前时间减去注册时间 |
appAccountToken | 账号 token | users.app_account_token |
需要客户端创建订单时传递 |
consumptionStatus | 消费状况 | transactions.expiration_date |
对比当前时间,如果已到期返回消费完 |
customerConsented | 用户同意提供数据 | 无 | 写死true |
deliveryStatus | 是否成功交付了一个功能正常的内购。 | 无 | 写死0 (正常交付) |
lifetimeDollarsPurchased | 内购总金额 | users.purchased_dollars |
根据苹果交易事件累加这个字段,你也可以自行累加 |
lifetimeDollarsRefunded | 退款总金额 | users.refunded_dollars |
根据苹果退款事件累加这个字段,你也可以自行累加 |
platform | 平台 | 无 | 写死1 (apple) |
playTime | 客户使用应用时间的值 | users.play_seconds |
需要你的系统支持更新这个字段,否则是0 |
refundPreference | 退款请求的期望结果 | transactions.expiration_date |
对比当前时间,如果已到期希望拒绝退款 |
sampleContentProvided | 是否提供试用 | apps.sample_content_provided |
创建应用时配置应用 |
userStatus | 用户状态 | 无 | 写死是1 (正常用户) |
未来计划
- 有其它想法或对合作感兴趣?请在 GitHub 上提交 issue - 我们非常期待您的反馈!
感谢
本作品采用《CC 协议》,转载必须注明作者和本文链接
推荐文章: