39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
$id = "4ed8e666-b514-4b71-a5cd-f3c43bd4d406";
|
|
|
|
$client_id = 'cc_classic_znsSCWtxQRTJJVFaGqBgIjCqdES0e';
|
|
$client_secret = 'cc_sk_classic_WA2N5s5qZBk0aN0qozTfQh7RxXXjzFYa6JlYnRi7GNmQxIgeF1';
|
|
|
|
$ch = curl_init();
|
|
|
|
curl_setopt($ch, CURLOPT_URL, "https://api.sumup.com/token");
|
|
curl_setopt($ch, CURLOPT_POST, 1);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
|
|
'grant_type' => 'client_credentials',
|
|
'client_id' => $client_id,
|
|
'client_secret' => $client_secret
|
|
]));
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
$response = curl_exec($ch);
|
|
curl_close($ch);
|
|
|
|
$responseData = json_decode($response, true);
|
|
$access_token = $responseData['access_token'];
|
|
|
|
$ch = curl_init();
|
|
|
|
curl_setopt($ch, CURLOPT_URL, "https://api.sumup.com/v0.1/checkouts/$id");
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
"Authorization: Bearer $access_token",
|
|
"Content-Type: application/json"
|
|
]);
|
|
$response = curl_exec($ch);
|
|
curl_close($ch);
|
|
|
|
$responseData = json_decode($response, true);
|
|
foreach ($responseData as $key=>$value) {
|
|
echo "<br>$key : $value";
|
|
}
|
|
?>
|