Skip to Content
docs

PHP SDK

Modern PHP SDK for integrating Epoint.az payment gateway into your application. Supports all payment methods, card tokenization, split payments, preauth, Apple Pay, Google Pay, wallets, and invoices.

Features

  • Standard payments, checkout redirect
  • Card registration & saved card payments
  • Split payments between merchants
  • Pre-authorization (hold & capture)
  • Refunds & reversals
  • Apple Pay & Google Pay via token widget
  • Wallet payments
  • Invoice management
  • Signature verification for callbacks
  • Type-safe with PHP 8.2+ enums

Requirements

  • PHP 8.2 or higher
  • ext-json, ext-curl

Installation

cURL
1composer require rafoabbas/epoint-php

Quick Start

Initialize Client

PHP
1use Epoint\EpointClient;
2
3$client = new EpointClient(
4 publicKey: 'i000000001',
5 privateKey: 'your-private-key'
6);

Create Payment

PHP
1use Epoint\Enums\Language;
2
3$response = $client->payment()
4 ->amount(100.50)
5 ->orderId('ORDER-12345')
6 ->description('Product purchase')
7 ->language(Language::EN)
8 ->successUrl('https://yoursite.com/payment/success')
9 ->errorUrl('https://yoursite.com/payment/error')
10 ->send();
11
12if ($response->isSuccess()) {
13 header('Location: ' . $response->getRedirectUrl());
14}

Handle Callback

PHP
1$data = $_POST['data'];
2$signature = $_POST['signature'];
3
4try {
5 $callbackData = $client->verifyCallback($data, $signature);
6
7 if ($callbackData['status'] === 'success') {
8 $orderId = $callbackData['order_id'];
9 $transaction = $callbackData['transaction'];
10 // Update your database
11 }
12} catch (\Epoint\Exceptions\SignatureVerificationException $e) {
13 http_response_code(400);
14}

Check Payment Status

PHP
1$status = $client->checkStatus()
2 ->transaction('te001234567')
3 ->get();
4
5if ($status->getPaymentStatus() === \Epoint\Enums\PaymentStatus::SUCCESS) {
6 echo 'Payment successful!';
7}

Card Registration

PHP
1$response = $client->registerCard()
2 ->description('Save card for future purchases')
3 ->successUrl('https://yoursite.com/cards/success')
4 ->errorUrl('https://yoursite.com/cards/error')
5 ->send();

Payment with Saved Card

PHP
1$response = $client->savedCardPayment()
2 ->cardId('saved-card-id')
3 ->amount(25.00)
4 ->orderId('ORDER-002')
5 ->description('Subscription renewal')
6 ->execute();

Split Payment

PHP
1$response = $client->splitPayment()
2 ->amount(100.00)
3 ->orderId('ORDER-003')
4 ->splitUser('i000000002')
5 ->splitAmount(30.00)
6 ->description('Marketplace order')
7 ->send();

Pre-Authorization

PHP
1// Step 1: Create hold
2$response = $client->preauth()
3 ->amount(100.00)
4 ->orderId('ORDER-004')
5 ->description('Hotel reservation')
6 ->send();
7
8// Step 2: Capture funds
9$completeResponse = $client->preauth()
10 ->complete($response->getTransaction(), 85.00);

Refund & Reverse

PHP
1// Refund to registered card
2$response = $client->refund()
3 ->cardId('card-id')
4 ->orderId('order-id')
5 ->amount(50.00)
6 ->send();
7
8// Reverse transaction
9$response = $client->reverse()
10 ->transaction('te001234567')
11 ->amount(100.00)
12 ->send();

Apple Pay / Google Pay

PHP
1$widget = $client->widget()
2 ->amount(75.00)
3 ->orderId('ORDER-005')
4 ->description('Digital wallet payment')
5 ->create();
6
7echo '<iframe src="' . $widget->getWidgetUrl() . '"></iframe>';

Invoices

PHP
1$invoice = $client->invoice()->create([
2 'sum' => 150.00,
3 'display' => 1,
4 'save_as_template' => 0,
5 'name' => 'John Doe',
6 'description' => 'Invoice for services',
7 'period_from' => '2024-01-01',
8 'period_to' => '2024-12-31',
9]);
10
11$client->invoice()->sendSms($invoice['id'], '+994501234567');
12$client->invoice()->sendEmail($invoice['id'], '[email protected]');

API Reference

MethodDescription
payment()Create standard payment
checkStatus()Check payment status
registerCard()Register card without payment
registerCardWithPay()Register card with payment
savedCardPayment()Pay with saved card
refund()Refund payment
reverse()Reverse transaction
splitPayment()Split payment between merchants
splitCardPayment()Split payment with saved card
preauth()Pre-authorization
widget()Apple Pay / Google Pay widget
wallet()Wallet operations
invoice()Invoice management
heartbeat()API health check
verifyCallback()Verify callback signature