PHP code example of vnpay / soap-client

1. Go to this page and download the library: Download vnpay/soap-client 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/ */

    

vnpay / soap-client example snippets


$builder = new \Vnpay\SoapClient\ClientBuilder(
  '/path/to/your/vnpay/wsdl/sandbox.enterprise.wsdl.xml'
);

$client = $builder->build();

$log = new \Monolog\Logger('vnpay');  
$log->pushHandler(new \Monolog\Handler\StreamHandler('/path/to/your.log'));

$builder = new \Vnpay\SoapClient\ClientBuilder(
  '/path/to/your/vnpay/wsdl/sandbox.enterprise.wsdl.xml'
);
$client = $builder->withLog($log)
  ->build();
bash
$ php composer.phar