feat(tip): add selectable coffee gift tiers
This commit is contained in:
+12
-16
@@ -9,7 +9,7 @@
|
||||
|
||||
普通模式和促销模式的可点击链接统一维护在 [外部入口链接清单](./external-entry-links.md)。
|
||||
|
||||
入口会先保存传入的身份数据,再使用 `replace` 跳转到目标页面。身份参数和入口控制参数会从地址栏中移除;目标页面自身需要的状态参数会保留,例如打赏页的 `coffee_type`。
|
||||
入口会先保存传入的身份数据,再使用 `replace` 跳转到目标页面。身份参数和入口控制参数会从地址栏中移除。
|
||||
|
||||
如果进入时已经是 Email、Google 或 Facebook 正式登录用户,并且携带 PSID,入口会额外调用一次 Facebook Identity 绑定接口。普通启动、刷新、Guest 和未登录状态不会调用绑定接口,绑定失败也不会阻止目标页面跳转。
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
| --- | --- | --- | --- |
|
||||
| `target` | 否 | `chat`、`tip`、`private-room` | 最终页面,缺失或无效时进入 `chat`。 |
|
||||
| `psid` | 否 | string | Facebook Page-scoped User ID。 |
|
||||
| `coffee_type` | 打赏入口可选 | `small`、`medium`、`large` | `target=tip` 时指定咖啡档位,缺失或非法时默认为 `small`。 |
|
||||
| `mode` | 否 | `promotion` | 设置为 `promotion` 时尝试开启聊天促销模式。 |
|
||||
| `promotion_type` | 促销模式必填 | `voice`、`image`、`private` | 指定促销锁消息类型。 |
|
||||
|
||||
@@ -35,16 +34,16 @@
|
||||
https://<APP_HOST>/external-entry?target=chat&psid=<PSID>
|
||||
```
|
||||
|
||||
进入打赏页面(默认 Small Coffee):
|
||||
进入打赏页面:
|
||||
|
||||
```text
|
||||
https://<APP_HOST>/external-entry?target=tip
|
||||
```
|
||||
|
||||
入口会跳转到规范地址:
|
||||
入口会跳转到规范地址,并在页面内默认选择 Medium 档位:
|
||||
|
||||
```text
|
||||
https://<APP_HOST>/tip?coffee_type=small
|
||||
https://<APP_HOST>/tip
|
||||
```
|
||||
|
||||
进入私密空间:
|
||||
@@ -55,23 +54,21 @@ https://<APP_HOST>/external-entry?target=private-room
|
||||
|
||||
## 咖啡打赏入口
|
||||
|
||||
打赏入口支持三种咖啡档位:
|
||||
打赏页同时展示三种咖啡档位,由用户进入页面后选择:
|
||||
|
||||
| `coffee_type` | 展示名称 | 价格 | 后端套餐 `planId` |
|
||||
| 档位 | 展示名称 | 价格 | 后端套餐 `planId` |
|
||||
| --- | --- | --- | --- |
|
||||
| `small` | Small Coffee | US$4.99 | `tip_coffee_usd_4_99` |
|
||||
| `medium` | Medium Coffee | US$9.99 | `tip_coffee_usd_9_99` |
|
||||
| `large` | Large Coffee | US$19.99 | `tip_coffee_usd_19_99` |
|
||||
| Small | Velvet Espresso | US$4.99 | `tip_coffee_usd_4_99` |
|
||||
| Medium(默认) | Golden Reserve | US$9.99 | `tip_coffee_usd_9_99` |
|
||||
| Large | Imperial Grand Cru | US$19.99 | `tip_coffee_usd_19_99` |
|
||||
|
||||
分别进入三种咖啡打赏页面:
|
||||
外部应用只需使用统一入口:
|
||||
|
||||
```text
|
||||
https://<APP_HOST>/external-entry?target=tip&coffee_type=small
|
||||
https://<APP_HOST>/external-entry?target=tip&coffee_type=medium
|
||||
https://<APP_HOST>/external-entry?target=tip&coffee_type=large
|
||||
https://<APP_HOST>/external-entry?target=tip
|
||||
```
|
||||
|
||||
外部入口会将它们规范化为 `/tip?coffee_type=<type>`。`coffee_type` 会在登录、Stripe 回跳和 Ezpay 回跳期间保留,确保支付流程始终使用最初选择的咖啡档位。
|
||||
咖啡档位不再由外部入口指定。用户选择后,前端会在登录、Stripe 和 Ezpay 回跳期间恢复当前档位。
|
||||
|
||||
实际创建订单时,前端通过 `/api/payment/tip-plans` 获取套餐,并只使用接口返回的对应 `planId`。最终支付金额以后端返回的套餐数据为准,若找不到对应套餐,页面会禁止下单,避免使用错误档位。
|
||||
|
||||
@@ -87,6 +84,5 @@ https://<APP_HOST>/external-entry?target=tip&coffee_type=large
|
||||
|
||||
- 所有参数值必须使用 URL 编码。
|
||||
- 不要通过入口传递登录 token、Page Access Token 或 App Secret。
|
||||
- `coffee_type` 仅在 `target=tip` 时生效;缺失或非法时使用 `small`。
|
||||
- `promotion_type` 非法时按普通聊天入口处理,不展示促销消息。
|
||||
- 不支持任意 URL 跳转;无效 `target` 固定回退到聊天页。
|
||||
|
||||
Reference in New Issue
Block a user