Integrating 1C-Bitrix with Google Pay

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1175
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    811
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    564
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    747
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    655
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

Integrating 1C-Bitrix with Google Pay

Google Pay is a fast payment method available through the Chrome browser and Android devices without requiring manual card entry. Like Apple Pay, it is not a standalone payment system but a card tokenization interface built on top of an existing acquiring service. The key difference from Apple Pay: it works not only in mobile applications but also in Chrome on desktop — provided the user has saved a card in their Google account. The audience reach is broader, and the implementation through the Google Pay API is somewhat simpler than Apple Pay.

How It Works

The Google Pay API provides an encrypted payment token (Google Pay token) that must be passed to the acquirer's processing system. The flow:

  1. The Google Pay JS library (pay.google.com/gp/p/js/pay.js) loads on the page
  2. The buyer clicks "Pay with Google Pay"
  3. The browser displays a native confirmation dialog with the linked card
  4. Google Pay returns an encrypted token
  5. The store passes the token to the acquiring service (YooKassa, Tinkoff, Sber, Stripe)

Google Pay API Initialization

In the payment page template or in the JS file of a custom component:

const googlePayConfig = {
    environment: 'PRODUCTION',  // 'TEST' for testing
    apiVersion: 2,
    apiVersionMinor: 0,
};

const paymentsClient = new google.payments.api.PaymentsClient(googlePayConfig);

const allowedPaymentMethods = [{
    type: 'CARD',
    parameters: {
        allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'],
        allowedCardNetworks: ['MASTERCARD', 'VISA', 'MIR'],
    },
    tokenizationSpecification: {
        type: 'PAYMENT_GATEWAY',
        parameters: {
            gateway: 'yookassa',           // or 'tinkoff', 'sberbank', etc.
            gatewayMerchantId: 'SHOP_ID',  // your ID in the acquiring service
        },
    },
}];

// Check whether the user is ready to pay
paymentsClient.isReadyToPay({
    apiVersion: 2,
    apiVersionMinor: 0,
    allowedPaymentMethods,
}).then(response => {
    if (response.result) {
        const button = paymentsClient.createButton({
            onClick: processPayment,
            buttonColor: 'default',
            buttonType: 'pay',
        });
        document.getElementById('google-pay-container').appendChild(button);
    }
});

Payment Request

function processPayment() {
    const paymentDataRequest = {
        apiVersion: 2,
        apiVersionMinor: 0,
        allowedPaymentMethods,
        merchantInfo: {
            merchantId: 'BCR2DN4T...',  // Google Merchant ID from Google Pay Console
            merchantName: 'My Store',
        },
        transactionInfo: {
            totalPriceStatus: 'FINAL',
            totalPrice: orderTotal.toString(),  // string, e.g. '1500.00'
            currencyCode: 'RUB',
            countryCode: 'RU',
        },
    };

    paymentsClient.loadPaymentData(paymentDataRequest)
        .then(paymentData => {
            const token = paymentData.paymentMethodData.tokenizationData.token;
            return fetch('/bitrix/tools/gpay_charge.php', {
                method: 'POST',
                headers: {'Content-Type': 'application/json'},
                body: JSON.stringify({ token, orderId }),
            });
        })
        .then(res => res.json())
        .then(data => {
            if (data.success) window.location.href = data.redirect;
        })
        .catch(err => console.error('Google Pay error', err));
}

Server-Side Token Processing

// /bitrix/tools/gpay_charge.php
$input   = json_decode(file_get_contents('php://input'), true);
$gpToken = $input['token'];   // JSON string or object
$orderId = (int)$input['orderId'];

// For YooKassa, pass the token directly
$payment = $yookassaClient->createPayment([
    'amount'              => ['value' => getOrderAmount($orderId), 'currency' => 'RUB'],
    'payment_method_data' => [
        'type'         => 'google_pay',
        'payment_methodology_token' => is_string($gpToken) ? $gpToken : json_encode($gpToken),
    ],
    'capture'     => true,
    'description' => 'Order #' . $orderId,
], uniqid('', true));

$success = $payment->getStatus() === 'succeeded';
if ($success) {
    $bitrixPayment->setPaid('Y');
    $bitrixPayment->save();
}

header('Content-Type: application/json');
echo json_encode([
    'success'  => $success,
    'redirect' => $success ? '/personal/order/detail/' . $orderId . '/' : null,
]);

Testing

In TEST mode, Google Pay returns a fixed test token without a real card. For full testing with a real token, you need:

  • A Google Merchant ID (registered in Google Pay & Wallet Console)
  • A verified domain
  • Test cards from Google Pay Console → Test Cards

It is essential to test in Chrome on an Android device — the dialog behavior differs from desktop.

Timeline

Task Duration
JS integration of the Google Pay button 0.5 day
Server-side token processing via acquiring service 0.5 day
Registration in Google Pay Console + testing 1 day