kevinkopf/finik-kg-symfony-bundle

This is the Symfony bundle to integrate Finik.kg payment system into your application.

v0.0.0 2025-08-23 09:48 UTC

This package is auto-updated.

Last update: 2025-09-11 15:33:13 UTC


README

WARNING! This package is not yet ready for production usage!

This is the Symfony bundle to integrate Finik.kg into your application.

Installation

To install the bundle, you can use Composer. Run the following command in your terminal:

composer require kevinkopf/finik-kg-symfony-bundle

Make sure to enable the bundle in your bundles.php file:

// config/bundles.php
return [
    // ...
    KevinKopf\FinikKgPaymentBundle\FinikKgPaymentBundle::class => ['all' => true],
];

Usage

Configuration

To configure the bundle, you need to add the following configuration to your config/packages/finik_kg_payment.yaml file:

finik_kg_payment:
  secret_key: '%env(resolve:FINIK_KG_SECRET_KEY)%'
  public_key: '%env(resolve:FINIK_KG_PUBLIC_KEY)%'
  pass_phrase: '%env(FINIK_KG_PASSPHRASE)%'
  api_key: '%env(FINIK_KG_API_KEY)%'
  base_url: '%env(FINIK_KG_BASE_URL)%'
  redirect_url: '%env(FINIK_KG_REDIRECT_URL)%'
  account_id: '%env(FINIK_KG_ACCOUNT_ID)%'
  merchant_code: '%env(FINIK_KG_MERCHANT_CODE)%'

Note that the values are pointing to environmental variables. So either set up the .env (or the .env.local) file or set it in the environment directly. It's up to you.

Generating your RSA keys

Before you can use Finik.kg, you need to generate your RSA keys. You can do this using the following command:

php bin/console finik:generate-keys

If you already have a key pair, the command will fail. You may use the --overwrite flag to overwrite the existing keys.

Generating the payment link

You will need to create a Payment and use it in PaymentManager. The Payment needs a UUID4 for paymentId argument. You may use ramsey/uuid for this.

<?php

namespace YourApp\Payment\Handler;

use KevinKopf\FinikKgPaymentBundle\Payment\Payment;
use KevinKopf\FinikKgPaymentBundle\Payment\PaymentManager;
use Ramsey\Uuid\Uuid;

class YourAppPaymentHandler
{
    public function __construct(
        private PaymentManager $paymentManager,
    ) {
    ...
    }
    
    public function generateRedirectLink(): string
    {
        return $this->paymentManager->authorize(
            new Payment(
                amount: 2000,
                paymentId: (Uuid::uuid4())->toString(),
            )
        );
    }
}

In this example generateRedirectLink returns a URL that you need to redirect your user to. The URL will take the user to finik.kg payment gate, where they'll be able to pay for their order via a QR code.