Halva Installment Integration: API, Widget, Webhook

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1All 2062 services
Halva Installment Integration: API, Widget, Webhook
Medium
from 1 day to 3 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1358
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1251
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    956
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1188
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    929
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    947

Integrating Halva Installment Plan into Your Website

An e-commerce store owner loses customers at checkout — expensive items get abandoned due to lack of installment options. For example, an electronics store noticed that 40% of abandoned carts were for high-value items. After implementing the Halva widget, abandonment halved. Adding installment solves this: the buyer pays in parts, and the store receives the full amount immediately. We have integrated Halva for 15+ stores over several years, and conversion has increased by an average of 30%.

How the Halva Widget Works

Halva is a credit card from Sovcombank that offers interest-free installments. The cardholder pays without interest, while the store subsidizes the commission. For online stores, this is a tool to increase average order value: customers are more likely to buy expensive items when they see a breakdown like "4 monthly payments". The widget displays the monthly payment on the product card. It loads dynamically without slowing the page — encapsulated in an iframe, it does not affect LCP.

How It Works

Integration is done via the Halva API or partner widget. Basic flow:

  1. Buyer selects "Pay in installments with Halva"
  2. Store creates an order via API and receives a link
  3. Buyer authorizes in Halva system, confirms the installment
  4. Halva notifies the store of confirmation
  5. Store ships the goods

API Integration

You need a contract with Sovcombank. After that, you receive a partnerToken and environment settings. Note: the test endpoint differs from production — use environment variables.

class HalvaService
{
    private string $baseUrl = 'https://halvacard.ru/order/';
    private string $partnerToken;

    public function __construct()
    {
        $this->partnerToken = env('HALVA_PARTNER_TOKEN');
    }

    public function createOrder(Order $order): string
    {
        $response = Http::withHeaders([
            'Authorization' => 'Bearer ' . $this->partnerToken,
            'Content-Type'  => 'application/json',
        ])->post($this->baseUrl . 'create', [
            'amount'        => $order->total,          // in RUB
            'orderId'       => (string)$order->id,
            'successUrl'    => 'https://example.com/payment/success',
            'failUrl'       => 'https://example.com/payment/fail',
            'notifyUrl'     => 'https://example.com/webhook/halva',
            'partInstalment'=> 3, // number of months
            'contact'       => [
                'phone' => $order->customer_phone,
                'email' => $order->customer_email,
            ],
            'items' => $order->items->map(fn($item) => [
                'name'     => $item->product->name,
                'price'    => $item->price,
                'quantity' => $item->quantity,
                'sum'      => $item->price * $item->quantity,
            ])->toArray(),
        ]);

        if (!$response->ok()) {
            throw new \RuntimeException('Halva API error: ' . $response->body());
        }

        return $response->json('url'); // link to Halva page
    }
}

Widget for Displaying Installment on Product Card

Halva provides a JavaScript widget to show the monthly payment right on the product page:

<script src="https://halvacard.ru/widget/halva-widget.js"></script>
<div
  class="halva-widget"
  data-halva-price="14990"
  data-halva-months="3"
></div>

The widget automatically calculates and displays a monthly payment next to the price. If multiple installment options are available, it shows the minimum payment. According to our statistics, the widget doubles conversion compared to plain text offers.

Parameter Widget API
Ease of integration Instant Requires server setup
Term management Category-limited Flexible
Customization Minimal Full control

How to Secure Webhook Against Forgery

The webhook notifies the store about order status changes — APPROVED, REJECTED, or CANCELLED. Without it, you won't know if payment went through. HMAC-SHA256 signature prevents forgery: verify it on your side. The signature is computed from the request body and a secret key. Compare with the X-Halva-Signature header. If it doesn't match, discard the request.

public function webhook(Request $request): Response
{
    // Halva signs notifications with HMAC-SHA256
    $signature = $request->header('X-Halva-Signature');
    $expected  = hash_hmac('sha256', $request->getContent(), env('HALVA_WEBHOOK_SECRET'));

    if (!hash_equals($expected, $signature)) {
        return response('Forbidden', 403);
    }

    $data   = $request->json()->all();
    $status = $data['status'];  // APPROVED, REJECTED, CANCELLED
    $orderId = $data['orderId'];

    if ($status === 'APPROVED') {
        Order::where('id', $orderId)->update([
            'status'       => 'paid',
            'payment_type' => 'halva',
            'halva_order'  => $data['halvaOrderId'],
        ]);
        // initiate shipping
    }

    return response('OK');
}

