You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was using an older version of the Square API (12.0.0.20210616), which worked ok, but sent the wrong amount to the Square checkout page. For example, 1999 was being displayed as 19.98 on the checkout page. So, I upgraded to the newest version (19.1.1.20220616) to see if that would fix it, but now when I run it I'm getting:
parse_ini_file(): open_basedir restriction in effect. File(/opt/path/etc/php.ini) is not within the allowed path(s): (/home/users/username/www:/home/users/username/files:/home/users/username/tmp)
The error triggers on the line 119 in:
vendor/apimatic/jsonmapper/src/JsonMapper.php
This is the code I have to trigger the checkout page:
$client = new SquareClient([
'accessToken' => 'abc123',
'environment' => 'sandbox',
'numberOfRetries' => 5,
'timeout' => 120
]);
try {
// Call api
$api = $client->getCheckoutApi();
// Set money prefs
$mon = new Money();
$mon->setCurrency('GBP');
$mon->setAmount(1999);
// Item info
$item = new OrderLineItem(1);
$item->setName('Order Items');
$item->setBasePriceMoney($mon);
// Create order
$order = new Order(LOC_ID);
$order->setLineItems([$item]);
$order->setReferenceId($data['ref']);
// Create order request
$request = new CreateOrderRequest();
$request->setOrder($order);
// Set idempotency key
$checkout = new CreateCheckoutRequest(uniqid(), $request);
$checkout->setPrePopulateBuyerEmail('email@example.com');
$checkout->setRedirectUrl('https://www.page.com/');
// Fire it up
$response = $api->createCheckout(
LOC_ID,
$checkout
);
$response->getResult()->getCheckout()->getCheckoutPageUrl();
} catch (ApiException $e) {
// Catch error here
}
Any help would be appreciated, thank you. I understand why the error triggers, but not sure why it's trying to read the ini settings and reading them in an incorrect location?
The text was updated successfully, but these errors were encountered:
teamayu
changed the title
open_basedir restriction in JsonMapper
open_basedir restriction error in JsonMapper
Jul 1, 2022
I was using an older version of the Square API (12.0.0.20210616), which worked ok, but sent the wrong amount to the Square checkout page. For example, 1999 was being displayed as 19.98 on the checkout page. So, I upgraded to the newest version (19.1.1.20220616) to see if that would fix it, but now when I run it I'm getting:
parse_ini_file(): open_basedir restriction in effect. File(/opt/path/etc/php.ini) is not within the allowed path(s): (/home/users/username/www:/home/users/username/files:/home/users/username/tmp)
The error triggers on the line 119 in:
vendor/apimatic/jsonmapper/src/JsonMapper.php
This is the code I have to trigger the checkout page:
Any help would be appreciated, thank you. I understand why the error triggers, but not sure why it's trying to read the ini settings and reading them in an incorrect location?
The text was updated successfully, but these errors were encountered: