1. Go to this page and download the library: Download rafoabbas/epoint-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rafoabbas / epoint-php example snippets
use Epoint\EpointClient;
$client = new EpointClient(
publicKey: 'i000000001', // Your merchant public key
privateKey: 'your-private-key' // Your merchant private key
);
use Epoint\Enums\Language;
$response = $client->payment()
->amount(100.50)
->orderId('ORDER-12345')
->description('Product purchase')
->language(Language::EN)
->successUrl('https://yoursite.com/payment/success')
->errorUrl('https://yoursite.com/payment/error')
->send();
if ($response->isSuccess()) {
// Redirect user to payment page
header('Location: ' . $response->getRedirectUrl());
}
// Register card without payment
$response = $client->registerCard()
->description('Save card for future purchases')
->successUrl('https://yoursite.com/cards/success')
->errorUrl('https://yoursite.com/cards/error')
->send();
// Get card_id from callback and store in your database
$cardId = $response->getCardId();
// Register card and process payment simultaneously
$response = $client->registerCardWithPay()
->amount(100.50)
->orderId('ORDER-123')
->description('First purchase + save card')
->successUrl('https://yoursite.com/cards/success')
->errorUrl('https://yoursite.com/cards/error')
->send();
// Get both card_id and transaction from response
$cardId = $response->getCardId();
$transaction = $response->getTransaction();
$status = $client->heartbeat();
if ($status['status'] === 'ok') {
echo 'Epoint API is operational';
}
$response = $client->payment()
->amount(100.00)
->orderId('ORDER-123')
->send();
// Use specific getter methods
$redirectUrl = $response->getRedirectUrl();
$transaction = $response->getTransaction();
$isSuccess = $response->isSuccess();
// Or get full response data as array
$fullData = $response->toArray();
print_r($fullData);
// Example output:
// [
// 'status' => 'success',
// 'redirect_url' => 'https://epoint.az/payment/...',
// 'transaction' => 'te001234567',
// 'message' => 'Payment initiated',
// 'trace_id' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
// // ... all other response fields
// ]
// Common methods (available on most responses)
$response->isSuccess() // Check if request was successful
$response->getStatus() // Get status: 'success', 'error', 'new', etc.
$response->getMessage() // Get response message
$response->getTraceId() // Get trace ID for troubleshooting
$response->toArray() // Get complete response data as array
// Payment-specific methods
$response->getRedirectUrl() // Payment page URL (for payment requests)
$response->getTransaction() // Transaction ID
$response->getAmount() // Payment amount
$response->getOrderId() // Your order ID
// Card-specific methods
$response->getCardId() // Saved card ID (for card registration)
$response->getCardMask() // Masked card number (e.g., "****1234")
// Widget-specific methods
$response->getWidgetUrl() // Apple Pay / Google Pay widget URL
// Status check methods
$response->getPaymentStatus() // PaymentStatus enum (NEW, SUCCESS, ERROR)
$response = $client->payment()->amount(50)->orderId('TEST-001')->send();
// Log full response for debugging
error_log(print_r($response->toArray(), true));
// Get trace_id for support requests
$traceId = $response->getTraceId();
try {
$response = $client->payment()->amount(100)->orderId('ORDER-123')->send();
} catch (\Exception $e) {
// Always log trace_id when errors occur
$traceId = $response->getTraceId() ?? 'N/A';
error_log("Payment failed. Trace ID: {$traceId}. Error: " . $e->getMessage());
// Include trace_id when reporting issues to Epoint support
}
### Enums
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.