Skip to content

Instantly share code, notes, and snippets.

@jackinf
Last active July 4, 2019 08:23
Show Gist options
  • Save jackinf/a0469c8c4d38e87c9f5e58055089b311 to your computer and use it in GitHub Desktop.
Save jackinf/a0469c8c4d38e87c9f5e58055089b311 to your computer and use it in GitHub Desktop.
Sample response from WorldPay DDC
namespace Sandbox
{
class Progam
{
public static void Main()
{
var sessionId = "your-session-id";
var template = $@"
<!DOCTYPE html>
<html>
<head>
<title>Device Data Collection Result</title>
</head>
<body>
<script>
sendNotification(""{sessionId}"");
function sendNotification(sessionId) {{
try {{
window.parent.postMessage(JSON.stringify({{ SessionId: sessionId }}), '*');
}} catch(error){{
console.error('Failed to notify parent', error)
}}
}}
</script>
</body>
</html>";
}
}
}
<div>
<form id="collectionForm" name="devicedata" method="POST" action="https://secure-test.worldpay.com/shopper/3ds/ddc.html">
<input type="text" name="Bin" value="4444333322221111" />
<input type="text" name="JWT" value="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI2OWFhYWQ4Ni0xNzQ4LTQ1MjUtOWVmOS00NmYyNDJhMWMyZDYiLCJpYXQiOjE1NjIwNjYxMjIsImlzcyI6IjViZDllMGU0NDQ0ZGNlMTUzNDI4Yzk0MCIsIk9yZ1VuaXRJZCI6IjViZDliNTVlNDQ0NDc2MWFjMGFmMWM4MCJ9.q55wxlfvs4o0gEFKD55zNE3KzqryurFQsSSyTg67PZw" />
</form>
<script>
window.onload = function() {
document.getElementById('collectionForm').submit();
}
</script>
</div>
<!DOCTYPE html>
<html>
<head>
<title>Device Data Collection Result</title>
</head>
<body>
<script>
sendNotification("here-goes-session-id-value");
function sendNotification(sessionId) {
try {
window.parent.postMessage(JSON.stringify({ SessionId: sessionId }), '*');
} catch(error){
console.error('Failed to notify parent', error)
}
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment