<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: &amp;quot;VAS is not defined&amp;quot; for loaded Unified Checkout client library in cybersource APIs</title>
    <link>https://community.developer.cybersource.com/t5/cybersource-APIs/quot-VAS-is-not-defined-quot-for-loaded-Unified-Checkout-client/m-p/95934#M4487</link>
    <description>&lt;P&gt;I ran into this problem myself when initially integrating Unified Checkout in my application. It would always report this error the first time&amp;nbsp;&lt;STRONG&gt;after&lt;/STRONG&gt; initially loading the library through the capture context request response returned.&lt;/P&gt;&lt;P&gt;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).&lt;/P&gt;&lt;P&gt;I'm a .NET developer with minimal JavaScript experience, but I was able to resolve this by returning a &lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" target="_self"&gt;Promise&lt;/A&gt; that would resolve after the script had finished loading via its onload event. Below is an example on what I did:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Promise&lt;/SPAN&gt;((&lt;SPAN&gt;resolve&lt;/SPAN&gt;, &lt;SPAN&gt;reject&lt;/SPAN&gt;) =&amp;gt; {
    &lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;script&lt;/SPAN&gt; = &lt;SPAN&gt;document&lt;/SPAN&gt;.&lt;SPAN&gt;createElement&lt;/SPAN&gt;(&lt;SPAN&gt;'script'&lt;/SPAN&gt;);
    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;type&lt;/SPAN&gt; = &lt;SPAN&gt;'text/javascript'&lt;/SPAN&gt;;
    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;async&lt;/SPAN&gt; = &lt;SPAN&gt;true&lt;/SPAN&gt;;
    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;src&lt;/SPAN&gt; = &lt;SPAN&gt;library&lt;/SPAN&gt;;
    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;integrity&lt;/SPAN&gt; = &lt;SPAN&gt;libraryIntegrity&lt;/SPAN&gt;;
    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;crossOrigin&lt;/SPAN&gt; = &lt;SPAN&gt;'anonymous'&lt;/SPAN&gt;;

    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;onload&lt;/SPAN&gt; = &lt;SPAN&gt;function&lt;/SPAN&gt; () {
        &lt;SPAN&gt;// Add code here on what you want to do after the script has loaded.&lt;/SPAN&gt;
        &lt;SPAN&gt;resolve&lt;/SPAN&gt;(&lt;SPAN&gt;library&lt;/SPAN&gt;);
    };

    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;onerror&lt;/SPAN&gt; = &lt;SPAN&gt;function&lt;/SPAN&gt; (&lt;SPAN&gt;error&lt;/SPAN&gt;) {
        &lt;SPAN&gt;// Add code here on what you want to if the script has an error.&lt;/SPAN&gt;
        &lt;SPAN&gt;reject&lt;/SPAN&gt;(&lt;SPAN&gt;library&lt;/SPAN&gt;);
    };

    &lt;SPAN&gt;document&lt;/SPAN&gt;.&lt;SPAN&gt;body&lt;/SPAN&gt;.&lt;SPAN&gt;appendChild&lt;/SPAN&gt;(&lt;SPAN&gt;script&lt;/SPAN&gt;);
});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;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&amp;nbsp;&lt;STRONG&gt;once&lt;/STRONG&gt; by checking if the exact script exists. The example code I provided is based on the code use by CyberSource's .NET example:&amp;nbsp;&lt;A href="https://github.com/CyberSource/cybersource-unified-checkout-sample-dotnet/blob/main/Views/Home/Checkout.cshtml" target="_blank" rel="noopener"&gt;cybersource-unified-checkout-sample-dotnet/Views/Home/Checkout.cshtml at main · CyberSource/cybersource-unified-checkout-sample-dotnet · GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If someone has a better workaround, I'd love to hear about what they did as well.&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Fri, 04 Sep 2026 16:32:05 GMT</pubDate>
    <dc:creator>DevAtWaParks</dc:creator>
    <dc:date>2026-09-04T16:32:05Z</dc:date>
    <item>
      <title>"VAS is not defined" for loaded Unified Checkout client library</title>
      <link>https://community.developer.cybersource.com/t5/cybersource-APIs/quot-VAS-is-not-defined-quot-for-loaded-Unified-Checkout-client/m-p/95908#M4469</link>
      <description>&lt;P&gt;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).&lt;BR /&gt;It appears that the code fails at very first attempt to initialize the SDK:&lt;BR /&gt;``` javascript&lt;BR /&gt;&lt;SPAN class=""&gt;const&lt;/SPAN&gt;&lt;SPAN class=""&gt; client &lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt; await VAS&lt;/SPAN&gt;&lt;SPAN class=""&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;UnifiedCheckout&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;sessionJWT&lt;/SPAN&gt;&lt;SPAN class=""&gt;);&lt;/SPAN&gt;&lt;BR /&gt;```&lt;BR /&gt;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.&lt;BR /&gt;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?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2026 18:43:46 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/cybersource-APIs/quot-VAS-is-not-defined-quot-for-loaded-Unified-Checkout-client/m-p/95908#M4469</guid>
      <dc:creator>oleglomakin</dc:creator>
      <dc:date>2026-09-02T18:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: "VAS is not defined" for loaded Unified Checkout client library</title>
      <link>https://community.developer.cybersource.com/t5/cybersource-APIs/quot-VAS-is-not-defined-quot-for-loaded-Unified-Checkout-client/m-p/95934#M4487</link>
      <description>&lt;P&gt;I ran into this problem myself when initially integrating Unified Checkout in my application. It would always report this error the first time&amp;nbsp;&lt;STRONG&gt;after&lt;/STRONG&gt; initially loading the library through the capture context request response returned.&lt;/P&gt;&lt;P&gt;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).&lt;/P&gt;&lt;P&gt;I'm a .NET developer with minimal JavaScript experience, but I was able to resolve this by returning a &lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" target="_self"&gt;Promise&lt;/A&gt; that would resolve after the script had finished loading via its onload event. Below is an example on what I did:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Promise&lt;/SPAN&gt;((&lt;SPAN&gt;resolve&lt;/SPAN&gt;, &lt;SPAN&gt;reject&lt;/SPAN&gt;) =&amp;gt; {
    &lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;script&lt;/SPAN&gt; = &lt;SPAN&gt;document&lt;/SPAN&gt;.&lt;SPAN&gt;createElement&lt;/SPAN&gt;(&lt;SPAN&gt;'script'&lt;/SPAN&gt;);
    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;type&lt;/SPAN&gt; = &lt;SPAN&gt;'text/javascript'&lt;/SPAN&gt;;
    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;async&lt;/SPAN&gt; = &lt;SPAN&gt;true&lt;/SPAN&gt;;
    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;src&lt;/SPAN&gt; = &lt;SPAN&gt;library&lt;/SPAN&gt;;
    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;integrity&lt;/SPAN&gt; = &lt;SPAN&gt;libraryIntegrity&lt;/SPAN&gt;;
    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;crossOrigin&lt;/SPAN&gt; = &lt;SPAN&gt;'anonymous'&lt;/SPAN&gt;;

    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;onload&lt;/SPAN&gt; = &lt;SPAN&gt;function&lt;/SPAN&gt; () {
        &lt;SPAN&gt;// Add code here on what you want to do after the script has loaded.&lt;/SPAN&gt;
        &lt;SPAN&gt;resolve&lt;/SPAN&gt;(&lt;SPAN&gt;library&lt;/SPAN&gt;);
    };

    &lt;SPAN&gt;script&lt;/SPAN&gt;.&lt;SPAN&gt;onerror&lt;/SPAN&gt; = &lt;SPAN&gt;function&lt;/SPAN&gt; (&lt;SPAN&gt;error&lt;/SPAN&gt;) {
        &lt;SPAN&gt;// Add code here on what you want to if the script has an error.&lt;/SPAN&gt;
        &lt;SPAN&gt;reject&lt;/SPAN&gt;(&lt;SPAN&gt;library&lt;/SPAN&gt;);
    };

    &lt;SPAN&gt;document&lt;/SPAN&gt;.&lt;SPAN&gt;body&lt;/SPAN&gt;.&lt;SPAN&gt;appendChild&lt;/SPAN&gt;(&lt;SPAN&gt;script&lt;/SPAN&gt;);
});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;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&amp;nbsp;&lt;STRONG&gt;once&lt;/STRONG&gt; by checking if the exact script exists. The example code I provided is based on the code use by CyberSource's .NET example:&amp;nbsp;&lt;A href="https://github.com/CyberSource/cybersource-unified-checkout-sample-dotnet/blob/main/Views/Home/Checkout.cshtml" target="_blank" rel="noopener"&gt;cybersource-unified-checkout-sample-dotnet/Views/Home/Checkout.cshtml at main · CyberSource/cybersource-unified-checkout-sample-dotnet · GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If someone has a better workaround, I'd love to hear about what they did as well.&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2026 16:32:05 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/cybersource-APIs/quot-VAS-is-not-defined-quot-for-loaded-Unified-Checkout-client/m-p/95934#M4487</guid>
      <dc:creator>DevAtWaParks</dc:creator>
      <dc:date>2026-09-04T16:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: "VAS is not defined" for loaded Unified Checkout client library</title>
      <link>https://community.developer.cybersource.com/t5/cybersource-APIs/quot-VAS-is-not-defined-quot-for-loaded-Unified-Checkout-client/m-p/95935#M4488</link>
      <description>&lt;P&gt;The issue was a wrong combination of a `resourcePath` and `clientVersion` in the capture context authentication.&amp;nbsp; 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.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2026 16:46:21 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/cybersource-APIs/quot-VAS-is-not-defined-quot-for-loaded-Unified-Checkout-client/m-p/95935#M4488</guid>
      <dc:creator>oleglomakin</dc:creator>
      <dc:date>2026-09-04T16:46:21Z</dc:date>
    </item>
  </channel>
</rss>

