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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

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


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-server POST.


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

PHP Build Version
Package Version
Requires php Version ^8.2
ext-curl Version *
ext-json Version *
ext-hash Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package texhub/alif-pay contains the following files

Loading the files please wait ...