Credit card issue

Question 1:
So this code is not neccecary/won’t work anymore correct? “onGetCardNonce(event)”

Question 2:
Can you kindly advise the name of the variable that will be posted which contains the token?
$response = $POST["________"];

I’m assuming this will turn $response in to an array and that will contain the token

Btw, I tried https://github.com/square/connect-api-examples/blob/master/connect-examples/v2/php_payment/process-payment.php
And the following code below does not work:

$json = file_get_contents(‘php://input’);
$data = json_decode($json);
$token = $data->token;
print_r($data); // = gives empty result

Thank you!! =))