Anypay is a PHP library for conducting online payment transactions. This library provides the ability to connect to various payment gateways and offers a simple and uniform experience for developers through a unified API.
- Support for multiple payment gateways
- Error and exception management
- Dynamic payment settings configuration
- Trackable events for each stage of the payment process
$gateways = [
'asanpardakht',
'aqayepardakht',
'atipay',
'azkiVam', // Installment Anypay
'behpardakht', // mellat
'bitpay',
'digipay',
'etebarino', // Installment Anypay
'fanavacard',
'idpay',
'irankish',
'local',
'jibit',
'nextpay',
'omidpay',
'parsian',
'pasargad',
'payir',
'payfa',
'paypal', // will be added soon in next version
'payping',
'paystar',
'poolam',
'rayanpay',
'sadad', // melli
'saman',
'sep', // saman electronic Anypay, Keshavarzi & Saderat
'sepehr', // saderat
'sepordeh',
'sizpay',
'toman',
'vandar',
'walleta', // Installment Anypay
'yekpay',
'zarinpal',
'zibal'
];
این درگاهها به شما امکان میدهند تا با استفاده از تنظیمات مختلف، پرداختهای خود را از طریق درگاههای متنوع انجام دهید.
To use Anypay, you first need to add it to your PHP project. Then, you can manage your payment transactions via the API methods.
Below is a sample code for creating a payment transaction:
$config = ['driver' => 'gatewayName', 'api_key' => 'your_api_key'];
$anypay = new Samgeeksdev\Anypay\Anypay($config);
$invoice = new Samgeeksdev\Anypay\Invoice();
$invoice->amount(1000); // amount in Rials
$anypay->via('gatewayName')->purchase($invoice)->pay();
$config = ['api_key' => 'your_api_key'];
$gateway = 'gatewayName';
$amount = 1000; // amount in Rials
try {
$anypay = new Samgeeksdev\Anypay\Anypay($config);
$response = $anypay->payWith($gateway, $amount, $config);
echo $response->getContent(); // Display response details
} catch (Exception $e) {
echo 'Error in payment: ' . $e->getMessage();
php
try {
$anypay = new Samgeeksdev\Anypay\Anypay($config);
$receipt = $anypay->verify();
echo 'Payment confirmed. Transaction number: ' . $receipt->getTransactionId();
} catch (Exception $e) {
echo 'Error in payment confirmation: ' . $e->getMessage();
}
$invoice = (new Invoice)->amount(1000);
Anypay::via('driverName')->purchase(
$invoice,
function($driver, $transactionId) {
}
);
For further support and troubleshooting, you can visit the Issues section on GitHub or contact the support team.
This project is published under the MIT license. You can view the full version of the license in the LICENSE file available in the code repository.