Integration Guide

Table Of Contents
Digital Goods Integration Guide - EC Edition January 2012 27
Integrating Digital Goods for Express Checkout
Integrating Digital Goods Payments With Express Checkout
2
NOTE: Make sure that you include content to be displayed in case the customer has
JavaScript disabled on their browser. You should include a link to deliver the content
if the purchase completes successfully.
<script>
if (window.opener){
window.close();
}
else if (top.dg.isOpen() == true){
top.dg.closeFlow();
}
</script>
To update the page asynchronously without reloading, you need to make some Ajax calls as in
the following example. This is the preferred method for closing the digital goods payments
flow. For other options, see “Integrating Digital Goods With Flash - Third-Party Merchant” on
page 51.
<!-- Use result of DoEC to send the buyer to the correct page -->
<!DOCTYPE html>
<html>
<head>
<title></title>
<script>
// Sample AJAX code using jQuery (any AJAX
// library works)
$.ajax({
url: 'http://example.com/path_to_fulfillment_content',
type: 'GET',
error: function () {
// Handle error cases
},
success: function (response){
// Replace content on page, initiate
// download, etc.
}
});
</script>
</head>
<body>
<!-- Include non-JavaScript content here -->
If this page does not redirect <a href="[page to deliver content
to non-JS customer]">Click Here</a>
</body>
</html>