title: how can i write a cookie from a page to another page
body: <p>I have the code below on <a href="https://kooboid.com/sign-up/step-two/" rel="nofollow noreferrer">https://kooboid.com/sign-up/step-two/</a> . but I want to save cookies on <a href="https://kooboid.com/payment" rel="nofollow noreferrer">https://kooboid.com/payment</a> too.the cookie will save on <a href="https://kooboid.com/sign-up/step-two/" rel="nofollow noreferrer">https://kooboid.com/sign-up/step-two/</a> successfully and i can use it. but it does not seem to save cookie on <a href="https://kooboid.com/payment" rel="nofollow noreferrer">https://kooboid.com/payment</a>. I do not know why.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function getplanSetcookie(the_price,the_quantity){
      const urlParams = new URLSearchParams(window.location.search);
      var thePlan = urlParams.get('plan');
      if(thePlan != "" &amp;&amp; thePlan != null){
                  //set cookie on payment page
                  SetCookie("plan",thePlan,null,"/payment","kooboid.com",null);
                  SetCookie("price",the_price,null,"/payment","kooboid.com",null);
                  SetCookie("quantity",the_quantity,null,"/payment","kooboid.com",null);
                  
                  //set cookie on sign up step two page
                  SetCookie("plan",thePlan,null,"/sign-up/step-two/","kooboid.com",null);
                  SetCookie("price",the_price,null,"/sign-up/step-two/","kooboid.com",null);
                  SetCookie("quantity",the_quantity,null,"/sign-up/step-two/","kooboid.com",null);
          
              return thePlan;
      }else{
          //alert(getCookie("referal_code"));
          thePlan = getCookie("plan");
          if(thePlan != undefined){
              return thePlan;
          } else{
                      return "";
                  }
      }
  }
      function SetCookie (name, value, expires, path, domain, secure){
          
          var expString = ((expires == null)? "" : (":expires=" + expires.toGMTString()));
          var pathString = ((path == null) ? "" : (": path=" + path));
          var domainString = (domain == null)? "" :("; domain=" + domain);
          var secureString = ((secure == true) ? "; secure" : "");
          var cookieString = name + "=" 
          + escape (value) + expString + pathString 
          + domainString + secureString;
          console.log(cookieString);
          document.cookie = cookieString;
      }</code></pre>
  </div>
  </div>
  </p>
  <p>when I print the cookie in a script on <a href="https://kooboid.com/payment" rel="nofollow noreferrer">https://kooboid.com/payment</a>,
  with this code:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>console.log(document.cookie);</code></pre>
  </div>
  </div>
  </p>
  <p>it does not include the cookie which I set for <a href="https://kooboid.com/payment" rel="nofollow noreferrer">https://kooboid.com/payment</a> in the code on <a href="https://kooboid.com/sign-up/step-two/" rel="nofollow noreferrer">https://kooboid.com/sign-up/step-two/</a> . what is the problem?</p>