Stripe Integration with 1C-Bitrix: From Design to Deployment
A customer adds items to the cart, enters card details—and the page hangs. The payment doesn't go through, the order is lost, the client leaves for a competitor. This happens when a payment gateway integration with Bitrix is done hastily: no webhook handling, no signature verification, no idempotency. Stripe, as one of the most reliable payment systems, requires a careful connection with the CMS. We have completed over 50 successful Stripe integration projects with 1C-Bitrix—from startups to enterprise stores with turnovers in the hundreds of thousands of dollars. Each integration undergoes load testing and security checks.
Stripe covers the full cycle: card authorization, capture, refunds, subscriptions, 3D Secure. Works with Visa, Mastercard, AmEx, Apple Pay, Google Pay, and local methods (SEPA, iDEAL, Klarna). Stripe Checkout relieves the merchant of PCI DSS responsibility—all card data is processed on Stripe's side (Wikipedia: PCI DSS). Method availability depends on the merchant's country.
Choosing Between Checkout and Elements
For most Bitrix stores, we recommend Stripe Checkout. This approach is roughly 3 times simpler to implement—less code, automatic 3DS updates, and customers see a familiar Stripe interface. If you need full control over the payment form design, use Stripe Elements—it requires more server-side logic but offers flexibility. The choice depends on customization requirements and development time.
How to Integrate Stripe in Bitrix in 5 Steps?
- Design—choose approach (Checkout or Elements), agree on refund and subscription scheme.
-
Develop handler—write a class extending
\Bitrix\Sale\PaySystem\ServiceHandler, implementinitiatePay(),processRequest(),refund(). -
Configure webhooks—register endpoint in Stripe Dashboard, subscribe to events. Must verify signature via
Stripe-Signature. - Test—use test keys and card
4242 4242 4242 4242. Check successful payments, declines, refunds. - Deploy—switch to live keys, perform load testing. Timelines: Checkout—3–4 days, Elements—5–7 days.
| Test card type | Number |
|---|---|
| Successful payment | 4242 4242 4242 4242 |
| Decline | 4000 0000 0000 0002 |
| 3D Secure | 4000 0025 0000 3155 |
All test transactions do not charge real funds. More details in Stripe documentation.
What's Included in the Stripe Integration
- Development of the payment system handler (class extending
\Bitrix\Sale\PaySystem\ServiceHandler). - Webhook configuration and idempotency checks.
- Implementation of full and partial refunds via
\Stripe\Refund. - 3D Secure support (Checkout includes it automatically).
- Apple Pay and Google Pay activation (domain verification via
.well-known/apple-developer-merchantid-domain-associationfile). - Testing on test and live keys.
- Full documentation and staff training.
- Guarantee of correct payment processing—all integrations undergo load testing.
Creating a Checkout Session
\Stripe\Stripe::setApiKey($secretKey); $session = \Stripe\Checkout\Session::create([ 'payment_method_types' => ['card'], 'line_items' => [[ 'price_data' => [ 'currency' => 'eur', 'unit_amount' => $amountInCents, 'product_data' => ['name' => 'Order No.' . $orderId], ], 'quantity' => 1, ]], 'mode' => 'payment', 'success_url' => $successUrl . '?session_id={CHECKOUT_SESSION_ID}', 'failure_url' => $cancelUrl, 'metadata' => ['bitrix_order_id' => $orderId], ]); {CHECKOUT_SESSION_ID} is a Stripe placeholder that substitutes the real ID. In processRequest(), we verify it against the order.
Handling Webhooks
Webhooks are more important than success_url—the customer may close the tab before redirect. Stripe sends checkout.session.completed regardless of browser behavior. More about webhooks on Wikipedia.
Mandatory checks:
- Signature verification via the
Stripe-Signatureheader—otherwise anyone could fake a payment. - Idempotency—check the current status in
b_sale_orderbefore changing order status. - Return
200 OKwithin 3 seconds—otherwise Stripe will retry delivery.
Subscribe to events: checkout.session.completed, payment_intent.payment_failed, charge.refunded. More details in Stripe documentation.
Webhook example for checkout.session.completed
$payload = @file_get_contents('php://input'); $sigHeader = $_SERVER['HTTP_STRIPE_SIGNATURE']; $event = \Stripe\Webhook::constructEvent($payload, $sigHeader, $endpointSecret); if ($event->type === 'checkout.session.completed') { $session = $event->data->object; $orderId = $session->metadata->bitrix_order_id; // Order status update logic } Refunds and Partial Refunds
$refund = \Stripe\Refund::create([ 'payment_intent' => $paymentIntentId, 'amount' => $refundAmountInCents, 'reason' => 'requested_by_customer', ]); Stripe allows multiple partial refunds up to the full transaction amount.
Checkout vs Elements Comparison
| Criteria | Checkout | Elements |
|---|---|---|
| Effort | 3–4 days | 5–7 days |
| Customization | Limited | Full |
| PCI DSS | Not required | Not required |
| Apple/Google Pay | Automatic | Extra setup |
Based on our data, Checkout saves up to 40% of development and testing time. If you are unsure which to choose, contact us—we will select the best option for your budget and timeline.
Timelines
| Option | Time |
|---|---|
| Checkout | 3–4 days |
| Elements | 5–7 days |
| + Subscriptions | +3–5 days |
| + Apple/Google Pay | +1–2 days |
Settings in Bitrix Admin Panel
| Parameter | Source |
|---|---|
| Publishable Key | Stripe Dashboard → API keys |
| Secret Key | Stripe Dashboard → API keys |
| Webhook Secret | Stripe Dashboard → Webhooks |
| Mode | test/live in Dashboard |
Why Stripe is the Optimal Solution for Bitrix?
Over 50 completed payment system integrations. Many years of experience with Bitrix—since the platform's early versions. We guarantee: after deployment, payments run smoothly, refunds work correctly, and you receive full documentation. Contact us for a consultation—we will assess your project and offer the best solution. Order an audit of your current system or development from scratch.
Pricing and Savings
Typical integration cost starts from €500 for Checkout and €800 for Elements. Our clients save up to 40% on development time compared to custom solutions. Checkout is 3 times better than Elements in terms of implementation effort. For a seamless Stripe Bitrix integration, ensure you handle Stripe webhooks correctly. This combination of Stripe and Bitrix provides a robust payment system.

