Package for working with the payment aggregator API enot.io
Use the package manager composer to install enot-io-payments.
composer require litlife/enot-io-payments
In this example, you can see how to generate a link that the user can click to make a payment
use Litlife\EnotIoPayments\EnotIoApi;
$orderAmount = 42.2;
$orderId = 4242;
$currency = 'RUB';
$comment = 'Some text';
$url = (new EnotIoApi())
->setMerchantId(424242)
->setSecretKey('secret key')
->getPaymentUrl($orderAmount, $orderId, $currency, $comment);
print_r($url);
Output:
https://enot.io/pay?m=424242&oa=42.2&o=4242&s=8a7d38fa09963aaadd32a8422fbfd397&cr=RUB&c=Some+text
use Litlife\EnotIoPayments\EnotIoApi;
$postArray = [
'merchant' => 150,
'amount' => 200.00,
'credited' => 196.00,
'intid' => 1545855,
'merchant_id' => 99,
'method' => 'cd',
'sign' => 'cd1d6b67f3335038656d9009ab4ecfa9',
'sign_2' => 'b86410d16a20bb57366d29b0d884bcb2',
'currency' => 'RUB',
'commission' => 0.00,
'payer_details' => '539175******7523',
'custom_field' => [
'email' => '[email protected]',
'id_user' => '125454'
]
];
$paymentStatus = (new EnotIoApi())
->setSecretKey2('secret key 2')
// validate params with secret key 2
->paymentStatus($postArray);
print_r($request->getAmount());
print_r($request->getCredited());
print_r($request->getIntId());
Output:
200.00 196.00 1545855
use Litlife\EnotIoPayments\EnotIoApi;
$shopId = 4242;
$enotTransactionId = 123;
$yourTransactionId = 456;
$paymentInfo = (new EnotIoApi())
->setEmail('[email protected]')
->setApiKey('api key')
->paymentInfo($shopId, $enotTransactionId, $yourTransactionId);
print_r($paymentInfo->getStatus());
print_r($paymentInfo->getCredited());
...
composer test