Download the PHP package texhub/alif-pay without Composer
On this page you can find all versions of the php package texhub/alif-pay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download texhub/alif-pay
More information about texhub/alif-pay
Files in texhub/alif-pay
Package alif-pay
Short Description Alif Acquiring (WebCheckout) payment gateway SDK for any PHP framework with first-class Laravel support: payments, tokenization, marketplace split-payments and webhooks.
License MIT
Homepage https://texhub.pro
Informations about the package alif-pay
TexHub · Alif Pay
English · Русский
A clean, framework-agnostic PHP SDK for the Alif Acquiring (WebCheckout) payment gateway — payments, tokenization and marketplace split-payments — with first-class Laravel support.
Works in plain PHP and any framework. Laravel gets auto-discovery, a config file and a facade for free.
Based on the official documentation: https://docs.acquiring.alif.tj/intro
Features
- Standard payments — Korti Milli, Alif wallet, Salom installments, cash invoices, Visa/Mastercard
- Tokenization — bind cards/wallets for repeat charges
- Marketplace — split a single payment between multiple sellers, hold & confirm delivery
- HMAC SHA256 signing — the exact double-HMAC scheme Alif requires, done for you
- Webhooks — typed callback objects + signature verification
- Pluggable HTTP transport — cURL by default; inject your own for testing
- Fully unit-tested, no network needed
- Test / Production environment switch
Installation
Requirements: PHP ≥ 8.2 with the curl, json and hash extensions.
Quick start (plain PHP)
Environments
| Environment | Base URL |
|---|---|
Environment::Test |
https://test-web.alif.tj |
Environment::Production |
https://web.alif.tj |
In the test environment you can use Alif's test cards to simulate scenarios (blocked card, insufficient funds, …) without moving real money.
Authorization (how signing works)
Every request is authorized with an HMAC SHA256 token built from the request data:
The SDK builds the correct dataToSign for each operation automatically:
| Operation | dataToSign |
|---|---|
| Payment / Marketplace | terminal_id + order_id + amount + callback_url |
| Tokenization | terminal_id + phone + gate |
| Confirm delivery | terminal_id + transaction_id + amount |
| Confirm VSA/MCR delivery | terminal_id + parent_transaction_id |
You never call the signer manually — but it's available via $alif->signature() if needed.
Payments
Gateways (Gate)
| Enum | gate value |
Method |
|---|---|---|
Gate::KortiMilli |
korti_milli |
National card (default) |
Gate::Wallet |
wallet |
Alif mobi wallet |
Gate::Salom |
salom |
Salom installment |
Gate::Invoice |
invoice |
Cash invoice |
Gate::Visa |
vsa |
Visa |
Gate::Mastercard |
mcr |
Mastercard |
Gate::CybersourceCheckout |
cybersource_checkout |
Cybersource hosted checkout |
Salom installment (with invoice items)
Cash invoice (with deadline)
Check status / cancel
Tokenization
Available gates: KortiMilli, Wallet, Salom, Tcell, Megafon, Babilon, ZetMobile, Procard (Visa/Mastercard).
Marketplace (split-payment)
The split total must equal the order amount — the SDK validates this before sending.
Funds are held until delivery is confirmed:
Webhooks (callbacks)
Alif sends a POST to your callback_url on every status change. Respond with HTTP 200 or it will retry.
Payment / marketplace callback
For marketplace, $callback->subTransactions holds the per-partner breakdown and $callback->isMarketplace() is true.
Tokenization callback
The tokenization callback has a different structure (result code at the root, data under
payload).
A note on callback signature verification
Alif signs callbacks with the same HMAC scheme, but the exact concatenation order for the callback token is not published. verifyPaymentCallback() defaults to orderId . amount; if your terminal differs, pass your own signing string:
Error handling
The gateway always replies with HTTP 200 and a business code. The SDK turns any non-200 code into an ApiException:
| Code | Meaning | Retry |
|---|---|---|
| 200 | Success | — |
| 208 | Duplicate order_id | No |
| 400 | Validation error | No |
| 401 | Auth error (token) | No |
| 403 | Invalid key | No |
| 404 | Not found | Yes |
| 500 | Internal error | Yes |
Laravel
The service provider and AlifPay facade are auto-discovered. Publish the config:
Add credentials to .env:
Use the facade (callback/return URL fall back to config):
…or resolve from the container / inject it:
Example callback controller
Exclude the callback route from CSRF protection (
VerifyCsrfToken::$except) since it's a server-to-serverPOST.
Testing
The SDK ships with a fake transport so you can test without hitting the network:
Run the package test suite:
Architecture
License
MIT © TexHub Pro — built by Mahmudi Shodmehr.
All versions of alif-pay with dependencies
ext-curl Version *
ext-json Version *
ext-hash Version *