PHP code example of gdpa / pep-gateway

1. Go to this page and download the library: Download gdpa/pep-gateway 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/ */

    

gdpa / pep-gateway example snippets

 
use gdpa\PepGateway\PepGateway;
class payment
{
    protected $merchantCode; // Your merchand code
    protected $terminalCode; // Your terminal code
    protected $certificate; // Path to certificate xml
    
    public function buySomething()
    {
        $gateway = new PepGateway($this->merchantCode, $this->terminalCode, $this->certificate);
        $buyHiddenFields = $gateway->buy($invoiceNumber, $invoiceDate, $amount, $redirectAddress, $timestamp);
        ...
    }
    
    public function verifyPurchase()
    {
        $gateway = new PepGateway($this->merchantCode, $this->terminalCode, $this->certificate);
        $verify = $gateway->verify($invoiceNumber, $invoiceDate, $amount, $timestamp);
    }
    
    public function refundTransaction()
    {
        $gateway = new PepGateway($this->merchantCode, $this->terminalCode, $this->certificate);
        $refund = $gateway->refund($invoiceNumber, $invoiceDate, $amount, $timestamp);
    }
    
    public function check()
    {
        $gateway = new PepGateway($this->merchantCode, $this->terminalCode, $this->certificate);
        $check = $gateway->check($transactionReferenceID, $invoiceNumber, $invoiceDate);
    }
}