When to Configure Installment Terms?

Different product categories may have different maximum installment terms (from 2 to 24 months), determined by the contract with Sovcombank. Check the term via API:

$terms = Http::withToken(env('HALVA_PARTNER_TOKEN'))
    ->get('https://halvacard.ru/order/terms', [
        'categoryId' => $product->halva_category_id,
    ])->json('months'); // array of available terms, e.g. [3, 6, 12]

Show only available terms to the buyer in a select.

Category Max term (months)
Electronics 12
Furniture 24
Clothing 6

Commission and Subsidizing

The store pays a commission to Sovcombank for each installment — a percentage of the amount, depending on the term. Longer terms mean higher commission. This must be factored into the economics: either include it in the price or treat it as a marketing cost for higher conversion. Average commission is 5% for a 6-month term, but can vary from 3% to 8%.

Common Integration Mistakes

  • Skipping HMAC signature verification on webhook — an attacker can forge notifications and mark orders as paid.
  • Using a test token in production — all requests go to sandbox.
  • Not handling CANCELLED status — orders remain stuck as "pending payment".
  • Passing an incorrect amount to the widget (without discounts) — the buyer sees one payment but a different one at checkout.

What's Included in Our Work

  • Preparation and submission of documents to Sovcombank
  • Widget setup on product cards
  • Implementation of API endpoints (order creation, status check)
  • Webhook handling with signature verification
  • Testing all scenarios (success, rejection, cancellation)
  • Providing documentation for your developers
  • Training staff to work with reports
  • Support for 14 days after launch

The connection to the Halva program takes 5 to 10 business days. It requires passing verification with Sovcombank. Contact us — we'll help you get through this stage faster. Get a consultation for your project today. We guarantee correct integration and support at all stages. Our experience: over 5 years in the market and 30+ completed projects.

Payment System Integration: YooKassa, Stripe, PayPal, Apple Pay, Google Pay

Conversion dropped by 12% immediately after the redesign. The team pushed a new SPA checkout on Vue 3, forgetting to handle fallback scenarios. Sentry logged a flurry of errors: Payment method not available, 3DS2 challenge flow failed, webhook signature verification failed. Users abandoned carts at the payment method selection stage. Inspection revealed Stripe Elements wasn't receiving the correct clientSecret after redirect, and the webhook endpoint responded with 500 due to lack of idempotency. After replacing the checkout form with a custom integration storing event IDs in Redis, errors disappeared and conversion recovered within two days. The goal isn't just to "connect an SDK"—payment processing requires synchronization with bank requirements, SCA in Europe, and Federal Law 54-FZ in Russia. Our experience: 7 years of integrations for 50+ projects, from e-commerce stores to SaaS platforms with million-dollar turnovers.

What's Included in Turnkey Work

  • Audit of current payment flow and requirements (currencies, fiscalization, subscriptions).
  • Provider selection based on geography and business model.
  • Backend integration (Laravel/Node.js/Go) with webhook handling, idempotency, and retries.
  • Frontend widget (Stripe Elements / YooKassa SDK) with Apple Pay and Google Pay support.
  • Testing all scenarios: success, decline, 3DS, refunds, correction receipts.
  • Monitoring of first transactions and documentation.

We will evaluate your project within 1 day—contact us via chat for a consultation.

Provider Comparison: Which to Choose

Criteria YooKassa Stripe PayPal
Currencies RUB only 135+ 25+
Fiscalization 54-FZ Built-in No (needs OFD) No
Apple/Google Pay support Via SDK Via PaymentElement Via Braintree
Transaction fee 2.5–4% 2.9% + $0.30 2.99% + $0.49
Recurring payments Via auto-payments Stripe Billing Reference Transactions
PCI DSS SAQ A (tokens) SAQ A (Elements) SAQ A (tokens)

