设备数据
发卡机构利用设备数据收集 (DDC) 来采集客户设备的指纹。
这些数据会与
重要信息:在客户提供他们的支付凭证时,立即调用此流程。这可以确保在客户完成剩余的结账流程时,在幕后异步进行设备数据收集。如果客户在设备数据收集流程开始或完成之后更改其卡号,则重新执行整个 DDC 流程。
设备数据初始化
POST
您的设备数据初始化请求至 3ds:deviceDataInitialize
操作链接。
该请求会创建用作设备数据收集 (DDC) 表格一部分的 JSON Web Token (JWT)。DDC 表格还需要收集您客户卡号的前六位 (BIN)。如果提供了 Token 资源,则可以返回 BIN,请参见 JWT + BIN (token)
请求。
为了集成的一致性,您还可以提供完整的卡号 JWT + BIN (card)
。它将被截取,从而变成响应中的 BIN。
设备数据初始化示例请求
POST https://try.access.worldpay.com/verifications/customers/3ds/deviceDataInitialization
{
"transactionReference": "Memory265-13/08/1876",
"merchant": {
"entity": "default"
}
}
{
"transactionReference": "Memory265-13/08/1876",
"merchant": {
"entity": "MindPalaceLtd"
},
"paymentInstrument": {
"type": "card/tokenized",
"href": "https://try.access.worldpay.com/tokens/MTIzNDU2Nzg5MDEyMzQ1Ng"
}
}
{
"transactionReference": "unique-transactionReference",
"merchant": {
"entity": "default"
},
"paymentInstrument": {
"type": "card/front",
"cardHolderName": "John Appleseed",
"cardNumber": "4444333322221111",
"cardExpiryDate": {
"month": 5,
"year": 2035
}
}
}
参数 | 必需 | 描述 |
---|---|---|
transactionReference | 独特的身份验证参考号。例如,电子商务订单代码。 在所有 3 个潜在请求类型(deviceDataInitialization、authentication、verification)中使用相同的 transactionReference 。 | |
merchant.entity | 作为加入流程的一部分而创建,用于在 Access Worldpay 中发送请求。 | |
paymentInstrument.type | 所使用的 paymentInstrument 的识别码。type : card/front
type : card/tokenized
|
设备数据初始化响应
最佳实践:Access Worldpay 在服务响应的头文件中返回WP-CorrelationId
。我们强烈建议您将此记录下来。我们使用WP-CorrelationId
检查单个服务请求。
若要了解不同结果的含义以及如何为测试的目的而重现这些结果,请参见 [3DS 测试]。(/zh/docs/access-worldpay/3ds/testing)
{
"outcome": "initialized",
"transactionReference": "Memory265-13/08/1876",
"deviceDataCollection": {
"jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJPcmdVbml0SWQiOiJPcmdVbml0IiwiaXNzIjoiYXBpSWQiLCJleHAiOjE1NjI5MjMzNDYsImlhdCI6MTU2MjkyMzQwNiwianRpIjoiYTAzMWVhOGEtN2E0Zi00YTQwLWI1NjMtOTUzMzYzMzVhZGNmIn0.0IK74OIXBxFsxqeOURJz1TFnz14ZTbFJTdTWo9cHUJQ",
"url": "https://ddcUrl.example.com",
"bin": "555555"
},
"_links": {
"3ds:authenticate": {
"href": "https://try.access.worldpay.com/verifications/customers/3ds/authentication"
},
"curies": [{
"href": "https://try.access.worldpay.com/rels/verifications/customers/3ds/{rel}",
"templated": true,
"name": "3ds"
}]
}
}
参数 | 描述 |
---|---|
deviceDataCollection.jwt | 包含 DDC 所需的其他详情的数字签名 Token。 Try 和 Production 版都将在 10 分钟后到期。 |
deviceDataCollection.url | 对 DDC 表格上的 POST 操作。用于重定向至发卡机构 DDC 页面。 |
deviceDataCollection.bin | 作为 DDC 的一部分使用的卡号前六位(银行识别号)。如果在请求中纳入了 Token 资源或卡号,则返回。 |
注释:如果出现错误,您可以在我们的
设备数据收集 (DDC)
一旦有了 JWT
、URL
和 BIN
,您就可以创建和提交 DDC 表格。
然后,代表这种收集的 SessionId
会由发卡机构作为风险分析的一部分用于
设备数据收集表
以下是您如何在 iframe 中设置 DDC 表的示例。
使用将 POST DDC 表格的页面的 URL,创建隐藏的 iframe 并设置
src
属性。 此 URL 应该在查询字符串参数中包含deviceDataCollection.jwt
、deviceDataCollection.bin
和deviceDataCollection.url
,因为在 DDC 表格中将会使用它们。Copied!<iframe height="1" width="1" style="display: none;" src="replace-this-with-the-url-of-your-page-that-posts-the-ddc-form"></iframe>
<iframe height="1" width="1" style="display: none;" src="replace-this-with-the-url-of-your-page-that-posts-the-ddc-form"></iframe>
创建并托管 POST DDC 表格的页面。
Copied!<html> <head> </head> <body> <!-- Using your preferred programming language, set the 'action' attribute with the value of the query string parameter containing the 'deviceDataCollection.url' from the device data initialization response --> <form id="collectionForm" name="devicedata" method="POST" action="https://ddcUrl.example.com"> <!-- Using your preferred programming language, set the 'value' attribute with the value of the query string parameter containing the 'deviceDataCollection.bin' from the device data initialization response --> <input type="hidden" name="Bin" value="555555" /> <!-- Using your preferred programming language, set the 'value' attribute with the value of the query string parameter containing the 'deviceDataCollection.jwt' from the device data initialization response --> <input type="hidden" name="JWT" value="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJPcmdVbml0SWQiOiJPcmdVbml0IiwiaXNzIjoiYXBpSWQiLCJleHAiOjE1NjI5MjMzNDYsImlhdCI6MTU2MjkyMzQwNiwianRpIjoiYTAzMWVhOGEtN2E0Zi00YTQwLWI1NjMtOTUzMzYzMzVhZGNmIn0.0IK74OIXBxFsxqeOURJz1TFnz14ZTbFJTdTWo9cHUJQ" /> </form> <script> window.onload = function() { document.getElementById('collectionForm').submit(); } </script> </body> </html>
<html> <head> </head> <body> <!-- Using your preferred programming language, set the 'action' attribute with the value of the query string parameter containing the 'deviceDataCollection.url' from the device data initialization response --> <form id="collectionForm" name="devicedata" method="POST" action="https://ddcUrl.example.com"> <!-- Using your preferred programming language, set the 'value' attribute with the value of the query string parameter containing the 'deviceDataCollection.bin' from the device data initialization response --> <input type="hidden" name="Bin" value="555555" /> <!-- Using your preferred programming language, set the 'value' attribute with the value of the query string parameter containing the 'deviceDataCollection.jwt' from the device data initialization response --> <input type="hidden" name="JWT" value="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJPcmdVbml0SWQiOiJPcmdVbml0IiwiaXNzIjoiYXBpSWQiLCJleHAiOjE1NjI5MjMzNDYsImlhdCI6MTU2MjkyMzQwNiwianRpIjoiYTAzMWVhOGEtN2E0Zi00YTQwLWI1NjMtOTUzMzYzMzVhZGNmIn0.0IK74OIXBxFsxqeOURJz1TFnz14ZTbFJTdTWo9cHUJQ" /> </form> <script> window.onload = function() { document.getElementById('collectionForm').submit(); } </script> </body> </html>
设备数据收集 postMessage
一旦 DDC 表格被提交并成功发送给发卡机构,您就会通过
为安全起见,可使用 postMessage origin
属性来验证发送者的身份,有关详情请见
环境 | 起源 |
---|---|
Try | API v1/v2: https://secure-test.worldpay.com/API v3: https://centinelapistag.cardinalcommerce.com |
Production | https://centinelapi.cardinalcommerce.com |
示例 postMessage 响应:
{
"MessageType": "profile.completed",
"SessionId": "0_3XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX6b5",
"Status": true
}
{ "MessageType": "profile.completed", "SessionId": "0_3XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX6b5", "Status": true }
密钥 | 值 |
---|---|
messageType | profile.completed |
SessionId | UUID,不存在或 undefined |
Status |
|
DDC 调用通常需要 1-2 秒,这取决于客户设备、Cardinal 服务器之间的延迟,并且部分取决于不同发卡机构所执行的设备数据收集类型。3DS 规范具有的最长响应时间为 10 秒。
注释:如果未提供 postMessage,重试 DDC 或发送没有 deviceData.collectionReference
的
后续步骤