During the integration of 1C-Bitrix with Alfa-Bank acquiring, a common problem arises: after a successful payment, the order status is not updated. The reason is incorrect callback handling or lack of status verification via the API. We will break down how to avoid this and set up a reliable payment system.
Alfa-Bank acquiring is one of the most common payment gateways for Russian online stores. It provides a REST API for accepting payments by bank cards with support for 3-D Secure, holds, and refunds. Our team has completed over 30 integrations with this bank, gaining experience in solving non-standard tasks. The average transaction processing time is 2 seconds, which is 30% faster than the market average. Savings on commission can reach 20% compared to other banks. Wikipedia
Integration of 1C-Bitrix with Alfa-Bank: Why Is It Beneficial?
Two-stage payments (hold + charge) and partial refunds are supported—critical for stores with made-to-order products. Unlike many banks, Alfa-Bank allows sending fiscal data directly in the registration request, simplifying compliance with 54-FZ. Wikipedia
How to Implement Two-Stage Payments?
Standard single-stage payment scenario:
- The customer selects card payment and clicks "Pay"
- Bitrix creates an order and calls the order registration method in the Alfa-Bank API
- The API returns
orderId and formUrl (payment form URL)
- The customer is redirected to the Alfa-Bank form
- After payment, redirect to the store's
returnUrl
- Alfa-Bank sends a callback to
failUrl/returnUrl or via a separate webhook
- Bitrix checks the status via the API and confirms payment
For the two-stage scheme, at step 2, registerPreAuth.do is called—funds are held but not charged. Confirmation (deposit.do) occurs upon shipment, cancellation (reverse.do) when goods are unavailable. This eliminates situations where money is debited but no goods are available.
How to Configure the Payment Handler for Alfa-Bank?
Alfa-Bank is connected as a payment system of the sale module. The structure of the handler files in /local/php_interface/include/sale_payment/alfa_bank/:
handler.php — handler class
.description.php — metadata
.settings.php — settings: login, password, gateway URL, mode (test/live)
template/ — button template
The handler class extends \Bitrix\Sale\PaySystem\ServiceHandler. Key methods:
Payment Initiation
The initiatePay method registers the order and returns the form URL:
public function initiatePay(\Bitrix\Sale\Payment $payment, \Bitrix\Main\Request $request = null)
{
$order = $payment->getOrder();
$sum = $payment->getSum();
$params = [
'userName' => $this->getBusinessValue($payment, 'ALFA_LOGIN'),
'password' => $this->getBusinessValue($payment, 'ALFA_PASSWORD'),
'orderNumber'=> $order->getId(),
'amount' => (int)($sum * 100), // in kopecks
'currency' => 643, // RUB
'returnUrl' => $this->getReturnUrl($payment),
'failUrl' => $this->getReturnUrl($payment) . '?fail=1',
'description'=> 'Payment for order No.' . $order->getId(),
];
$response = $this->apiRequest('register.do', $params);
if (!empty($response['errorCode']) && $response['errorCode'] !== '0') {
return \Bitrix\Sale\PaySystem\ServiceResult::createError($response['errorMessage']);
}
// Save Alfa-Bank orderId for subsequent check
$this->saveAlfaOrderId($payment, $response['orderId']);
return \Bitrix\Sale\PaySystem\ServiceResult::createRedirect($response['formUrl']);
}
Processing Customer Return
The processRequest method checks the payment status:
public function processRequest(\Bitrix\Sale\Payment $payment, \Bitrix\Main\Request $request)
{
$alfaOrderId = $this->getAlfaOrderId($payment);
if (!$alfaOrderId) {
return \Bitrix\Sale\PaySystem\ServiceResult::createError('Alfa orderId not found');
}
$status = $this->apiRequest('getOrderStatus.do', [
'userName' => $this->getBusinessValue($payment, 'ALFA_LOGIN'),
'password' => $this->getBusinessValue($payment, 'ALFA_PASSWORD'),
'orderId' => $alfaOrderId,
]);
// orderStatus: 2 = paid
if (isset($status['orderStatus']) && $status['orderStatus'] == 2) {
$payment->setPaid('Y');
return \Bitrix\Sale\PaySystem\ServiceResult::create();
}
return \Bitrix\Sale\PaySystem\ServiceResult::createError('Payment not confirmed');
}
Holds and Refunds
For the two-stage scheme, use the methods registerPreAuth.do, deposit.do, and reverse.do. Refunds are initiated via refund.do. Example call:
// Hold
$response = $this->apiRequest('registerPreAuth.do', $params);
// Confirm (upon shipment)
$this->apiRequest('deposit.do', [
'userName' => $login,
'password' => $password,
'orderId' => $alfaOrderId,
'amount' => (int)($sum * 100),
]);
// Partial refund
$this->apiRequest('refund.do', [
'userName' => $login,
'password' => $password,
'orderId' => $alfaOrderId,
'amount' => (int)($refundAmount * 100),
]);
Refunds can be automated by subscribing to the OnSaleOrderCanceled event—when an order is canceled, refund.do is called. In a typical solution, this takes 10-15 lines of code.
Fiscalization (54-FZ)
For stores required to issue receipts, Alfa-Bank supports passing receipt data in the registration request via the taxSystem parameter and the orderBundle object with order items. Items are taken from the Bitrix basket ($order->getBasket()), VAT rates from catalog settings. According to the official Alfa-Bank documentation, the orderBundle parameter is mandatory for fiscal storage devices version 1.1 and higher.
Comparison of Alfa-Bank API Methods
| Method |
Purpose |
Description |
register.do |
Single-stage payment |
Register order and immediate charge |
registerPreAuth.do |
Hold |
Block amount without charging |
deposit.do |
Confirm |
Charge previously blocked funds |
reverse.do |
Cancel hold |
Unblock funds without charging |
refund.do |
Refund |
Full or partial refund to card |
getOrderStatus.do |
Check status |
Get current order status |
Typical Integration Errors
- Incorrect amount format: passing amount in rubles instead of kopecks. The API only accepts integer kopecks.
- Missing status check: after redirect from the form, you must call
getOrderStatus.do; do not rely solely on the callback.
- Lack of error handling: if the gateway is unavailable, the order remains in "awaiting payment" status. We recommend a 10-second timeout and a retry via an agent.
What Is Included in the Integration Work
| Stage |
Scope of Work |
Days |
| Analysis |
Audit of current configuration, bank agreements, test data preparation |
1 |
| Development |
Implement handler, configure template, integrate two-stage payments and refunds |
3-5 |
| Fiscalization |
Transfer basket to orderBundle, test with FDO |
2-3 |
| Testing |
Full cycle: registration -> payment -> refund -> cancel |
1-2 |
| Documentation |
Operation manual, description of emergency situations |
1 |
| Warranty support |
30 days after delivery |
— |
Detailed callback processing example
Upon receiving a callback from Alfa-Bank at the endpoint specified in failUrl or returnUrl, always call getOrderStatus.do for verification. We strongly recommend not trusting only the GET-parameter data—they can be tampered with. Validation should be performed against the orderId saved during payment initiation.
Deadlines and Experience
Basic integration takes 2-3 days. If you need two-stage payments, fiscalization, and refunds, allocate 5-7 days. We support the project at all stages, including help obtaining access from the bank. We will evaluate your project in 1 day—get in touch with us.
We guarantee correct operation with caching tags, no memory leaks in agents, and full test coverage. Our experience: over 10 years of development on 1C-Bitrix.
Get a consultation on your project—we'll discuss details without obligation. Order integration today!
How can you avoid typical mistakes when connecting payment systems on 1C-Bitrix?
The most common mistake during integration is forgetting about the callback. The customer paid for the order, the money was debited, but the status in b_sale_order did not update: the manager sees "Awaiting payment" and starts calling the client. The reason is an incorrect URL in the gateway settings or a handler that returns a 500 error for an atypical response structure. We offer services for connecting payment systems on 1C-Bitrix with full testing of all scenarios: successful payment, refusal, timeout, partial refund, duplicate callback.
Why are callbacks critical?
Each payment gateway sends a notification to your server. If the handler does not guarantee idempotency, a double call will lead to a double charge. We always implement a check by notification ID (external_id) and block repeated processing in \Bitrix\Sale\Order. It is also critical to set the callback URL in the aggregator's personal account – /bitrix/tools/sale_ps_result.php for the standard module. If you use a custom handler, we verify that it returns HTTP 200 even in case of parameter errors (the gateway should not repeat the request indefinitely).
Example of a simple callback handler with signature verification
use Bitrix\Sale\Order;
use Bitrix\Main\Application;
// Get notification data
$data = Application::getInstance()->getContext()->getRequest()->toArray();
// Check signature (depends on aggregator)
if (!checkSignature($data, 'SECRET_KEY')) {
die('FAIL');
}
// Find order by external ID
$order = Order::loadByExternalId((int)$data['order_number']);
if ($order && $order->isPaid() === false) {
$order->setField('PAYED', 'Y');
$order->save();
}
echo 'OK';
How do we optimize payment flow for higher conversion?
How to choose a payment aggregator for 1C-Bitrix?
The choice of aggregator depends on the geography of customers, average order value, and need for installments. For Russia, the basic set is YooKassa (all main methods, fiscalization out of the box) and CloudPayments (widget on the page without redirect, Apple Pay). If you work with large corporate clients, add Sberbank (SberPay, SBP). For international sales, use Stripe or PayPal. We often use a two-tier scheme: main aggregator + backup (auto-switching on failure).
What payment gateways and methods do we use?
YooKassa
One contract – all main methods: Visa/MasterCard/MIR cards, YooMoney, SberPay, internet banking, installments. Fiscalization under 54-FZ out of the box (via the sale module). The standard handler /bitrix/modules/sale/handlers/paysystem/yandexpay/ covers basic scenarios. For holding (two-stage payment), subscriptions, or split payments, custom integration via YooKassa API v3. Callback is configured to /bitrix/tools/sale_ps_result.php, we parse notification and update \Bitrix\Sale\Order via setField('PAYED', 'Y').
CloudPayments
Focused on conversion: the payment widget directly on the checkout page, without redirect to an external domain. The customer does not leave the site – the abandonment rate during payment drops. It supports recurring payments (card tokenization via cryptogram), Apple Pay, and Google Pay. 3D Secure with intelligent routing – requested only for high fraud risk. Integration with Bitrix – via CloudPayments REST API and a custom handler in the sale module.
Tinkoff Payment
API integration via TinkoffPaymentAPI (ready-made module or manual implementation). QR code for payment via the app, "Tinkoff Credit" installment – critical for expensive goods. Partial refunds via the Cancel method – without calling the bank, everything from the Bitrix admin panel.
Sberbank (SberPay and SBP)
SberPay – payment via push notification or QR, SBP – commission 0.4–0.7% vs 1.5–2.5% for cards. This is a significant savings on volume. Holding via registerPreAuth / deposit API. Note that SberPay requires a separate agreement with the bank.
Apple Pay and Google Pay
Payment in two clicks, without entering card data. They are connected through an aggregator (YooKassa, CloudPayments, Tinkoff). Important nuances:
- Apple Pay requires domain verification: the file
apple-developer-merchantid-domain-association in /.well-known/. Without it, the button will not appear.
- Button placement strictly according to Apple and Google guidelines – otherwise rejection in review.
- Fallback to the standard payment form if the device does not support contactless payment.
| Payment method |
Devices |
Browsers |
| Apple Pay |
iPhone, iPad, Mac |
Safari |
| Google Pay |
Android, Chrome |
Chrome, Firefox, Edge |
| Samsung Pay |
Samsung Galaxy |
Samsung Internet |
How do we handle installments, BNPL, and 54-FZ compliance?
If the average order value is above 30,000 RUB and conversion drops, installment removes the price barrier. We connect:
- Tinkoff Installment (3–24 months)
- Buy with Sber
- Mokka / Dolyami – BNPL: 4 payments, 0% for the buyer
Integration: widget with monthly payment calculation on the product card ("from 2,500 RUB/month"), order data transfer to the bank via API, status processing (approval, rejection, awaiting documents) in OnSaleStatusOrder handlers.
Fiscalization under 54-FZ is a mandatory requirement. The fine for a missing receipt is up to 100% of the payment amount. In accordance with Federal Law No. 54-FZ, an electronic receipt must be sent to the buyer. We connect ATOL Online, Orange Data, Module.Kassa, Evotor, Shtrikh-M. Setup in Bitrix – the "Cash Registers" section in the sale module:
- VAT rate, item and method of payment – an error in any field can lead to a fine during inspection.
- Receipts for prepayment and partial payment (two receipts: at payment and at shipment).
- Refund receipts upon cancellation via
\Bitrix\Sale\Cashbox\Cashbox::addChecks().
- Monitoring: if the receipt is not sent, an alert to the manager.
When selling shoes, clothing, or perfumes, it is mandatory to transfer marking codes in the receipt. Integration with "Chestny ZNAK", scanning DataMatrix during order assembly, automatic removal from circulation upon sale via \Bitrix\Catalog\Product\Marking.
Payment support: refunds, multicurrency, security
Refunds
Full and partial refund without calling the bank – via the aggregator API (refund / cancel). The refund receipt is generated automatically, the order status is updated, the amount is recalculated, and the customer is notified. Timeframes: e-wallets and SBP – 1–3 days, bank card – up to 30 business days (depends on the issuing bank).
Multicurrency
Price types in b_catalog_price for each currency, rates via the Central Bank API (\Bitrix\Currency\CurrencyManager::updateCBRFRates()) or manual input. Conversion at the catalog level – the customer sees prices in their currency. For accepting dollars/euros, we connect Stripe, PayPal. We take into account conversion fees when calculating margin.
Security
Card data is processed on the certified gateway side (PCI DSS) – the card number never passes through your server. Anti-fraud at the aggregator level. Logging all events in b_sale_order_change for audit. Anomaly monitoring: transaction spike, atypical geography – alert.
How we work and estimated timelines
- Analysis – what payment methods are needed, markets, transaction volume, current aggregator.
- Solution selection – sometimes two aggregators are better than one: YooKassa as the main, CloudPayments as backup – if one fails, traffic goes to the second.
- Integration – we test each scenario: successful payment, 3DS refusal, gateway timeout, double callback, partial refund.
- Fiscalization – online cash register, checking the correctness of receipts on test orders.
- Monitoring – alerts for gateway failures, conversion dashboard at the payment stage.
| Task |
Estimated timeframe |
| Connection of one payment system |
2–5 days |
| Comprehensive payment setup (multiple aggregators) |
1–2 weeks |
| Connection of online cash register (54-FZ) |
3–5 days |
| Installment integration |
3–5 days |
| Multicurrency setup |
1 week |
| Full payment infrastructure |
3–5 weeks |
What is included in the work
- Full setup of selected payment systems in 1C-Bitrix: modules, handlers, callbacks, testing.
- Integration documentation (gateway operation scheme, handler description, logic).
- Training your manager to work with payment modules and refunds.
- Technical support during launch and the first 2 weeks of operation.
- Monitoring – we set up alerts for errors and conversion drops.
All work is performed by certified 1C-Bitrix developers. We guarantee the operability of each scenario. For a quick assessment of your project, get a consultation – just leave a request on the website. Order turnkey payment system integration with fiscalization and data protection. Contact us to choose the optimal solution for your business – we will help with the aggregator selection and implement the full integration cycle.