Stripe wins on flexibility: 135+ currencies vs. YooKassa's single currency. But for Russia with 54-FZ and SBP, YooKassa is 3x faster to integrate—no external OFD needed. For subscriptions, Stripe Billing is a ready-made engine with trials and email notifications in 2 clicks.

How to Choose the Right Provider?

Three key points. Where do your clients live? Only Russia → YooKassa; globally → Stripe. Do you need 54-FZ fiscalization? Yes → YooKassa; otherwise Stripe + cloud OFD. Do you plan subscriptions? Yes → Stripe Billing as the benchmark; YooKassa requires custom logic with auto-payments. Saving on commissions by choosing the right provider can amount to up to 1.5% of turnover. For a project with 2 million RUB per month, that's 360,000 RUB per year.

Where the Real Difficulties Lie

Setting up a test mode takes an hour. Properly handling all scenarios takes weeks.

Webhook reliability. A webhook may not arrive—server unavailable, timeout, network issues. The provider retries with exponential backoff (Stripe up to 3 days). The handler must be idempotent: if payment.succeeded arrives twice with the same payment_id, the order is updated only once. This is implemented by storing event IDs in Redis with a TTL.

3DS2 and redirect flow. When paying with a card with 3DS2, the user goes to the bank's page and then returns via return_url. During this time, the session may expire or the cart may be cleared. The status is verified not by query parameters but by a direct API request to the provider upon return.

Partial refunds and receipts. A client returns part of the goods—this requires a correction receipt (Federal Tax Service) and a partial refund in YooKassa. Stripe natively supports partial_refund. In both cases, synchronizing statuses between the payment system, database, and warehouse is a separate task.

Currency limitations. YooKassa only handles rubles. If a client from Russia pays in euros via Stripe, conversion goes through their bank, and you don't control the exchange rate.

Why Do Webhooks Require Idempotency?

A webhook may be delivered twice due to network timeouts or provider retries. Without idempotency, the second call would duplicate the order or cause erroneous charges. The solution is to store a unique event ID (e.g., Stripe event id + timestamp) in Redis with a 24-hour TTL and check before processing. If the ID already exists, return 200 without executing business logic. Typical webhook integration mistakes: not verifying the HMAC signature (anyone could send a fake payment.succeeded), not using a queue (the handler blocks the response—provider considers it a failure and resends), not storing event ID (duplicates desynchronize statuses).

How We Build the Integration

Architecture. We never store card data—only tokens from the provider. Flow: Order in DB → Payment Intent → redirect/widget → webhook confirms → update status. The source of truth is the status in the payment system.

For Laravel we use stripe/stripe-php or yookassa-sdk. Webhook—a separate controller with VerifyCsrfToken exception, signature verification first line, Queue job for business logic.

For Next.js/React—@stripe/stripe-js + @stripe/react-stripe-js. PaymentElement includes Apple/Google Pay automatically. Example:

const stripe = await stripePromise;
const { error } = await stripe.confirmPayment({
  elements,
  confirmParams: { return_url: 'https://example.com/order/thank-you' },
});

Testing. Stripe CLI: stripe listen --forward-to localhost:8000/webhook. Test cards for all scenarios (3DS, decline, insufficient funds). Cypress checkout flow test in CI—mandatory stability guarantee.

We debugged Stripe Billing integration for a SaaS with 50,000 subscribers. The issue was handling invoice.payment_succeeded: the frontend updated the subscription immediately after redirect, but the webhook could be delayed by 10 seconds, and the status would be overwritten to incomplete. Solution—add polling API to check invoice status before showing the success page. This reduced erroneous cancellations by 18%.

Process and Timeline

Audit → provider selection → backend → frontend → tests → deploy → monitoring.

Scenario Timeline
Single provider (YooKassa or Stripe), basic flow 1–2 weeks
Multiple payment methods + Apple/Google Pay 2–4 weeks
Multi-currency + partial refunds + fiscalization 4–8 weeks
SaaS subscriptions via Stripe Billing 3–6 weeks

Pricing is custom. Order integration and your checkout won't crash on the next update.

Links:

We guarantee: 7 years of experience, 50+ successful integrations. Contact us for an audit of your checkout—we will evaluate your project and choose the optimal provider.