title: Square Web API for Android
body: <p>I'm trying to program a button in my web app that will launch the Square app on an Android tablet for payment processing.</p>
  
  <p>I've been following the web developer's guide and I get a syntax error when defining the payment typeType variable: Uncaught SyntaxError: Invalid or unexpected token</p>
  
  <p><a href="https://i.stack.imgur.com/MItCy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MItCy.png" alt="enter image description here"></a></p>
  
  <p>I'm not sure what could be wrong as this is straight from the example on square's documentation.</p>
  
  <p>Can anyone shed some light? Here is a sample of my code. </p>
  
  <p><strong>Button that launched the javascript code:</strong>   </p>
  
  <pre><code>&lt;div id="do_square_payment" align="center" style="display:none;"&gt;
                                  &lt;button id="do_square_payment_btn_android" value="Square" style="background-image:url(images/Square.png); height:200px; width:200px;" onClick="openURL();"&gt;&lt;/button&gt;&lt;br&gt;
  &lt;/div&gt; 
  </code></pre>
  
  <p><strong>Javascript code:</strong></p>
  
  <pre><code>&lt;script&gt;
  
  
                                  function openURL(){
                                  var amount = document.form.payment_amount_mobile.value;
  
  
                                  var amountFixed = amount * 100;
                                  console.log("Payment amount" + amountFixed);
  
  
                                    var posUrl =
                                      "intent:#Intent;" +
                                      "action=com.squareup.pos.action.CHARGE;" +
                                      "package=com.squareup;" +
                                      "S.browser_fallback_url=https://jaydien.ezservicetrax.com;" +
                                      "S.com.squareup.pos.WEB_CALLBACK_URI=https://jaydien.ezservicetrax.com;" +
                                      "S.com.squareup.pos.CLIENT_ID=sq0idp-OMMITED;" +
                                      "S.com.squareup.pos.API_VERSION=v2.0;" +
                                      "S.com.squareup.pos.CURRENCY_CODE=USD;" +
                                      "S.com.squareup.pos.TENDER_TYPES=com.squareup.pos.TENDER_CARD,com.squareup.pos.TENDER_CASH;" +
                                      "i.com.squareup.pos.TOTAL_AMOUNT="  + 
                                      amountFixed +
                                      ";" +
                                      "end";
  
                                    window.open(posUrl);
                                  }
                                 &lt;/script&gt;
  </code></pre>
  
  <p>Here is the url that is requested when I emulate an android device using the chrome developer tools:</p>
  
  <pre><code>intent:#Intent;action=com.squareup.pos.action.CHARGE;package=com.squareup;S.com.squareup.pos.WEB_CALLBACK_URI=https://jaydien.ezservicetrax.com;S.com.squareup.pos.CLIENT_ID=OMMITED;S.com.squareup.pos.API_VERSION=v2.0;i.com.squareup.pos.TOTAL_AMOUNT=5.00;S.com.squareup.pos.CURRENCY_CODE=USD;S.com.squareup.pos.TENDER_TYPES=com.squareup.pos.TENDER_CARD,com.squareup.pos.TENDER_CARD_ON_FILE,com.squareup.pos.TENDER_CASH,com.squareup.pos.TENDER_OTHER;end
  </code></pre>