Skip to main content
WEBHOOK
payment_intent.succeeded
{
  "success": true,
  "code": "<string>",
  "message": "<string>",
  "status": "<string>",
  "traceId": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "name": "payment_intent.succeeded"
}
{
  "errCode": "<string>",
  "errMessage": "<string>"
}

Authorizations

signature
string
header
required

加签

加签是开放平台和商户对于交互消息完整性的校验。加签行为主要发生两个部分:

  1. 商户服务器端针对向PayLoco开放平台发送的请求报文进行加签;
  2. PayLoco开放平台针对通知商户的异步消息进行加签。 PayLoco平台要求使用 RSA 私钥进行加签, 使用 RSA 公钥进行验签。 因此,在以上两部分描述的交互中, 存在商户公私钥、PayLoco 公私钥,开发者需要使用商户私钥,对第一部分报文进行加签,使用 PayLoco 公钥对第二部分消息进行验签。

加签规则如下:

  1. 使用 商户私钥对待 request.body 进行签名(SHA256WithRSA 计算原始数据的SHA-256哈希值。 使用私钥对哈希值进行签名,即使用私钥对哈希值进行RSA加密。此时得到的加密结果就是数字签名。);
Signature signature = Signature.getInstance("SHA256withRSA");
signature.initSign(privateKey);
// 计算 SHA256withRSA 签名时,需要以 utf-8 的编码转换 byte 流,否则可能导致含中文参数的签名计算不正确
signature.update(request.body);
byte[] signedHash = signature.sign();
  1. 将加签内容进行 Base64 编码;
String signature = Base64.getEncoder().encodeToString(signedHash);
  1. 将编码后的内容放在请求头部 signature 参数中。 注意,加签是对 request.body 进行签名,当查询等 request.body 为空时,则无需加签。

Headers

X-eventName
any
required

通知种类

Example:

"GlobalAccount"

X-eventType
any
required

通知子类

Example:

"settle"

signature
string
required

使用平台私钥对requestBody做了加签, 请使用平台公钥对requestBody做签名验证

Body

application/json
success
boolean
required

是否成功

code
string
required

响应状态码,errCode为00000000表示响应成功,其他状态码表示响应失败。具体系统错误码可以参考系统错误码。

Example:

"00000003"

message
string
required

错误消息

Example:

"处理中"

status
string
required

订单状态(见补充说明)

Example:

"PENDING"

traceId
string
required

请求消息唯一标识。traceId为本次调用产生的流水号,接口调用异常,可以提供此流水号用于排查问题。

Example:

"33fae7b7aed1233f"

data
object

返回的业务数据

createdAt
string<date-time>

商户订单的时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ssSSS+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35.262+08:00表示,北京时间2015年5月20日13点29分35秒。

Example:

"2024-07-18T17:19:59.74+08:00"

name
enum<string>

事件名称

Available options:
payment_intent.succeeded,
payment_intent.pending,
payment_intent.failed
Example:

"payment_intent.succeeded"

Response

200 - application/json

OK

errCode
string
required

响应状态码

Example:

"00000000"

errMessage
string
required

错误消息

Example:

"成功"