Loading the JavaScript Library and Invoking the Accept Function
Use the client library asset path returned by the capture context response to invoke
Unified Checkout
on your page.Get the JavaScript library URL dynamically from the capture context response. When
decoded, it appears in the JSON parameter
clientLibrary
as:
https://apitest.
cybersource
.com/up/v1/assets/x.y.z/SecureAcceptance.jsWhen you load the library, the capture context that you received from your initial
server‑side request is used to invoke the accept function.
IMPORTANT
Use the
clientLibrary
parameter value in the
capture context response to obtain the Unified Checkout
JavaScript library
URL. This ensures that you are always using the most up-to-date library. Do not
hard-code the Unified Checkout
JavaScript library URL.JavaScript Example: Initializing the SDK
<script src="https://apitest.cybersource.com/up/v1/assets/0.19.0/SecureAcceptance.js"></script> <script> Accept('header.payload.signature').then(function(accept) { // use accept object }); </script>
In this example,
header.payload.signature
refers to the capture
context JWT.