1. 安全要求及报文格式
EVO Cloud Gateway API
  • 网关接入
    • 版本记录
    • 讯联数据网关接口接入指引
      • 安全要求及报文格式
        • 安全要求及报文格式
        • 消息签名
        • 卡信息加密
        • PIN加密
        • 安全要求及报文格式(网联断直连)更新中
        • 消息签名(网联断直连)更新中
      • 线上支付场景
        • 授权
        • 授权完成
        • 再次完成
        • 绑卡
        • 退货
        • 无源退货
        • 撤销
        • 关单
        • 3DS认证
        • Network token 管理
        • 订阅性支付
        • DCC
      • 线下支付场景
        • 支付
        • 预授权
        • 预授权完成
        • 退货
        • 无源退货
        • 撤销
        • 冲正
        • DCC
        • 订阅性支付
      • 附录
        • 应答码
        • 常见问题
        • 万事达卡商户建议代码
    • Online API Specification
      • PaymentMethod
        • PaymentMethod
        • PaymentMethod
        • PaymentMethod
        • PaymentMethod
      • PaymentInstrument
        • PaymentInstrument
        • PaymentInstrument
        • PaymentInstrument
        • PaymentInstrument
      • Payment
        • Payment
        • Payment
        • Payment
      • Cancel
        • Cancel
        • Cancel
      • Capture
        • Capture
        • Capture
      • Refund
        • Refund
        • Refund
      • MerchandiseCredit
        • MerchandiseCredit
        • MerchandiseCredit
      • CancelOrRefund
        • CancelOrRefund
        • CancelOrRefund
      • Cryptogram
        • Cryptogram
        • Cryptogram
      • MultipleCapture
        • MultipleCapture
        • MultipleCapture
      • StandaloneCapture
        • StandaloneCapture
        • StandaloneCapture
      • Recapture
        • Recapture
        • Recapture
      • AsynchronousNotification
        • PaymentMethod 异步通知
        • Payment 异步通知
        • Cancel 异步通知
        • Capture 异步通知
        • Refund 异步通知
        • MerchandiseCredit 异步通知
        • Cryptogram 异步通知
        • MultipleCapture 异步通知
        • StandaloneCapture 异步通知
        • Network Token 更新通知
        • Network Token 认证完成通知
        • Recapture 异步通知
        • PaymentInstrument 异步通知
      • HealthCheck
        • HealthCheck
      • TransactionHistoryInquiry
        • TransactionHistoryInquiry
      • FxRateInquiry
        • FX rate inquiry
        • FX rate inquiry
    • Offline API Specification
      • Payment
        • Payment
        • Payment
      • Cancel
        • Cancel
        • Cancel
      • Capture
        • Capture
        • Capture
      • Refund
        • Refund
        • Refund
      • Reversal
        • Reversal
      • MerchandiseCredit
        • Merchandise Credit
        • Merchandise Credit
      • FxRateInquiry
        • FX rate inquiry
        • FX rate inquiry
      • TipsAdjustment
        • Tips adjustment
        • Tips adjustment
      • StandaloneCapture
        • StandaloneCapture
        • StandaloneCapture
      • MultipleCapture
        • MultipleCapture
        • MultipleCapture
      • ZPK
        • ZPK
      • Notification
        • Payment 异步通知
        • Cancel 异步通知
        • Capture 异步通知
        • Refund 异步通知
        • MerchandiseCredit 异步通知
        • StandaloneCapture 异步通知
        • MultipleCapture 异步通知
  1. 安全要求及报文格式

消息签名(网联断直连)更新中

消息签名#

SHA 签名规则#

报文 Header 中的 Authorization 字段是对报文 Body 内容的签名。 以 POST Payment 接口为例:

第一步:构造待签名字符串#

