xpat/tinkoffbundle

tinkoff paymen api bundle

Installs: 18

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:symfony-bundle

v1.0.1 2020-02-06 09:03 UTC

This package is auto-updated.

Last update: 2024-05-06 19:56:40 UTC


README

Installation

Use Composer for the automated process:

 composer require xpat/tinkoffbundle

Adding bundle to your application kernel

// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new Xpat\TinkoffBundle\XpatTinkoffBundle(),
        // ...
    ];
}

Config

in app/config/config.yml

   xpat_tinkoff:
     api_url: 'https://api-url.com' #required
     terminal_key: 'your_terminal_key' #required
     password: 'your_password' #required
     notification_route: 'app_my_notification_route' #optional
     success_route: 'app_my_success_route' #optional
     fail_route: 'app_my_fail_route' #optional

Usage

use Xpat\TinkoffBundle\Service\PaymentParameterBuilder;
use Xpat\TinkoffBundle\Service\TinkoffPaymentService;



class InitController extends Controller
{
    
    public function indexAction(PaymentParameterBuilder $parameterBuilder, TinkoffPaymentService $service)
    { 
        $params = $this->parameterBuilder->build();
        $params->setOrderId($orderId);
        $params->setAmount($amount);
        //set another fields
        $result = $service->initPayment($params);
        // handle result
        return $this->redirect($result->getPaymentURL());
        
    }
}