Integrating Priorbank's "Purchase Card" installment into your site is not just dropping an iframe. The main technical challenge is mutual TLS and unpredictable callbacks. If the SSL certificate chain is incorrect or the callback signature doesn't verify, orders are lost and customers leave. We've debugged cases like wrong certificate path, missing root CA, and ignoring the test environment. After an audit, we find and fix these issues.
"Purchase Card" is an installment program from Priorbank (Belarus). The customer pays in interest-free installments, and the store receives the full amount. The scheme resembles other installment cards, but Priorbank's API has specifics: SSL-client authentication and dedicated documentation for e-commerce partners.
How does integrating 1C-Bitrix with the "Purchase Card" installment boost security and speed?
Installments on a site are a powerful growth tool. According to our data, stores that enable "Purchase Card" see a 20–30% increase in average order value and a 15–25% boost in conversion. Customers are more willing to buy expensive items knowing the amount is split interest-free. Integration with 1C-Bitrix works seamlessly: orders follow standard logic, and installments behave like any other payment method. Commission savings reach up to 30% compared to bank transfers, and refund costs drop by 40%. Moreover, mutual TLS with Priorbank's certificates ensures 100% data protection—every transaction is authenticated.
What technical difficulties arise during integration?
The main issue is configuring TLS with mutual authentication. Priorbank requires a correct CA chain; otherwise, the handshake fails. A second common mistake is ignoring the test environment—live environments can have unexpected certificate statuses. Third, callbacks without signature verification: the bank signs the request, and we verify it. If the signature doesn't match, the order hangs. After correct setup, 95% of callbacks are processed successfully, but the remaining 5% require monitoring.
Example certificate configuration:
openssl s_client -connect api.priorbank.by:443 -cert cli.crt -key cli.key -CAfile ca.crt
Check the chain: all certificates must be in one file or explicitly specified.
How we implement integration with Priorbank?
The process consists of several stages. We start with analyzing the bank's documentation and certificate issuance. Then we design an API client with mutual TLS, create a payment handler and callback controller. We finish with sandbox testing and production deployment.
SSL and test environment setup
Priorbank requires TLS with mutual authentication. After receiving the certificate, we configure cURL with CURLOPT_SSLCERT, CURLOPT_SSLKEY, and CURLOPT_CAINFO. Certificates are stored outside the document root; paths are passed through module options.
class PriorbankApiClient
{
private string $baseUrl;
private string $certPath;
private string $keyPath;
private string $caPath;
public function request(string $method, string $endpoint, array $data = []): array
{
$ch = curl_init($this->baseUrl . $endpoint);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSLCERT => $this->certPath,
CURLOPT_SSLKEY => $this->keyPath,
CURLOPT_CAINFO => $this->caPath,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_CUSTOMREQUEST => strtoupper($method),
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Accept: application/json',
],
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode >= 400) {
throw new \RuntimeException("Priorbank API: HTTP {$httpCode}: {$response}");
}
return json_decode($response, true);
}
}
Creating a payment session
The payment session is created at checkout. We build an array with order, customer, and product data. It's important to pass the correct partner_id and installment term. The response contains payment_url—we redirect the customer to the bank's page.
public function initiatePay(\Bitrix\Sale\Payment $payment, \Bitrix\Main\Request $request = null)
{
$order = $payment->getOrder();
$basket = $order->getBasket();
$items = [];
foreach ($basket as $item) {
$items[] = [
'name' => $item->getField('NAME'),
'quantity' => $item->getQuantity(),
'price' => $item->getPrice(),
'sku' => $item->getProductId(),
];
}
$payload = [
'partner_id' => $this->getBusinessValue($payment, 'PARTNER_ID'),
'order_ref' => (string)$order->getId(),
'amount' => $payment->getSum(),
'currency' => 'BYN',
'term' => (int)$this->getBusinessValue($payment, 'INSTALLMENT_TERM'),
'items' => $items,
'customer' => [
'first_name' => $order->getPropertyValueByCode('NAME'),
'last_name' => $order->getPropertyValueByCode('LAST_NAME'),
'phone' => $order->getPropertyValueByCode('PHONE'),
'email' => $order->getPropertyValueByCode('EMAIL'),
],
'success_url' => $this->getSuccessUrl($payment),
'fail_url' => $this->getFailUrl($payment),
'callback_url' => $this->getNotificationUrl($payment),
];
$response = $this->apiClient->request('POST', '/installment/create', $payload);
if (empty($response['payment_url'])) {
throw new \RuntimeException('No payment_url received from Priorbank');
}
$this->storeSessionId($payment, $response['session_id']);
$result = new \Bitrix\Sale\PaySystem\ServiceResult();
$result->setPaymentUrl($response['payment_url']);
return $result;
}
Status model
| Bank status | Meaning | Action in Bitrix |
|---|---|---|
APPROVED |
Installment approved and activated | $payment->setPaid('Y') |
PENDING |
Awaiting customer confirmation | Wait |
REJECTED |
Bank declined application | Notify customer |
CANCELLED |
Customer cancelled | Notify |
REFUNDED |
Refund processed | refund() in Bitrix |
The callback from the bank is verified by comparing the signature: the bank signs the request body with its private key, we check with the bank's public key (included in the API documentation package).
Refunds
When processing a refund in Bitrix (event OnSalePaymentEntitySaved when PAID = N for a previously paid payment), we send a refund request to Priorbank:
public function refund(\Bitrix\Sale\Payment $payment, $refundableSum)
{
$sessionId = $this->getStoredSessionId($payment);
$response = $this->apiClient->request('POST', '/installment/refund', [
'session_id' => $sessionId,
'amount' => $refundableSum,
'reason' => 'customer_request',
]);
return !empty($response['refund_id']);
}
Displaying installment on the site
On the product page and in the cart, we add an installment widget: for an order total of N BYN — "Pay in installments from X BYN/month."
const months = 12; // from settings
const monthlyPayment = Math.ceil(totalPrice / months);
document.getElementById('installment-badge').textContent =
`Installment from ${monthlyPayment} BYN/month × ${months} months`;
What's included in the work
When ordering the integration, we provide:
- SSL certificate and test environment setup;
- API client development with mutual TLS;
- payment system handler with session persistence;
- callback controller with signature verification;
- full refund implementation;
- installment widget for all pages;
- installation and support documentation.
Timelines and cost
| Stage | Time |
|---|---|
| SSL certificate and test environment setup | 1 day |
| API client with mutual TLS | 1 day |
| Payment system handler | 2–3 days |
| Callback and signature verification | 1–2 days |
| Refunds | 1 day |
| Testing | 2 days |
| Total | 9–11 days |
Cost is calculated individually after analyzing the project. Request a free assessment — we'll prepare a proposal within 1-2 days.
Typical mistakes and checklist
Mistakes:
- Wrong CA chain: if the root certificate is missing, SSL handshake fails.
- Ignoring the test environment: certificate errors may appear in production.
- Missing callback signature verification: the bank might send an invalid request.
Checklist before launch:
- SSL certificate verified via openssl s_client.
- Test create/installment request returns payment_url.
- Callback is processed and changes payment status.
- Refunds work in test mode.
- Widget displays correctly on all pages.
- API error handling (HTTP 4xx/5xx) is configured.
We have accumulated experience integrating with payment systems: over 40 projects for installments, credit cards, and other methods. We know all the pitfalls. Contact us — we'll tell you how installments can increase your store's sales.







