# SQUARE web payments api shows error "square.js:1 Unexpected token '\<', "\<br /\> \<b\>"... is not valid JSON"

**URL:** <https://developer.squareup.com/forums/t/square-web-payments-api-shows-error-square-js-1-unexpected-token-br-b-is-not-valid-json/7961>\
**Category:** Questions\
**Created:** [December 15, 2022, 10:06am UTC](https://developer.squareup.com/forums/t/square-web-payments-api-shows-error-square-js-1-unexpected-token-br-b-is-not-valid-json/7961 "2022-12-15T10:06:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![webideasmaker](https://avatars.discourse-cdn.com/v4/letter/w/85e7bf/32.png) [@webideasmaker](https://developer.squareup.com/forums/u/webideasmaker)\
**Post date:** [December 15, 2022, 10:06am UTC](https://developer.squareup.com/forums/t/square-web-payments-api-shows-error-square-js-1-unexpected-token-br-b-is-not-valid-json/7961/1 "2022-12-15T10:06:31Z")

</div>

Hi,  
I am using SQUARE web payments API and getting this error.  
“square.js:1 Unexpected token ‘\<’, “  
  
**”… is not valid JSON”.  
on line having following code ,**

 

$data = json\_decode(file\_get\_contents(‘php://input’), true);

Please help.  
Thanks.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [December 15, 2022, 4:49pm UTC](https://developer.squareup.com/forums/t/square-web-payments-api-shows-error-square-js-1-unexpected-token-br-b-is-not-valid-json/7961/2 "2022-12-15T16:49:32Z")

</div>

Is this with one of our examples? Looks like the request to `CreatePayment` isn’t valid JSON. 🙂

---

<div class="post-metadata">

**Author:** ![dkweb](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@dkweb](https://developer.squareup.com/forums/u/dkweb)\
**Post date:** [October 21, 2023, 7:50am UTC](https://developer.squareup.com/forums/t/square-web-payments-api-shows-error-square-js-1-unexpected-token-br-b-is-not-valid-json/7961/3 "2023-10-21T07:50:24Z")

</div>

I am also getting same issue using php javascript.  
error : square.js:1 Unexpected token ‘\<’, “  
  
**”… is not valid JSON**

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [October 23, 2023, 3:29pm UTC](https://developer.squareup.com/forums/t/square-web-payments-api-shows-error-square-js-1-unexpected-token-br-b-is-not-valid-json/7961/4 "2023-10-23T15:29:10Z")

</div>

Is this with our [PHP example](https://github.com/square/connect-api-examples/tree/master/connect-examples/v2/php_payment) or just the [Web Payments SDK](https://developer.squareup.com/docs/web-payments/overview) with a PHP backend? 🙂
