PHP code example of boshurik / payum-yandex-money

1. Go to this page and download the library: Download boshurik/payum-yandex-money library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

boshurik / payum-yandex-money example snippets



//config.php

use Payum\Core\PayumBuilder;
use Payum\Core\Payum;

/** @var Payum $payum */
$payum = (new PayumBuilder())
    ->addDefaultStorages()
    ->addGateway('gatewayName', [
        'factory' => 'yandex_money',
        'account'  => 'change it',
        'secret'  => 'change it',
    ])
    ->getPayum()
;

use BoShurik\Payum\YandexMoney\Api;

/** @var Payment $payment */
$payment->setDetails(array(
    Api::FIELD_PAYMENT_TYPE => Api::PAYMENT_AC, // Default
));

use BoShurik\Payum\YandexMoney\Api;

/** @var Payment $payment */
$payment->setDetails(array(
    Api::FIELD_QUICKPAY_FORM => Api::QUICKPAY_FORM_SHOP, // Default
));


namespace AppBundle;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use BoShurik\Payum\YandexMoney\Bridge\Symfony\YandexMoneyGatewayFactory;
use Payum\Bundle\PayumBundle\DependencyInjection\PayumExtension;

class AppBundle extends Bundle
{
    /**
     * @inheritDoc
     */
    public function build(ContainerBuilder $container)
    {
        parent::build($container);

        /** @var $extension PayumExtension */
        $extension = $container->getExtension('payum');

        $extension->addGatewayFactory(new YandexMoneyGatewayFactory());
    }
}