gdpa / pep-gateway
PEP IPG code for using in PHP projects.
Installs: 6 119
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.5
- ext-bcmath: *
- ext-curl: *
- ext-json: *
- ext-simplexml: *
- ext-soap: *
Requires (Dev)
- phpunit/phpunit: 6.3.*
This package is auto-updated.
Last update: 2024-10-29 04:47:44 UTC
README
PepGateway provides Pardakht Electronic Pasargad (PEP) internet payment gateway (IPG) code for using in PHP projects.
This package is base on PEP company sample code (pep-phpsample(v3.3.3).rar) that is provided in their website.
For more information you can see their documentation at pep.co.ir.
Usage
$ composer require "gdpa/pep-gateway":"dev-master"
Create pep-certificate.xml in your root directory and provide your private key provided by PEP company in it.
In your classes you can use package this way:
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); } }
$buyHiddenFields
is contain all necessary fields for using in sending user to gateway:- formAction (Using in form action)
- action
- merchantCode
- terminalCode
- invoiceNumber
- invoiceDate
- amount
- redirectAddress (Your redirect address that you implement settlement codes)
- timestamp
$verify
values:- result (true or false)
- resultMessage
$refund
values:- result (true or false)
- resultMessage
$check
values:- result (true or false)
- resultMessage
MPG 'isValid' function also added. (See Their MPG documents.).