在计算签名结果之前,接入方需要构造一个待签名的字符串。
提示
将 Header.MethodType、Header.Path、Header.DateTime、Key、Header.MsgID 和 HTTP Body指定参数 按固定顺序用换行符 (\n) 连接起来,得到待签名字符串.
按照以下方法构造的待签名的字符串,待签名的字符串有6行。每行都包含一个参数并以换行符结尾(最后一行没有换行符)。如果一行为空,则该行将不存在,并且不需要换行符。
换行符:\n(ASCII 码值为 0x0A)
HTTP Body指定参数:使用Body中的参数merchantTransInfo.merchantTransID,paymentMethod.card.cardInfoEncryptMethod,pspInfo.sponsorCode,transAmount.currency,transAmount.value排序后使用‘&’符号连接,如下;
merchantTransInfo.merchantTransID=1234567890&paymentMethod.card.cardInfoEncryptMethod=xxxxx&pspInfo.sponsorCode=432156&transAmount.currency=CNY&transAmount.value=2.1
GET查询类的请求没有Body,请求计算签名事,则不需要将Body内容参与计算,仅到Header.MsgID即可。
待签名字符串参数描述
Header.MethodTypePOST/GET/PUT/DELETE。与请求 Header 中的 MethodType 一致。
Header.Path请求路径+查询参数字符串。与请求 Header 中的 Path 一致。
Header.DateTime请求发送的时间。与请求 Header 中的 DateTime 一致。
Key由 EVO Cloud 分配的签名密钥。
Header.MsgID消息 ID。与请求 Header 中的 MsgID 一致。
HTTP body您要在请求报文 Body 中发送的指定参数。merchantTransInfo.merchantTransID,paymentMethod.card.cardInfoEncryptMethod(仅在请求中使用,应答不使用该参数),pspInfo.sponsorCode,transAmount.currency,transAmount.value
信息
下面是一个构建完成的待签名字符串的样例
POST
/g2/v0/payment/acq/10130014/evo.e-commerce.payment
2024-03-05T17:58:25+08:00
NeTQlv6okyBmbelQP1RujxYmnp0S4GtA
M20240305175825926
merchantTransInfo.merchantTransID=T20240305175317143&paymentMethod.card.cardInfoEncryptMethod=xxxxx&pspInfo.sponsorCode=432156&transAmount.currency=CNY&transAmount.value=2.1

第二步:计算签名密文#

使用Header中SignType的签名算法计算待签名字符串的哈希值。将得到哈希值作为签名值。
例如,使用Header.SignType为SHA256,对第一步中的待签名字符串进行签名,得到的签名值为 38b1ec91c86c546450060ece0ab92a2ea92da390b4f0ef4357f6ca8030290760

第三步:将签名放入 HTTP 请求的 Header 中#

将 HTTP Header 中的 SignType 设置为您使用的签名算法,将 Authorization 设置为第二步中计算得到的签名值,最终得到最终要发送的 HTTP 请求报文:
POST /g2/v0/payment/acq/10130014/evo.e-commerce.payment HTTP/1.1
Host: {EVO_Cloud_DOMAIN_NAME.com}
DateTime: 2024-03-05T17:58:25+08:00
MsgID: M20240305175825926
SignType: SHA256
Authorization: 38b1ec91c86c546450060ece0ab92a2ea92da390b4f0ef4357f6ca8030290760
Content-Type: application/json

{"merchantTransInfo":{"merchantTransID":"T20240305175317143","merchantTransTime":"2024-03-05T17:53:17+08:00"},"paymentMethod":{"type":"card","card":{"cardInfoEncryptMethod":"xxxxx"}},"transAmount":{"currency":"CNY","value":"2.1"},"captureAfterHours":"0","pspInfo":{"mcc":"5499","sponsorCode":"432156","merchantID":"202106305812001","merchantName":"Test","street":"Test street","city":"ShangHai","postCode":"202000","nation":"CHN"}}

验签规则#

当您收到来自 EVO Cloud 的应答或异步通知时,建议您对报文 Header 中的签名结果进行验签,验签流程如下:
1.
构造待签名字符串,方法与签名时一致。
2.
对待签名字符串进行哈希值计算,使用的算法与您请求时的算法一致。
3.
将第2步的结果与报文 Header 中的 Authorization 进行对比,如果一致则为验签成功。
提示
对应Refund,Capture,Cancel应答验证签名处理时,merchantTransInfo.merchantTransID,transAmount.currency,transAmount.value参数来源于对应refund Object,capture Object,cancel Object中对应的merchantTransInfo.merchantTransID,transAmount.currency,transAmount.value
上一页
安全要求及报文格式(网联断直连)更新中
下一页
授权
Built with