PHP code example of payum-tw / mypay

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




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

$defaultConfig = [];

$payum = (new PayumBuilder)
    ->addGatewayFactory('mypay', function(array $config, GatewayFactoryInterface $coreGatewayFactory) {
        return new \PayumTW\Allpay\AllpayGatewayFactory($config, $coreGatewayFactory);
    })

    ->addGateway('mypay', [
        'factory' => 'mypay',
        'MerCode' => null,
        'MerKey'  => null,
        'MerName' => null,
        'Account' => null,
        'sandbox' => true,
    ])

    ->getPayum()
;



use Payum\Core\Request\Capture;

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

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

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