PHP code example of payum-tw / collect

1. Go to this page and download the library: Download payum-tw/collect 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/ */

    

payum-tw / collect example snippets




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

$defaultConfig = [];

$payum = (new PayumBuilder)
    ->addGatewayFactory('collect', function(array $config, GatewayFactoryInterface $coreGatewayFactory) {
        return new \PayumTW\Collect\CollectGatewayFactory($config, $coreGatewayFactory);
    })

    ->addGateway('collect', [
        'factory' => 'collect',
        'link_id' => null,
        'hash_base' => null,
    ])

    ->getPayum();



use Payum\Core\Request\Capture;

$collect = $payum->getGateway('collect');

$model = new \ArrayObject([
  // ...
]);

$collect->execute(new Capture($model));