- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
I've used the Checkout API example code on the square webpage to setup a way for people to pay from my website. I got to the stage where it works, so than I modified the code so the default info is instead pulled from a php form that my visitors would fill in:
//Create a Money object to represent the price of the line item.
$price = new \SquareConnect\Model\Money;
$price->setAmount($_REQUEST['showprice']);
$price->setCurrency('GBP');
//Create the line item and set details
$book = new \SquareConnect\Model\CreateOrderRequestLineItem;
$book->setName($_REQUEST['ticket']);
$book->setQuantity($_REQUEST['quantity']);
$book->setBasePriceMoney($price);
I can change the setName and setQuantity without any problem, but when I change the setAmount i get the following error message. Can anyone tell me what I'm doing wrong?
Exception when calling CheckoutApi->createCheckout: [HTTP/1.1 400 Bad Request] {"errors":[{"category":"INVALID_REQUEST_ERROR","code":"EXPECTED_INTEGER","detail":"Expected an integer value.","field":"order.line_items[0].base_price_money.amount"}]}
Hopefully this is a relatively simple answer: It looks like the `setAmount` isn't an integer.
You'll need to ensure that the amount that you are passing in is an integer.
Technical Program Manager: AI
Square Inc
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report