Integrating Apple Pay with 1C-Bitrix

Integrating Apple Pay with 1C-Bitrix We often receive requests to implement Apple Pay in online stores on 1C-Bitrix. Apple Pay is not a separate payment system but an overlay on existing acquiring. Without a bank-acquirer or aggregator supporting Apple Pay, no payment will go through. Many develo

Our competencies:

Frequently Asked Questions

Integrating Apple Pay with 1C-Bitrix

We often receive requests to implement Apple Pay in online stores on 1C-Bitrix. Apple Pay is not a separate payment system but an overlay on existing acquiring. Without a bank-acquirer or aggregator supporting Apple Pay, no payment will go through. Many developers underestimate the server part: Apple requires domain verification via a Merchant Identity Certificate, and without it the button won't appear no matter how well the JS code is written. Moreover, the payment session itself requires a three-way handshake between the user's browser, the store's server, and Apple's servers. Let's break down this process in detail.

Apple Developer documentation: "Before you can process payments, you must verify that you control the merchant's domain by uploading a domain association file."

Problems We Solve

Domain Verification in Apple Pay

  1. The frontend checks availability: ApplePaySession.canMakePayments() — works only in Safari on Apple devices.
  2. When a payment is initiated, the browser requests a Payment Session from the store's server.
  3. The store server proxies the request to Apple using the Merchant Identity Certificate.
  4. Apple verifies the domain → returns a session object.
  5. The user confirms with Face ID/Touch ID → the browser receives an encrypted token.
  6. The token is sent to the bank-acquirer to complete the transaction.

Steps 3–4 are critical — without server-side code, no button will work.

Why Direct Integration Takes Longer

With direct integration, you manage Apple certificates and sessions yourself. This gives full control but increases development time 2-3 times compared to an aggregator widget. A widget (CloudPayments, YooKassa) handles all server-side logic — just register the domain in your dashboard and add a few lines of JavaScript.

Method Timeline Complexity Reliability
Aggregator widget 1–2 days Low High (aggregator handles certificates)
Direct integration 3–5 days High Medium (depends on implementation)

How We Do It (Proof of Expertise)

Preparing Merchant ID and Certificates

  • Apple Developer Program account ($99/year) — to create Merchant ID and download certificates.
  • Domain verification: file .well-known/apple-developer-merchantid-domain-association in the site root.
  • Bank-acquirer or aggregator supporting Apple Pay.
  • HTTPS — Apple Pay is unavailable without SSL.
  • Configured 1C-Bitrix with the payment component sale.order.checkout.

Integration via Aggregator (Recommended Path)

If you already use CloudPayments or YooKassa, Apple Pay can be enabled through their widget. All server-side certificate handling is taken over by the aggregator:

// CloudPayments Widget const cp = new cp.CloudPayments({ publicId: 'pk_XXXXXX' }); // Check availability if (window.ApplePaySession && ApplePaySession.canMakePaymentsWithActiveCard('merchant.ru.shop')) { document.getElementById('apple-pay-btn').style.display = 'block'; } document.getElementById('apple-pay-btn').addEventListener('click', () => { cp.pay('applepay', { description: 'Order #' + orderId, amount: orderAmount, currency: 'RUB', invoiceId: String(orderId), accountId: customerEmail, }, { onSuccess: () => confirmOrderPaid(orderId), onFail: (reason) => showError(reason), }); }); 

You need to register the domain in the aggregator's dashboard beforehand — it will automatically add the verification file. This is the fastest path: according to statistics, payment conversion increases by 10-15%.

Server-Side Domain Validation (Direct Integration)

If you need an implementation without an aggregator widget:

// local/api/apple-pay-validate.php $validationUrl = filter_var($_POST['validationUrl'] ?? '', FILTER_VALIDATE_URL); // Allow only Apple domains if (!preg_match('#^https://apple-pay-gateway(-cert)?\.apple\.com#', $validationUrl)) { http_response_code(400); exit; } $ch = curl_init($validationUrl); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode([ 'merchantIdentifier' => 'merchant.ru.yourshop', 'domainName' => 'yourshop.ru', 'displayName' => 'Your Shop', ]), CURLOPT_SSLCERT => APPLE_PAY_CERT_PATH, CURLOPT_SSLKEY => APPLE_PAY_KEY_PATH, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json'], ]); $response = curl_exec($ch); curl_close($ch); header('Content-Type: application/json'); echo $response; 

JS Code on the Payment Page

const session = new ApplePaySession(3, { countryCode: 'RU', currencyCode: 'RUB', supportedNetworks: ['visa', 'masterCard', 'mir'], merchantCapabilities: ['supports3DS'], total: { label: 'Your Store', amount: String(orderAmount) }, }); session.onvalidatemerchant = async ({ validationURL }) => { const resp = await fetch('/api/apple-pay-validate.php', { method: 'POST', body: new URLSearchParams({ validationUrl: validationURL }), }); session.completeMerchantValidation(await resp.json()); }; session.onpaymentauthorized = async ({ payment }) => { const result = await sendTokenToServer(payment.token); session.completePayment( result.success ? ApplePaySession.STATUS_SUCCESS : ApplePaySession.STATUS_FAILURE ); }; session.begin(); 

Adding to Bitrix

We add the button to the sale.order.checkout template. It is displayed only when canMakePayments() === true. After receiving the token, an AJAX call to a PHP handler sends the token to the bank and calls $payment->setPaid('Y'). Proper events are configured: after successful payment, redirect to the order page.

What We Do (Scope of Work)

  • Registration of Merchant ID and certificate generation in Apple Developer.
  • Placement of the domain verification file.
  • HTTPS and SSL certificate setup (if needed).
  • Integration with the chosen aggregator or direct server-side validation.
  • Implementation of the Apple Pay button in the 1C-Bitrix payment template.
  • Testing on real devices (iPhone, iPad, Mac).
  • Documentation of the process for support.
Common Integration Mistakes
  • Incorrect Merchant ID or revoked certificate → the button does not appear.
  • Verification file not uploaded to the domain root → domain is not verified.
  • Missing 3DS support → transactions are declined.
  • canMakePayments check causes crash on older iOS versions.

Timelines

Task Timeline
Merchant ID registration, domain verification 0.5 day
Integration via aggregator widget 1–2 days
Direct integration with Apple Pay JS API 3–5 days

Contact us so we can evaluate your project and choose the optimal integration method. Request Apple Pay implementation — increase payment conversion by 10–15% without extra time investment. According to statistics, Apple Pay users spend 20% more than regular card payers.

We also recommend reviewing the Apple Pay documentation (original) and Wikipedia.