2017 © Pedro Peláez
 

library epay

library for working with ePay payment system via API

image

masterzero/epay

library for working with ePay payment system via API

  • Monday, July 23, 2018
  • by MasterZero
  • Repository
  • 1 Watchers
  • 0 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

laravel ePay API

library to work with ePay payment system via API., (*1)

Setup:

  1. Use following command in your terminal to install this library. (Currently the library is in development mode):, (*2)

    composer require masterzero/epay dev-master, (*3)

  2. Update the poviders in config/app.php, (*4)

    'providers' => [
        // ...
        MasterZero\Epay\ApiServiceProvider::class,
    ]
  3. Update the aliases in config/app.php, (*5)

    'aliases' => [
        // ...
        'EpayApi' => MasterZero\Epay\Facade\Api::class,
    ]
  4. Create config/epay.php with content:, (*6)


return [ 'merchantnumber'=> env('EPAY_MERCHANTNUMBER', '1337'), 'password'=> env('EPAY_PASSWORD', '12345678'), ];
  1. Add these params to .env (optional):

EPAY_MERCHANTNUMBER=1337 EPAY_PASSWORD=12345678

Usage:

capture transaction:

capture transaction. Customer money -> your money, (*7)

use EpayApi;
// ...

$optionalParams = [
    'group'     => 'customers',
    'invoice'   => 'for some product',
]


$result = EpayApi::capture($transactionid, $amount /*, $optionalParams*/);

if ($result['captureResult']) {
    echo "ba dum tss! the method works!";
} else {
    echo "nope. something went wrong :C";
}

credit transaction:

Credit transaction. Part of captured (your) money -> back to customer money, (*8)

use EpayApi;
// ...

$optionalParams = [
    'group'     => 'customers',
    'invoice'   => 'for some product',
]

$result = EpayApi::credit($transactionid, $amount /*, $optionalParams*/);

if ($result['creditResult']) {
    echo "ba dum tss! the method works!";
} else {
    echo "nope. something went wrong :C";
}

delete transaction:

Delete transaction. All of non-captured (not-your) money -> back to customer money, (*9)

use EpayApi;
// ...

$optionalParams = [
    'group'     => 'customers',
]

$result = EpayApi::delete($transactionid /*, $optionalParams*/);

if ($result['deleteResult']) {
    echo "ba dum tss! the method works!";
} else {
    echo "nope. something went wrong :C";
}

authorize:

Get money for payment subscription, (*10)

use EpayApi;
// ...

$params = [
    'subscriptionid' => 123,
    'orderid' => 123,
    'amount' => 5000, // 50.00 * 100 
    'currency' => 208, // DKK
    'instantcapture' => 1,
    'group' => 'customer', //optional
    'description' => 'la la la', //optional
    'email' => 'test@example.com', //optional
    'sms' => 'la la la', //optional
    'ipaddress' => '255.255.255.255', //optional
]

$result = EpayApi::authorize($params);

if ($result['authorizeResult']) {
    echo "ba dum tss! the method works!";
} else {
    echo "nope. something went wrong :C";
}

delete subscription:

Delete subscription and stop authorize., (*11)

use EpayApi;


// ...

$result = EpayApi::deletesubscription($subscriptionid);

if ($result['deletesubscriptionResult']) {
    echo "ba dum tss! the method works!";
} else {
    echo "nope. something went wrong :C";
}

get epay error:

Get epay error description by epayresponsecode, (*12)

use EpayApi;
// ...


/**
 * laguages:
 * 1 - Danish
 * 2 - English
 * 3 - Swedish
 */
$result = EpayApi::getEpayError($language, $epayresponsecode);

if ($result['getEpayErrorResult']) {
    echo "ba dum tss! the method works!";
} else {
    echo "nope. something went wrong :C";
}

get pbs error:

Get pbs error description by pbsresponsecode, (*13)

use EpayApi;
// ...


/**
 * laguages:
 * 1 - Danish
 * 2 - English
 * 3 - Swedish
 */
$result = EpayApi::getPbsError($language, $pbsresponsecode);

if ($result['getPbsErrorResult']) {
    echo "ba dum tss! the method works!";
} else {
    echo "nope. something went wrong :C";
}

multi-merchant usage


use MasterZero\Epay\Api; // ... $api = new Api([ 'merchantnumber' => '1337', 'password' => '12345678', ]); $api->authorize($params);

The Versions

23/07 2018

dev-master

9999999-dev

library for working with ePay payment system via API

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

by Avatar MasterZero

laravel epay