CloudPayments Integration

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.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

CloudPayments Payment System Integration

CloudPayments is Russian processor with good documentation, built-in cash register (54-ФЗ), recurring payment support, and convenient widget. Differs from competitors: payment form opens over site, not redirecting customer away — higher conversion.

Integration Variants

CloudPayments offers three embedding methods:

  1. Widget — JavaScript popup, fastest to implement
  2. Checkout — embedded form via iframe
  3. API — direct processing without third-party redirects (requires PCI DSS SAQ A-EP or higher)

For most sites widget fits. API needed if fully controlling form UI or implementing tokenization.

Widget Integration

<script src="https://widget.cloudpayments.ru/bundles/cloudpayments.js"></script>
const pay = () => {
  const widget = new cp.CloudPayments({ language: 'ru-RU' });

  widget.charge(
    {
      publicId:     'pk_xxxxxxxxxxxxxxxxxxxx',
      description:  'Order #12345',
      amount:       1500,
      currency:     'RUB',
      accountId:    '[email protected]',
      invoiceId:    'order-12345',
      skin:         'mini',
      data: {
        // arbitrary metadata, returned in webhook
        orderId: 12345,
      },
    },
    (options) => {
      // success — don't trust without server check
      console.log('payment success', options);
    },
    (reason, options) => {
      console.error('payment failed:', reason);
    },
  );
};

publicId — public key from personal account. Secret key (apiSecret) — server only, never frontend.

Webhook

After payment CloudPayments sends POST to URL specified in personal account (Notifications section). Notification type — payment:

public function handleWebhook(Request $request): Response
{
    // Check HMAC-signature
    $hmac = base64_encode(
        hash_hmac('sha256', $request->getContent(), env('CP_API_SECRET'), true)
    );

    if ($hmac !== $request->header('Content-HMAC')) {
        return response('Invalid signature', 403);
    }

    $data = $request->all();

    if ($data['Status'] === 'Completed') {
        $orderId = $data['InvoiceId'];
        $amount  = $data['Amount'];

        Order::where('id', $orderId)
            ->where('total', $amount)
            ->update(['status' => 'paid', 'transaction_id' => $data['TransactionId']]);
    }

    // CloudPayments expects code 200 with body {"code":0}
    return response()->json(['code' => 0]);
}

If return {"code": 13}, CloudPayments resends notification up to 10 times. Useful for temporary DB errors.

Fiscalization

CloudPayments has built-in cash register. Receipt data passed in cloudPayments.customerReceipt within widget data object:

data: {
  cloudPayments: {
    customerReceipt: {
      Items: [
        {
          label:    'Product 1',
          price:    1500.00,
          quantity: 1.0,
          amount:   1500.00,
          vat:      null, // null=no VAT
          method:   0,    // 0=full payment
          object:   1,    // 1=commodity
        },
      ],
      taxationSystem: 1, // 1=USN income
      email:           '[email protected]',
      amounts: {
        electronic: 1500.00,
        advancePayment: 0.00,
        credit: 0.00,
        provision: 0.00,
      },
    },
  },
}

Card Tokenization

For repeat payments without entering details CloudPayments returns Token in first successful payment. Save in DB and use for subsequent debits:

// Repeat debit via token through API
$response = Http::withBasicAuth(env('CP_PUBLIC_ID'), env('CP_API_SECRET'))
    ->post('https://api.cloudpayments.ru/payments/tokens/charge', [
        'Amount'      => 1500,
        'Currency'    => 'RUB',
        'AccountId'   => '[email protected]',
        'Token'       => $savedToken,
        'InvoiceId'   => 'order-12346',
        'Description' => 'Auto debit',
    ]);

Refunds via API

Http::withBasicAuth(env('CP_PUBLIC_ID'), env('CP_API_SECRET'))
    ->post('https://api.cloudpayments.ru/payments/refund', [
        'TransactionId' => 123456789,
        'Amount'        => 750, // partial
    ]);

Performance and Features

CloudPayments widget loads external script ~180 KB. Load lazily — only on user interaction with payment button, not page load. Production account activation after application — 1 to 3 business days, faster than most Russian competitors.