開源地址
- Github: https://github.com/seth-shi/apple-refund-assistant
簡述
本服務構建於 Laravel / Filament 多租户架構之上,
通過即時處理 Apple 的 CONSUMPTION_REQUEST 通知並異步回傳消費數據,有效幫助開發者防範欺詐退款。
- 多租户支持
- 多語言支持 (中文 / English / Español / हिन्दी / العربية / Português / Русский / 日本語 / Français)
- 多幣種支持
- 零依賴 File+SQLite
or upgrade to Redis+MySQL - 100% 測試覆蓋率
- 應用密鑰自持 私鑰僅保存在你的數據庫
apps表中(會進行對稱加密,密鑰由你的應用生成) - 12 個消費字段 - 計算所有必需的 Apple 字段
- notification 消息轉發 蘋果服務器發送到當前服務,當前服務轉發到你的正式服務器
在線演示
🌐 演示地址: https://apple-refund-assistant.shiguopeng.cn/
⚠️ 注意: 系統每 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
消費字段策略
- 文檔地址: https://developer.apple.com/documentation/appstoreserverapi/consumptionrequest
- 策略代碼: 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 - 我們非常期待您的反饋!
感謝
- Rates By Exchange Rate API
- https://github.com/argus-sight/refund-swatter-lite