I have the following error in my backend php code for a paypal transaction:
<br />
<b>Parse error</b>: syntax error, unexpected '[' in <b>E:\web\chartmyg\TESTPAYPAL\backend.php</b> on line <b>95</b><br />
This is the particular section of the code ($data = [
is the line it complains about):
$json = file_get_contents('php://input');
$input = json_decode($json, false);
$price = $input->cost;
$description = $input->description;
$this->generateAccessToken();
// THIS NEXT LINE IS THE ERROR
$data = [
"intent" => "CAPTURE",
"purchase_units" => [[
"description" => $description,
"amount" => [
"currency_code" => "GBP",
"value" => $price,
],
]]
];
$json = json_encode($data);
$curl = curl_init();
Could the be an access issue with Paypal?
When I load the page before clicking the Paypal button it gives me an error:
Failed to load resource: net::ERR_NAME_NOT_RESOLVED
This is the problem here:
<script data-namespace="paypalbutton4" src="https://www.paypal.com/sdk/js?debug=true&intent=capture¤cy=GBP&client-id=AeXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXX"></script>