kna/payum-yandex-checkout

The Payum extension. It provides Yandex.Checkout integration

v1.0.0 2019-09-16 13:27 UTC

This package is auto-updated.

Last update: 2024-04-16 23:38:26 UTC


README

The Payum extension. It provides Yandex.Checkout integration.

Installation

composer require kna/payum-yandex-checkout

Configuring

use Payum\Core\GatewayFactoryInterface;
use Kna\Payum\YandexCheckout\YandexCheckoutGatewayFactory;

$payumBuilder->addGatewayFactory('yandex_checkout', function(array $config, GatewayFactoryInterface $gatewayFactory) {
    return new YandexCheckoutGatewayFactory($config, $gatewayFactory);
});

$payumBuilder->addGateway('yandex_checkout', [
    'factory' => 'yandex_checkout',
    'shop_id' => '<shop_id>', 
    'secret_key' => '<secret_key>',
    'payment_id_key' => 'payment_id', // optional
    'force_payment_id' => true // optional
]);

Symfony integration

PayumBundle installation

In order to use that extension with the Symfony, you will need to install PayumBundle first and configure it according to its documentation.

composer require payum/payum-bundle

Register YandexCheckoutGatewayFactory as a service

# app/config/services.yml

services:
  app.payum.yandex_checkout_factory:
    class: Payum\Core\Bridge\Symfony\Builder\GatewayFactoryBuilder
    arguments:
    - 'Kna\Payum\YandexCheckout\YandexCheckoutGatewayFactory'
    tags:
    - { name: payum.gateway_factory_builder, factory: yandex_checkout }

Configure the gateway

# app/config/config.yml

payum:
  gateways:
    yandex_checkout:
      factory: yandex_checkout
      shop_id: '<shop_id>'
      secret_key: '<secret_key>'
      payment_id_key: 'payment_id' # optional
      force_payment_id: true # optional

Gateway usage

Retrieve it from the payum service:

$gateway = $this->get('payum')->getGeteway('yandex_checkout');