/login'); } require("../../include/main-functions.php"); require("../../include/inputs.php"); require("../../include/panels.php"); $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']; $return_url = "https://e59.fr/pay/check_payment.php"; $merchant_code = "MCDYTE6Q"; $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; $charactersLength = strlen($characters); $checkout_reference = 'E59'; for ($i = 0; $i < 5; $i++) { $checkout_reference .= $characters[rand(0, $charactersLength - 1)]; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.sumup.com/v0.1/checkouts"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Authorization: Bearer $access_token", "Content-Type: application/json" ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'amount' => $amount, 'currency' => 'EUR', 'description' => $description, 'return_url' => $return_url, 'checkout_reference' => $checkout_reference, 'merchant_code' => $merchant_code ])); $response = curl_exec($ch); curl_close($ch); $responseData = json_decode($response, true); $checkout_id = $responseData['id']; ?>