Repository navigation
Response Objects
All API methods return response objects with convenient getter methods and full data access.
Available on all response objects:
$response->isSuccess() // Check if request was successful
$response->isError() // Check if request failed
$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 arrayReturned by payment(), savedCardPayment(), splitPayment(), splitCardPayment(), preauth():
$response = $client->payment()->amount(100)->orderId('ORDER-123')->send();
// Check status
$response->isSuccess(); // true if payment initiated
// Get payment details
$response->getRedirectUrl(); // Payment page URL
$response->getTransaction(); // Transaction ID (e.g., te001234567)
$response->getAmount(); // Payment amount
$response->getOrderId(); // Your order ID
// Get bank response details
$response->getBankResponse(); // Bank response code
$response->getOperationCode(); // Operation code
$response->getOtherAttributes(); // Additional attributes array
// Get full data
$data = $response->toArray();Returned by paymentMethods():
$methods = $client->paymentMethods()->language(Language::AZ)->get();
// Business
$methods->getBusinessId(); // 14806
$methods->getBusinessName(); // Business page name
// Methods
$methods->getMethods(); // ['card', 'installment', 'wallet', 'google_pay', ...]
$methods->hasMethod(PaymentMethod::INSTALLMENT); // true / false
// Wallets (empty array when no active wallet)
$methods->getWallets(); // [['id' => 8, 'key' => 'portmanat', 'name' => 'Portmanat'], ...]
// Installment (null / empty when installment is disabled)
$methods->getInstallment(); // ['min_amount' => 30, 'banks' => [...]] or null
$methods->getInstallmentMinAmount(); // 30.0
$methods->getInstallmentBanks(); // [['id' => 2, 'name' => 'TamKart', 'bank' => 'ABB', 'image' => '...', 'months' => [3, 6, 12]], ...]Google Pay and Apple Pay may be active for the business, but your checkout should still check that the customer's device and browser support them.
Returned by checkStatus():
$status = $client->checkStatus()->transaction('te001234567')->get();
// or by your order ID: $client->checkStatus()->orderId('ORDER-001')->get();
// Get payment status
$status->getPaymentStatus(); // PaymentStatus enum (NEW, SUCCESS, ERROR)
$status->getStatus(); // Status string
$status->isSuccess(); // true if payment successful
// Get transaction details
$status->getTransaction(); // Transaction ID
$status->getAmount(); // Payment amount
$status->getOrderId(); // Your order ID
$status->getMessage(); // Status message
// Get bank response details
$status->getBankResponse(); // Bank response code
$status->getOtherAttributes(); // Additional attributes arrayReturned by checkCardStatus():
$status = $client->checkCardStatus()->cardId('ce001234567')->get();
// Get card status
$status->getCardStatus(); // CardStatus enum (NEW, ACTIVE, PENDING, REJECTED, EXPIRED, SESSION_EXPIRED)
$status->getStatus(); // Status string
// Get card details
$status->getCardId(); // Card ID
$status->getCardName(); // Cardholder name
$status->getCardMask(); // Masked card number (e.g., ****1234)
$status->getExpiredDate(); // Card expiry date (e.g., 12/25)
$status->getDescription(); // Card descriptionReturned by registerCard():
$response = $client->registerCard()->send();
// Card details (available in callback)
$response->getCardId(); // Saved card ID
$response->getCardMask(); // Masked card number (e.g., ****1234)
$response->getRedirectUrl(); // Card registration page URL
// Get bank response details
$response->getBankResponse(); // Bank response code
$response->getOperationCode(); // Operation code
$response->getRrn(); // Retrieval reference numberReturned by registerCardWithPay() and splitCardRegistrationWithPay():
$response = $client->registerCardWithPay()
->amount(100)
->orderId('ORDER-123')
->send();
// Card details (available in callback)
$response->getCardId(); // Saved card ID
$response->getCardMask(); // Masked card number (e.g., ****1234)
$response->getCardName(); // Card holder name
// Payment details
$response->getTransaction(); // Transaction ID
$response->getOrderId(); // Your order ID
$response->getAmount(); // Payment amount
$response->getRedirectUrl(); // Payment page URL
// Bank response details
$response->getBankTransaction(); // Bank transaction ID
$response->getRrn(); // Retrieval reference number
$response->getBankResponse(); // Bank response code
$response->getOperationCode(); // Operation code
$response->getOtherAttributes(); // Additional attributes arrayReturned by refund() and reverse():
$response = $client->refund()
->cardId($cardId)
->orderId($orderId)
->amount(50)
->send();
$response->isSuccess(); // Check if refund initiated
$response->getTransaction(); // Refund transaction ID
$response->getMessage(); // Refund status message
$response->getBankResponse(); // Bank response codeReturned by preauth()->complete():
$response = $client->preauth()->complete('te001234567', 85.00);
// Transaction details
$response->getTransaction(); // Transaction ID
$response->getAmount(); // Captured amount
// Card details
$response->getCardMask(); // Masked card number
$response->getCardName(); // Card holder name
// Bank response details
$response->getBankTransaction(); // Bank transaction ID
$response->getRrn(); // Retrieval reference number
$response->getBankResponse(); // Bank response codeReturned by widget()->create():
$widget = $client->widget()
->amount(75)
->orderId('ORDER-125')
->create();
$widget->getWidgetUrl(); // Apple Pay / Google Pay widget URL
$widget->isSuccess(); // Check if widget createdReturned by tokenPayment()->create(), applePaySession()->create() and applePay()/googlePay()->pay():
$tokenPayment->getPaymentId(); // Epoint payment ID for applePay()/googlePay()
$tokenPayment->getOrderId(); // Your order ID
$tokenPayment->getAmount(); // Stored amount (floored to 2 decimals)
$session->getSession(); // Merchant session for completeMerchantValidation()
$result->isSuccess(); // false for declined / already processed charges
$result->getCode(); // '000' on success, '400' on errors
$result->getOrderId(); // Your order ID
$result->getRedirectUrl(); // Configured redirect URL
$result->getResult(); // Raw processor result (for logs, without tokens)Get the complete response data as an associative array:
$response = $client->payment()
->amount(100)
->orderId('ORDER-123')
->send();
$data = $response->toArray();
print_r($data);
// Output:
// [
// 'status' => 'success',
// 'redirect_url' => 'https://epoint.az/payment/...',
// 'transaction' => 'te001234567',
// 'message' => 'Payment initiated',
// 'trace_id' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
// 'order_id' => 'ORDER-123',
// 'amount' => 100.00,
// 'currency' => 'AZN',
// // ... all other fields
// ]Use toArray() for debugging or logging:
$response = $client->payment()->amount(50)->orderId('TEST-001')->send();
// Log full response for debugging
error_log(print_r($response->toArray(), true));
// Or save to file
file_put_contents('response.log', print_r($response->toArray(), true), FILE_APPEND);When a request fails:
$response = $client->payment()->amount(100)->orderId('ORDER-123')->send();
if ($response->isError()) {
echo $response->getMessage(); // Error description
echo $response->getStatus(); // 'error'
echo $response->getTraceId(); // Trace ID for support
// Get full error details
$errorData = $response->toArray();
// [
// 'status' => 'error',
// 'message' => 'Invalid credentials',
// 'code' => 'AUTH_ERROR',
// 'trace_id' => '...',
// ]
}Used by payment status responses:
use Epoint\Enums\PaymentStatus;
$status = $client->checkStatus()->transaction('te001234567')->get();
switch ($status->getPaymentStatus()) {
case PaymentStatus::NEW:
echo 'Payment initiated, not completed';
break;
case PaymentStatus::SUCCESS:
echo 'Payment successful';
break;
case PaymentStatus::ERROR:
echo 'Payment failed';
break;
}Used by card status responses:
use Epoint\Enums\CardStatus;
$status = $client->checkCardStatus()->cardId('ce001234567')->get();
switch ($status->getCardStatus()) {
case CardStatus::ACTIVE:
echo 'Card is active';
break;
case CardStatus::PENDING:
echo 'Card registration pending';
break;
case CardStatus::EXPIRED:
echo 'Card has expired';
break;
case CardStatus::SESSION_EXPIRED:
echo 'Registration session expired';
break;
}Important: Always include the trace_id when reporting issues to Epoint support:
try {
$response = $client->payment()->amount(100)->orderId('ORDER-123')->send();
} catch (\Exception $e) {
$traceId = $response->getTraceId() ?? 'N/A';
error_log("Payment failed. Trace ID: {$traceId}. Error: " . $e->getMessage());
// Include trace_id when contacting Epoint support
echo "An error occurred. Please contact support with Trace ID: {$traceId}";
}Complete example showing all response methods:
$response = $client->payment()
->amount(100)
->orderId('ORDER-123')
->send();
// Basic checks
if ($response->isSuccess()) {
echo "✅ Success!\n";
} else {
echo "❌ Failed!\n";
}
// Get specific fields
echo "Status: " . $response->getStatus() . "\n";
echo "Message: " . $response->getMessage() . "\n";
echo "Transaction: " . $response->getTransaction() . "\n";
echo "Redirect URL: " . $response->getRedirectUrl() . "\n";
echo "Trace ID: " . $response->getTraceId() . "\n";
// Get everything
$fullData = $response->toArray();
echo "\nFull Response:\n";
print_r($fullData);