steroids / payment
2.0.0-beta.79
2022-01-17 09:31 UTC
Requires
- php: >=7.4
- steroids/core: *
This package is auto-updated.
Last update: 2026-05-20 15:30:53 UTC
README
Модуль оплаты через платежные системы
Пополнение счета в биллинге
$account = \steroids\billing\models\BillingAccount::findOrCreate('main', 'usd', $userId); $method = \steroids\payment\models\PaymentMethod::getByName('mymethod'); $order = $method->createOrder($userId, $account->currency->code, 10000, [ 'description' => 'Пополнение счета', ]); $order->addOperation(new PaymentChargeOperation([ 'fromAccount' => $method->systemAccount, 'toAccount' => $account, 'amount' => 10000, 'document' => $order, ])); $process = $order->start(\steroids\core\structure\RequestInfo::createFromYii()); // URL для переадресации пользователя $url = (string)$process->request;
Оплата товара (без биллинга)
$order = \steroids\payment\models\PaymentMethod::getByName('mymethod') ->createOrder($userId, 'usd', 5000, [ 'description' => 'Оплата ЛК на месяц (50$)', ]) ->addOperation(new AccountPaymentOperation([ // Документ будет создан в БД, когда платеж будет выполнен 'document' => [ 'period' => 'month', 'userId' => $userId, ], ])); $process = $order->start(\steroids\core\structure\RequestInfo::createFromYii()); // URL для переадресации пользователя $url = (string)$process->request;