App Settings URL or Overview). * 2. You have the TLS certificates (.pem/.key) authorized by the bank. * - Prod: You sent CSR to bank, they enabled integration and sent .cer back. * - Sandbox: You downloaded them from the email/portal. */ // 1. Configuration $certPath = __DIR__ . '/certs/transport.crt'; // Your mTLS certificate $keyPath = __DIR__ . '/certs/transport.key'; // Your mTLS private key $clientId = 'YOUR_CLIENT_ID_UUID'; // E.g. '0cee0683-85ae-...' // 2. Initialize Connector (No Login required yet) $baas = AlfaBank::baas( certificatePath: $certPath, privateKeyPath: $keyPath, environment: Environment::SANDBOX // Change to PRODUCTION for real usage ); try { echo "Requesting new Client Secret for Client ID: {$clientId}...\n"; // 3. Send Request $request = new RefreshClientSecretRequest($clientId); $response = $baas->send($request); // 4. Output Result $data = $response->dto(); // Returns ClientSecretData echo "\n-------------------------------------------------------\n"; echo "SUCCESS! New Client Secret Generated:\n"; echo "-------------------------------------------------------\n"; echo "Client ID: " . $data->clientId . "\n"; echo "Client Secret: " . $data->clientSecret . "\n"; echo "-------------------------------------------------------\n"; echo "IMPORTANT: Save this to your .env file immediately.\n"; echo "It will not be shown again.\n"; } catch (\Exception $e) { echo "\nERROR: Could not generate secret.\n"; echo "Message: " . $e->getMessage() . "\n"; if (method_exists($e, 'getResponse')) { echo "Response: " . $e->getResponse()->body() . "\n"; } }