签名机制#
为保证交易安全和API调用安全,Ayolinx会对所有接口的请求进行签名验证,您需要对所有的的请求进行签名,以供Ayolinx确认您的身份。签名生成规则分为三部分,一个是获取AccessToken时生成的签名;第二个是调用接口生成的签名;第三个是回调商户的签名,三者存在差异。异步回调验签#
Ayolinx在向您发送异步回调通知时,会按照上述机制对回调请求进行签名。您在接收到异步回调通知后,需要对回调请求进行验签,以确认回调请求确实来自Ayolinx。
一、获取AccessToken签名生成#
1、代码逻辑讲解#
requestTimestamp 为请求时header里面的X-TIMESTAMP, 格式为yyyy-MM-ddTHH:mm:ssXXX,例如:2024-09-18T06:36:36+00:00,如果东八区,则2024-09-18T06:36:36+08:00
2、demo展示#
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDKJ2Mon/hqxyy7
G185m84du0HA0C1SGZ0l/QSjzCs45oSZFr7QlMY0rYfb3tZ5tyMPF9DSFaLETRmP
eTF8KZ7XxDrWb5b97VDPu5ZD+3H2XHd+psWyH5skFL7NzF3XyxcbNIMGhhhXqT8c
SyNVlvELU2RCCAcv42Kh4cTGFZa3On4AxSSvMBO3nYZBOOYNWoGSBBycDPTQ4/lk
MF++Thz/ugxVhkgPG5KDvjy4n96OHXYq3CbSaWsRLJ+nFMS4aLtUTALln/d3x7cE
YRPSZYJAUwMIVxxEaeo5r7RTWBW7JDmNFlGrSuL4aGvxpjgj9fuibdrBLBBHfJIH
w8QIAiiJAgMBAAECggEAFEGK2i/gWZu0V9nL6ob6Cejg82/wsJ60LFGscLjFNnYD
wJ7Ctz4HF9FxEPck3Myc4NbpM9na5cpXdrTFQHyfp91n62OCWNaaH7ybV5vHDTFy
AFD384ue9Sg2f8Lb/uLg4XcbL3DJmOQSuLQvOdTueYztOYAaL0JcuF2Z5OLWJ60R
NGqdl6QiUnkHVmzLif8RApl+kRQWeA1fSw0EBXLm1EyX+anK3NCrGLDRSO/n05v+
16LDfcev78TqtbDsB0bS//RUm34+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Xa08ZqnVr7Tgv7vplbBii3pG3QXGNN41Qi1s4/fpYGKkpprUenIYPy59482/GoEbXEnutrPUtTKIXf7z4zkcFwngurByo1iHxEKIFxKFKJq5XR70FfTsXZQPDTC9VsKCqJ+PYaCVHtv9fAe2Bo1kaDzWGzESzpbFBpr8k0H6Fngboje9GgtWRFlcdYRM5NLYNuFJ7rXN1f792aX1s9nS8eDmXAJlJeMR/j509mBiIJeF3OkAgD5yuqZvtYJdYLYYoe8SU8jQ==
二、调用接口签名生成#
1、代码逻辑讲解#
$body为请求body里面所有传参,格式为json
$token 为Authorization Token,去掉Bearer前缀
$requestTimestamp 为请求时header里面的X-TIMESTAMP, 格式为yyyy-MM-ddTHH:mm:ssXXX,例如:2024-09-18T06:36:36+00:00,如果东八区,则2024-09-18T06:36:36+08:00
$data示例:POST:/direct-debit/core/v1/debit/payment-host-to-host:7bd8be52a84cc95155756773cf34eade:e6fadcabcf365f76b7ad5e54f8a29015e7392905fa5822ae284fadccf3ef4d12:2025-01-16T17:30:56+07:00
$client_secret为商户创建账号后Ayolinx平台生成的client_secret参数
2、demo展示#
jmI+wVObzka8DvwIH1CCUo5AvARo4IZf4S8SSLOhNpKipRtwyQCOM6Kkr6k6wDAVgSZ+MbaxjGLQjqrK0o4ojw==
三、Ayolinx回调商户签名验证规则#
1、代码逻辑讲解#
$timestamp 为请求时header里面的X-TIMESTAMP, 格式为yyyy-MM-ddTHH:mm:ssXXX,例如:2024-09-18T06:36:36+00:00,如果东八区,则2024-09-18T06:36:36+08:00
$data示例:POST:/v1.0/qr/qr-mpm-notify:7bd8be52a84cc95155756773cf34eade:2025-01-16T17:30:56+07:00
2、demo展示#
Modified at 2025-07-02 03:32:03