I'm working on a transition from Secure Acceptance to Unified Checkout and follow javascript sample code from documentations (developer.cybersource.com/docs/cybs/en-us/unified-checkout/developer/all/rest/unified-checkout/uc-getting-started-cs-setup-intro/uc-getting-started-cs-js-library-intro.html).
It appears that the code fails at very first attempt to initialize the SDK:
``` javascript
const client = await VAS.UnifiedCheckout(sessionJWT);
```
as VAS is not defined by the library. Note, that I do use the client library address and client library integration extracted from capture context JWT string.
An inspection of the library code suggest that the name to use is probably "Accept" which is defined but does not have "UnifiedCheckout" method. Is documentation is stale or what do I do wrong?
Solved! Go to Solution.
09-02-2026 11:43 AM
The issue was a wrong combination of a `resourcePath` and `clientVersion` in the capture context authentication. I was using '/up/v1/capture-contexts' and '0.35' because it was something that finally worked after many trial and errors and also looked legit. But the correct combination was '/uc/v1/sessions' and '1.1'. This later combinations gives a correct script address using which resolved my issue.
09-04-2026 09:46 AM
I ran into this problem myself when initially integrating Unified Checkout in my application. It would always report this error the first time after initially loading the library through the capture context request response returned.
I don't fully know why this was happening, but I think it has something to do with invoking the API before the JavaScript library is fully loaded (yeah no documentation from CyberSource about this).
I'm a .NET developer with minimal JavaScript experience, but I was able to resolve this by returning a Promise that would resolve after the script had finished loading via its onload event. Below is an example on what I did:
return new Promise((resolve, reject) => { const script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = library; script.integrity = libraryIntegrity; script.crossOrigin = 'anonymous'; script.onload = function () { // Add code here on what you want to do after the script has loaded. resolve(library); }; script.onerror = function (error) { // Add code here on what you want to if the script has an error. reject(library); }; document.body.appendChild(script); });
The library and libraryIntegrity variables are parameters to my function that returns the Promise. Note that you may want to have additional logic to only load the library once by checking if the exact script exists. The example code I provided is based on the code use by CyberSource's .NET example: cybersource-unified-checkout-sample-dotnet/Views/Home/Checkout.cshtml at main · CyberSource/cybersou...
If someone has a better workaround, I'd love to hear about what they did as well.
Hope this helps!
09-04-2026 09:30 AM - edited 09-04-2026 09:32 AM
The issue was a wrong combination of a `resourcePath` and `clientVersion` in the capture context authentication. I was using '/up/v1/capture-contexts' and '0.35' because it was something that finally worked after many trial and errors and also looked legit. But the correct combination was '/uc/v1/sessions' and '1.1'. This later combinations gives a correct script address using which resolved my issue.
09-04-2026 09:46 AM