POST /api/orders/payment_status
paypal_order_id 查询 PayPal 支付结果,供 PayPal 返回页轮询使用。pending 时,后端会把本地 PayPal checkout session 同步为 processing,响应中的 payment_result 返回 processing,local_session_status 返回 processing。POST /api/work_tasks/paying_order
data.paying_order 新增统一支付状态字段 payment_status、操作可用性字段 can_cancel / can_continue_payment;data.payment.session_status 现在可能返回 processing;PayPal 支付数据新增 paypal_capture_id。GET /api/work_tasks/info
data.paying_order 与 POST /api/work_tasks/paying_order 使用同一套支付状态返回结构,包含 payment_status、can_cancel、can_continue_payment 和嵌套 payment。POST /api/worktask_page_event_list/list
pending 并映射为本地 processing 时,会新增一条 type=paypal_processing 的页面事件;当 PayPal 后续变为其他终态时,该事件会自动关闭并从列表消失。POST /api/product_licenses/info
paying_order 和 payment;data.order 也会带上统一支付状态字段,便于 product 支付详情页展示 PayPal processing 状态。POST /api/product_licenses/continue_payment
payment_status、paying_order、payment,与 work task 支付订单状态结构保持一致。GET /api/artist_center/work_tasks/info
data.paying_order 与用户侧 GET /api/work_tasks/info 使用同一套支付状态返回结构,包含 payment_status、can_cancel、can_continue_payment 和嵌套 payment。POST /api/artist_center/worktask_page_event_list/list
pending 并映射为本地 processing 时,会新增一条 type=paypal_processing 的页面事件;当 PayPal 后续变为其他终态时,该事件会自动关闭并从列表消失。PayPal capture 进入 PENDING 时,表示 PayPal 已开始处理这笔 capture,但商户尚未拿到最终成功或失败结果。后端现在统一映射为本地:
| 层级 | 字段 | 值 |
|---|---|---|
| PayPal 远端 | paypal_capture_status | pending |
| PayPal checkout session | status / local_session_status | processing |
| Paying order 展示状态 | payment_status | processing |
| PayPal 返回页轮询状态 | payment_result | processing |
| 本地 order | orders.status | 仍为 paying |
processing 期间后端不会结算订单,也不会发放商品或推进 work task 阶段。后续只有在 PayPal capture COMPLETED 后才会完成本地订单;如果 PayPal capture DENIED / DECLINED / FAILED,本地 PayPal checkout session 会转为 failed。
PayPal capture 进入 PENDING 时,后端会为对应 work task 创建两条页面事件:
| 字段 | 值 |
|---|---|
type | paypal_processing |
to | user 和 artist 各一条 |
data_id | null |
is_close | false |
重复收到 PayPal pending webhook,或 POST /api/orders/payment_status 多次查询到 PayPal capture pending 时,后端不会为同一 work task 重复新增多条 paypal_processing 事件。正常情况下,同一个 work task 只会保持两条未关闭事件:to=user 一条,to=artist 一条。
如果之前的 paypal_processing 事件已经被关闭,后续同一个 work task 再次进入 PayPal processing,后端会重新打开同类型事件,而不是为展示列表追加新的历史消息。
当 PayPal capture 从 pending 变为其他状态时,后端会自动关闭这两条事件,列表接口不再返回。这里的“删除消息”沿用页面事件已有机制,即更新为 is_close=true,不是物理删除。
会关闭 paypal_processing 事件的场景包括:
COMPLETED,本地订单支付完成。DENIED / DECLINED / FAILED,本地 PayPal checkout session 转为 failed。VOIDED,本地 PayPal checkout session 转为 cancelled。conflicted。payment_status 枚举payment_status 是订单详情/支付中订单查询场景使用的统一展示状态。
| 值 | 含义 | 前端建议 |
|---|---|---|
success | 本地订单已支付,或支付 session 已完成 | 展示支付成功,刷新业务详情 |
cancelled | 本地订单或支付 session 已取消 | 展示已取消 |
processing | 支付平台正在处理,当前主要用于 PayPal capture pending | 展示处理中,禁用继续支付和取消,提示稍后查看或轮询 |
conflicted | 本地和支付平台状态冲突,需要人工处理 | 展示异常并提示联系客服 |
pending | 订单仍在等待用户完成支付,或暂无明确终态 | 可展示继续支付入口 |
failed | 最近一次支付 session 已失败 | 可引导重新发起支付 |
expired | 最近一次支付 session 已过期且没有 active session | 可引导重新发起支付 |
| 字段 | 类型 | 说明 |
|---|---|---|
can_cancel | boolean | 当前 paying order 是否允许取消 |
can_continue_payment | boolean | 当前 paying order 是否允许继续支付 |
当存在 processing / finished / conflicted payment session 时,两个字段都会返回 false。
前端应优先使用这两个字段控制按钮,不要只根据 orders.status === "paying" 判断是否可操作。
不建议前端统一使用 session_status 判断支付状态。
推荐规则:
| 场景 | 前端主判断字段 | 说明 |
|---|---|---|
| PayPal 返回页轮询 | payment_result | 这是 PayPal 返回页专用的最终/处理中判断字段 |
| Work task / product 详情页展示 | payment_status | 这是 paying order 的统一展示状态 |
| 是否允许取消 | can_cancel | 不要用 session_status 自行推导 |
| 是否允许继续支付 | can_continue_payment | 不要用 session_status 自行推导 |
| 展示当前支付渠道的底层状态 | payment.session_status | 只作为辅助展示、排查、渠道细节 |
原因:
session_status 只描述当前 active payment session,不一定等于订单的业务支付结果。payment 可能为 null,例如没有 active session,但仍可能有最近一次失败、过期或已完成的支付记录。payment_status 或 payment_result。can_cancel / can_continue_payment 已经封装了 processing、finished、conflicted 等阻塞规则,前端不需要重复实现。POST /api/orders/payment_statuspending 会同步本地 session 为 processing,并返回 payment_result=processing。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
paypal_order_id | string | 是 | PayPal order id |
payment_result=processing:不要展示支付失败;展示处理中,并继续轮询或提示用户稍后查看。payment_result=pending:表示还没有明确结果,可以继续轮询。payment_result=success:支付最终成功。payment_result=failed / cancelled / conflicted:进入对应终态处理。无新增,沿用原有错误语义。
404:找不到 PayPal checkout session,或当前用户无权查询该 session。
422:参数校验失败。
POST /api/work_tasks/paying_orderpaying_order 增加统一状态和操作可用性字段;PayPal capture pending 时会返回 payment_status=processing。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
work_task_id | number | 是 | work task id |
data.paying_order 新增字段:
| 字段 | 类型 | 说明 |
|---|---|---|
payment_status | string | 统一支付状态,见上方枚举 |
can_cancel | boolean | 是否允许取消当前 paying order |
can_continue_payment | boolean | 是否允许继续支付当前 paying order |
data.payment 字段:
| 字段 | 类型 | 说明 |
|---|---|---|
pay_channel | string | paypal / stripe / alipay |
session_status | string | 当前支付 session 状态,可能为 pending / processing / conflicted |
paypal_order_id | string 或 null | PayPal order id,仅 PayPal 返回 |
paypal_capture_id | string 或 null | PayPal capture id,仅 PayPal 返回;capture pending 后会有值 |
pay_url | string 或 null | PayPal / Alipay 支付跳转地址 |
checkout_session_id | string 或 null | Stripe checkout session id,仅 Stripe 返回 |
client_secret | string 或 null | Stripe client secret,仅 Stripe 返回 |
out_trade_no | string 或 null | Alipay out_trade_no,仅 Alipay 返回 |
payment_status=processing 时,展示“支付处理中”。can_cancel=false 时,不展示或禁用取消按钮。can_continue_payment=false 时,不展示或禁用继续支付按钮。processing 时重新创建支付,也不要提示用户退款或重新支付。无新增,沿用原有错误语义。
400:同一 work task 存在多个支付中订单,返回 code=20003。
400:同一支付中订单存在多个 active payment session,返回 code=21003。
GET /api/work_tasks/infodata.paying_order 现在带有与 POST /api/work_tasks/paying_order 一致的状态字段和嵌套 payment。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | number | 是 | work task id |
work_tasks/info 适合页面首次进入时展示当前 paying order 快照。POST /api/work_tasks/paying_order 获取最新状态。无新增,沿用原有错误语义。
POST /api/worktask_page_event_list/listtype=paypal_processing 事件;PayPal 后续进入其他状态后,该事件会自动关闭并从列表消失。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
work_task_id | number | 是 | work task id |
to=user 的 paypal_processing 事件。data_id=null,data=null。无新增,沿用原有错误语义。
POST /api/product_licenses/infopaying_order / payment 查询支付中订单状态,和 work task 使用同一套字段语义。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
license_id | number | 是 | product license id |
| 字段 | 类型 | 说明 |
|---|---|---|
data.order.payment_status | string 或 null | license 关联订单的统一支付状态 |
data.order.can_cancel | boolean 或 null | 关联订单是否可取消 |
data.order.can_continue_payment | boolean 或 null | 关联订单是否可继续支付 |
data.order.payment | object 或 null | 关联订单当前 active payment session |
data.paying_order | object 或 null | 当关联订单为 paying 时返回,否则为 null |
data.payment | object 或 null | 当存在 active payment session 时返回,否则为 null |
无新增,沿用原有错误语义。
403:当前用户无权查看该 license。
422:参数校验失败。
POST /api/product_licenses/continue_paymentpayment_status、paying_order、payment,便于前端在继续支付后同步刷新本地支付状态。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
license_id | number | 是 | product license id |
400:支付正在处理中,返回 code=21002。当 PayPal session 已经是 processing 时,后端不会返回继续支付链接。
400:支付状态冲突,需要人工处理。
403:当前用户无权操作该 license。
GET /api/artist_center/work_tasks/infodata.paying_order 现在与用户侧 GET /api/work_tasks/info 保持一致,可以直接读取 payment_status、can_cancel、can_continue_payment 和嵌套 payment。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | number | 是 | work task id |
data.paying_order.payment_status 展示支付状态。payment.session_status 推导业务状态;按钮和提示优先使用 payment_status、can_cancel、can_continue_payment。data.paying_order 为 null。无新增,沿用原有错误语义。
POST /api/artist_center/worktask_page_event_list/listtype=paypal_processing 事件;PayPal 后续进入其他状态后,该事件会自动关闭并从列表消失。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
work_task_id | number | 是 | work task id |
to=artist 的 paypal_processing 事件。data_id=null,data=null。无新增,沿用原有错误语义。
payment_status 与 can_cancel / can_continue_payment 控制 UI。session_status 只用于展示当前支付 session 的底层状态,不作为前端统一业务判断字段。processing 不等于失败,也不等于已支付成功;不要触发退款、发货、发放 product license 文件或推进 work task 阶段。processing 期间如果用户刷新页面,前端应通过 work_tasks/info、work_tasks/paying_order 或 product_licenses/info 继续展示处理中状态。POST /api/orders/payment_status 的 payment_result 为准;订单详情页使用 payment_status。payment_status=processing 且 can_cancel=false、can_continue_payment=false,前端应禁用取消和继续支付入口,提示等待 PayPal 最终处理结果。