selimsalihovic/pikpay-php

Payment Processing Library for PikPay

v1.0 2016-09-04 16:06 UTC

This package is not auto-updated.

Last update: 2024-11-09 19:45:42 UTC


README

SensioLabsInsight

Latest Stable Version Minimum PHP Version Build Status StyleCI

Install

Via Composer

$ composer require selimsalihovic/pikpay-php

Usage

To use the package first grab your credentials from your PikPay account. You will need your Authenticity Token (API_KEY) and Key (SECRET_KEY). Before any request, an instance of Gateway has to be constructed.

$gateway = new Gateway(getenv('ENDPOINT'), getenv('API_KEY'), getenv('SECRET_KEY'));

Input Data

For each Request, a data array is needed. See the PikPay Docs to see which values need to be included for which request. Note: you do not need to include the 'digest' parameter as it is calculated for you on each request based on the data array.

Here is an example of a valid data array.

$data = [
    'amount'          => 5500,
    'expiration-date' => 1707,
    'cvv'             => 286,
    'pan'             => 5464000000000008,
    'ip'              => '128.93.108.112',
    'order-info'      => 'Test Order',
    'ch-address'      => '1419 Westwood Blvd',
    'ch-city'         => 'Los Angeles',
    'ch-country'      => 'USA',
    'ch-email'        => 'john.doe@gmail.com',
    'ch-full-name'    => 'John Doe',
    'ch-phone'        => '636-48018',
    'ch-zip'          => '90024',
    'currency'        => 'USD', //EUR, BAM, HRK
    'order-number'    => 'order-d234djflq0wz',
    'language'        => 'en',
];

Sending an Authorization Request

$response = $gateway->authorize($data);
if ($response->isSuccessfull()) {
    //handle success case
} else {
    //display error
}

Sending a Capture Request

Capture requests are sent only for previously authorized transactions.

$gateway->authorize($data);
$response = $gateway->capture($data);

Sending a Purchase Request

The purchase request does both.

$response = $gateway->purchase($data);

Sending a Refund Request

$response = $gateway->refund($data);

Sending a Void Request

$response = $gateway->void($data);

Testing

To run the tests be sure to have all the dev dependencies from composer.json installed.

$ cd pikpay-php && cp example.phpunit.xml.dist phpunit.xml.dist
$ nano phpunit.xml.dist #update your credentials and save them
$ vendor/bin/phpunit