PHP code example of koh / sylius-mpp

1. Go to this page and download the library: Download koh/sylius-mpp 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/ */

    

koh / sylius-mpp example snippets


// config/bundles.php
return [
    // …
    Koh\SyliusAgentContracts\KohSyliusAgentContractsBundle::class => ['all' => true],
    Koh\SyliusMpp\KohSyliusMppBundle::class => ['all' => true],
];

use Koh\SyliusAgentContracts\Context\AgentContext;
use Koh\SyliusAgentContracts\Model\PayableOperation;
use Koh\SyliusAgentContracts\Provider\PayableOperationProviderInterface;

final class FeedPrice implements PayableOperationProviderInterface
{
    public function getPayableOperations(AgentContext $context): iterable
    {
        yield new PayableOperation(
            path: '/api/agent/feed',
            method: 'GET',
            intent: 'charge',
            payMethod: 'tempo',
            amount: '10000',          // smallest unit of the currency
            currency: '0x…',          // ISO 4217 for fiat, token address for a token
            description: 'Product feed',
        );
    }
}