Key Icon) OR generated via SDK (examples/14_generate_client_secret.php) // METHOD A: Standard Client Credentials (for simple services) // $baas->login( // clientId: 'your-client-id-uuid', // clientSecret: 'your-client-secret-string' // ); // METHOD B: Authorization Code Flow (H2H) (REQUIRED for Nominal Accounts) // See examples/13_h2h_auth_service.php for the full setup $auth = \Apoloz\AlfaBank\AlfaBank::auth( clientId: 'your-client-id', clientSecret: 'your-client-secret', redirectUri: 'https://...', certificatePath: __DIR__ . '/certs/client.cer', privateKeyPath: __DIR__ . '/certs/private.key', environment: Environment::SANDBOX ); // Assuming you have a saved refresh token: // $auth->refreshToken('saved_refresh_token'); echo "Authentication Successful!\n"; // 2. Create a Beneficiary (Counterparty) echo "Creating Beneficiary...\n"; // In a real app, use the DTOs // $payload = new CreateBeneficiaryRequestData(...); // $baas->send(new CreateBeneficiaryRequest($payload)); echo "Beneficiary Request Sent (Mock).\n"; } catch (\Exception $e) { echo "Error: " . $e->getMessage() . "\n"; if ($e instanceof \Apoloz\AlfaBank\Exceptions\AlfaBankException) { echo "API Code: " . $e->getErrorCode() . "\n"; } }