Skip to main content


Affirm Merchant Help

Single Product or Cart page

  • Include:
    • Placeholder element
    • Affirm JS
    • Embed code below
  • Pass in:
    • Product price variable to the updateAffirmAsLowAs() function defined in the embed code
  • Account for:
    • Price change on product variant selection
Affirm JS

  _affirm_config = {
    public_api_key:  "XXXXXXXXXXXXXXX",
    script:          ""
  (function(l,g,m,e,a,f,b){var d,c=l[m]||{},h=document.createElement(f),n=document.getElementsByTagName(f)[0],k=function(a,b,c){return function(){a[b]._.push([c,arguments])}};c[e]=k(c,e,"set");d=c[e];c[a]={};c[a]._=[];d._=[];c[a][b]=k(c,a,b);a=0;for(b="set add save post open empty reset on off trigger ready setProduct".split(" ");a<b.length;a++)d[b[a]]=k(c,e,b[a]);a=0;for(b=["get","token","url","items"];a<b.length;a++)d[b[a]]=function(){};h.async=!0;h.src=g[f];n.parentNode.insertBefore(h,n);delete g[f];d(g);l[m]=c})(window,_affirm_config,"affirm","checkout","ui","script","ready");
 // Use your live public API Key and script to point to Affirm production environment.

Note: Be sure to use your public API key from the sandbox merchant dashboard for 'public_api_key' and a session ID variable for the optional 'session_id' to take advantage of additional analytics. The API key must match the Affirm-environment you're referencing ('sandbox' or 'live').


<a class="affirm-as-low-as" data-amount="50000" data-affirm-color="blue"></a>

  • Was this article helpful?