REST API

Example: Basic Setup Using the Embedded Widget

This example shows a basic setup using the embedded widget.
The main difference between using an embedded widget and the sidebar is that the
accept.unifiedPayments
object is set to
false
.
var authForm = document.getElementById("authForm"); var transientToken = document.getElementById("transientToken"); var cc = document.getElementById("captureContext").value; var showArgs = { containers: { paymentSelection: "#buttonPaymentListContainer", paymentScreen: "#embeddedPaymentContainer" } }; Accept(cc) .then(function(accept) { return accept.unifiedPayments(
false
); }) .then(function(up) { return up.show(showArgs); }) .then(function(tt) { transientToken.value = tt; //merchant should handle tt accordingly – for example submit the tt for processing authForm.submit(); }).catch(function(error) { //merchant logic for handling issues alert("something went wrong"); });