跳到主要内容

支付回调 API

支付回调 API 允许支付服务商将支付和退款状态更新到 Shoplazza。

支付应用会使用两类回调:

  • 完成支付:同步回调,用于顾客完成跳转支付、iframe 支付,或完成需要 3DS 验证的信用卡直接支付后。Shoplazza 会返回一个跳转 URL,将顾客带到支付完成页。
  • 支付和退款通知:异步回调,用于向 Shoplazza 通知支付和退款的最终结果。

如果 Shoplazza 没有收到成功响应,支付应用必须按照重试策略重试请求。

完成支付​

需要 write_payment_info 访问权限。

当顾客在第三方页面完成支付,或完成 3DS 验证后,使用 Complete Payment API。此阶段不需要返回最终支付结果,目的是继续顾客侧支付流程。

请求头​

Header说明
Access-Token鉴权后返回的 OAuth 授权 token。
Shoplazza-Shop-Domain店铺的 Shoplazza 系统域名。
Shoplazza-Hmac-Sha256按签名方法计算得到的签名。
Content-Type固定为 application/json。

请求参数​

Key是否必填类型说明
app_id是string支付应用 ID。
payment_id是string支付 ID。
amount是number订单金额。
currency是string币种代码。
transaction_no是string第三方支付交易号。
type是string支付类型,例如 sale 或 authorization。
test是boolean请求是否为测试模式。
status是string支付状态,固定为 paying。
extension否object自定义扩展字段。
timestamp是stringISO 8601 时间戳。

成功响应​

json
{
"redirect_url": "https://developer.myshoplaza.com/checkout/12345"
}

支付和退款通知​

需要 write_payment_info 访问权限。

使用通知回调异步通知 Shoplazza 最终支付或退款结果。支付和退款共享相同请求格式,仅 type 和 status 取值不同。

请求头​

Header说明
Access-Token鉴权后返回的 OAuth 授权 token。
Shoplazza-Shop-Domain店铺的 Shoplazza 系统域名。
Shoplazza-Hmac-Sha256按签名方法计算得到的签名。
Content-Type固定为 application/json。

请求参数​

Key是否必填类型说明
app_id是string支付应用 ID。
payment_id是string支付 ID。
amount是number支付或退款金额。
currency是string币种代码。
status是string支付状态(paid、failed)或退款状态(refund_success、refund_failed)。
transaction_no是string第三方支付交易号。
type是string支付通知使用 sale,退款通知使用 refund。
message否string失败信息,交易失败时必填。
error_code条件必填string错误码,status 为 failed 时必填。
test是boolean请求是否为测试模式。
extension否object自定义扩展字段。
timestamp是stringISO 8601 时间戳。

成功响应​

Shoplazza 收到通知后返回 HTTP 200。

json
{}