Repository navigation
Installation and Setup
Rauf Abbas edited this page Oct 22, 2026
·
3 revisions
Install the Epoint PHP SDK via Composer:
composer require rafoabbas/epoint-php- PHP: 8.2 or higher
- Extensions: ext-json, ext-curl
- Composer: Latest version recommended
Before using the SDK, you need to obtain credentials from Epoint.az:
- Contact Epoint: Reach out to Epoint support to register as a merchant
-
Receive Credentials:
- Public Key (Merchant ID) - e.g.,
i000000001 - Private Key - Keep this secret!
- Public Key (Merchant ID) - e.g.,
- Test Environment: Request test credentials for development
use Epoint\EpointClient;
$client = new EpointClient(
publicKey: 'i000000001', // Your merchant public key
privateKey: 'your-secret-key' // Your private key (keep secret!)
);For better security, use environment variables to store credentials:
$client = new EpointClient(
publicKey: getenv('EPOINT_PUBLIC_KEY'),
privateKey: getenv('EPOINT_PRIVATE_KEY')
);Create a .env file in your project root:
EPOINT_PUBLIC_KEY=i000000001
EPOINT_PRIVATE_KEY=your-actual-private-keyImportant: Add .env to your .gitignore file!
.env
.env.localAll options are optional and default to production:
$client = new EpointClient(
publicKey: 'i000000001',
privateKey: 'your-private-key',
baseUrl: 'https://epoint.az/api/1', // EpointClient::DEFAULT_BASE_URL; point it at a test environment if you have one
timeout: 30, // total request timeout in seconds
connectTimeout: 10, // connection timeout in seconds
);
// A copy with a shorter budget, e.g. for Apple Pay's ~30 s onpaymentauthorized window
$applePayClient = $client->withTimeout(20);Test that everything is working:
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Epoint\EpointClient;
$client = new EpointClient(
publicKey: 'i000000001',
privateKey: 'your-private-key'
);
// Check API health
$status = $client->heartbeat();
if ($status['status'] === 'ok') {
echo "✅ Epoint SDK is working!\n";
echo "API Status: {$status['status']}\n";
} else {
echo "❌ Connection failed\n";
}When creating payments, you'll need to configure these URLs:
Where to redirect users after successful payment:
->successUrl('https://yoursite.com/payment/success')Where to redirect users after failed payment:
->errorUrl('https://yoursite.com/payment/error')Your backend endpoint to receive payment notifications is configured once in your Epoint merchant panel, not per payment.
- Never Commit Credentials: Use environment variables, never hardcode keys
- Use HTTPS: Always use HTTPS for callback URLs
- Secure Private Key: Store private key securely, never expose in client-side code
- Rotate Keys: Periodically rotate your API keys
- Contact Epoint: Get test credentials from Epoint support for testing
- Quick Start Guide - Make your first payment
- Standard Payments - Learn about payment options
- Callback Handling - Handle payment notifications
# Update composer
composer self-update
# Clear cache
composer clear-cache
# Try again
composer require rafoabbas/epoint-php# Install required extensions (Ubuntu/Debian)
sudo apt-get install php-json php-curl
# Or for specific PHP version
sudo apt-get install php8.2-json php8.2-curl// Test API connectivity
$status = $client->heartbeat();
print_r($status);
// Check the base URL and timeouts the client uses
echo $client->getBaseUrl(), ' ', $client->getTimeout(), "s\n";