1C-Bitrix Integration with PayKeeper Payment System
Integrating the PayKeeper payment gateway with 1C-Bitrix is a task that every store owner faces when wanting full control over payments. Without proper notification handling and fiscalization, your store risks losing money and facing fines. We have been solving this problem for over 50 projects—from e-commerce stores to B2B portals, saving clients up to 150,000 rubles per year.
Recently we deployed PayKeeper for a store processing 10,000 orders per month. The requirements included full 54-FZ fiscalization and refund handling. Result: payment time dropped to 15 seconds, and commission was 20% lower than with YooKassa, saving up to 100,000 rubles per month on a turnover of 1 million rubles. Integration cost starts from 30,000 rubles and varies by complexity. PayKeeper offers 99.9% uptime guarantee.
How PayKeeper Works
PayKeeper is a PHP application that runs as a payment server on your domain or in the cloud. The store creates an invoice via API, obtains the payment form URL, and the buyer enters card details. Payment notifications are sent to result_url. As per PayKeeper documentation, all requests are protected by an MD5 signature.
PayKeeper Integration Step-by-Step Process
The process consists of the following steps: 1) Install module, 2) Create invoice via API, 3) Handle notifications, 4) Test all scenarios.
Step 1: Install and Configure the Module
Install the PayKeeper module from Bitrix Marketplace or our custom module. In the payment system settings, enter your PayKeeper server URL, username, and secret password. Ensure HTTPS is enabled.
Step 2: Create Invoice via API
Use the code below to create an invoice. Replace placeholders with your actual credentials.
Click to expand code example
$apiUrl = $this->getBusinessValue($payment, 'PAYKEEPER_URL'); // https://your.paykeeper.ru $clientId = $this->getBusinessValue($payment, 'PAYKEEPER_USER'); $clientSecret = $this->getBusinessValue($payment, 'PAYKEEPER_PASSWORD'); $orderId = $payment->getOrder()->getId(); $sum = $payment->getSum(); // Get token $tokenResponse = $this->httpPost($apiUrl . '/info/settings/token/', [], [ 'Authorization: Basic ' . base64_encode("{$clientId}:{$clientSecret}"), ]); $token = $tokenResponse['token']; // Create invoice $invoiceParams = [ 'pay_amount' => number_format($sum, 2, '.', ''), 'clientid' => $payment->getOrder()->getUserId(), 'orderid' => $orderId, 'client_email' => $email, 'client_phone' => $phone, 'service_name' => 'Payment for order #' . $orderId, ]; $invoiceParams['token'] = md5(implode('', $invoiceParams) . $token); $invoice = $this->httpPost($apiUrl . '/change/invoice/preview/', $invoiceParams); // $invoice['invoice_id'] — invoice ID // Payment form: $apiUrl . '/?id=' . $invoice['invoice_id'] Step 3: Handle Payment Notifications
PayKeeper sends POST to result_url upon payment. Verify the signature and confirm the order.
$clientSecret = $this->getBusinessValue($payment, 'PAYKEEPER_PASSWORD'); $id = $_POST['id']; $sum = $_POST['sum']; $orderId = $_POST['orderid']; $key = $_POST['key']; // Check signature $expected = md5($id . $sum . $orderId . $clientSecret); if (strtolower($key) !== strtolower($expected)) { http_response_code(400); echo 'bad signature'; exit; } // Additional check via API $paymentInfo = $this->httpGet($apiUrl . '/info/payments/byid/', ['id' => $id], $token); if ($paymentInfo['status'] === 'paid') { // Confirm payment in Bitrix $order = \Bitrix\Sale\Order::loadByAccountNumber($orderId); // ... setPaid('Y'), save() } echo 'OK'; Step 4: Test All Scenarios
Test successful payment, failed payment, refund, and partial refund. Ensure fiscalization works.
Why Choose PayKeeper?
PayKeeper is 20% cheaper than YooKassa when turnover exceeds 1 million rubles per month, saving you up to 100,000 rubles monthly. Customer data stays on your server—you are not dependent on an external gateway. Unlike Robokassa, you have full control: your own domain, your own certificates. PayKeeper supports invoices, refunds, and fiscalization. It can be self-hosted on your own server or VPS, offering maximum security and data privacy. The API URL is unique per store, so in Bitrix payment system settings you need a field for the PayKeeper server URL rather than hardcoding it.
Refunds and Fiscalization
PayKeeper supports refunds via API:
$refundParams = [ 'id' => $paykeeperPaymentId, 'amount' => number_format($refundAmount, 2, '.', ''), ]; $refundParams['token'] = md5(implode('', $refundParams) . $token); $result = $this->httpPost($apiUrl . '/change/payment/return/', $refundParams); To comply with Federal Law 54-FZ, PayKeeper has built-in integration with online cash registers (OFD). Receipt data is transmitted when creating an invoice via basket parameters. The item composition is taken from $order->getBasket(). We configure the transmission of all requisites and guarantee correct fiscalization of refunds.
Error Handling and Security
PayKeeper may be temporarily unavailable or return a timeout error. Therefore, a queue mechanism should be added to the integration code:
// If payment not confirmed, retry in 5 minutes if ($attempt < 3) { \Bitrix\Sale\PaymentCollection::addToQueue([ 'order_id' => $orderId, 'attempt' => $attempt + 1, 'next_try' => (new \DateTime())->modify('+5 minutes') ]); } Log all requests and responses from PayKeeper for debugging. Save POST requests and responses with timestamps in a table like b_sale_payment_log.
Security requirements of 54-FZ and personal data protection:
- Do not transmit full card numbers in logs—mask the last 4 digits
- Use HTTPS for all requests (disable certificate check only in development)
- Store PAYKEEPER_PASSWORD only in
.envor a protected config table, never in HTML
Typical Integration Mistakes
- Not verifying the notification signature. Without checking
key, an attacker can forge notifications—always validate themd5with the secret. - Hardcoding the server URL. PayKeeper may be installed on any domain—use settings in the admin panel, not constants.
- Ignoring fiscalization of partial refunds. In a partial refund, transmit only the returned items—critical for OFD.
- Missing notification queue. If
result_urlhangs, the payment remains unprocessed. Add a background job that queries the status every hour. - Confusing payment statuses. PayKeeper returns
paid,failed,cancelled—handle each status correctly in Bitrix.
What Our Work Includes
| Stage | Details |
|---|---|
| Analysis | Examine payment scheme, fiscalization requirements, choose PayKeeper deployment method |
| Development | Module with settings, payment, refund, and notification scenarios |
| Fiscalization | Configure receipt transmission to OFD per 54-FZ |
| Testing | Verify all scenarios: success, failure, refund, partial refund |
| Documentation | Admin and support manuals |
Deliverables
- Module: Ready-to-use Bitrix module with PayKeeper integration (supports Cloud and On-Premise)
- Documentation: Configuration guide, admin manual, and support documentation for your team
- Access: Admin panel access for payment system settings and log inspection
- Training: 2-hour online training for your staff on module usage and troubleshooting (reduced emphasis)
- Support: 1 month post-integration support (email, phone, and remote assistance)
Approximate Timelines
| Task | Timeframe |
|---|---|
| Token retrieval + invoice creation + notification handling | 2–3 days |
| Refunds | +1 day |
| Fiscalization | +1–2 days |
| Testing | 0.5–1 day |
The cost is calculated individually. We work with any Bitrix version and guarantee compatibility with the latest updates. Contact us for a project evaluation and get a free consultation on PayKeeper integration.

