Official library for PHP developers
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
.travis.yml
LICENSE
README.md
autoload.php
composer.json
composer.lock
phpunit.xml
phpunit_local.xml customer tests ready for ecommerce live tests Oct 27, 2015
phpunit_remote.xml

README.md

Everypay php library

Scrutinizer Code Quality Build Status Coverage Status Latest Stable Version License

Installation

Include autoload.php file in your application.

<?php
require_once '/path/to/everypay-php/autoload.php';

Installation with composer

You can install this library using Composer

Information about how to install composer you can find here

Command line

In root directory of your project run through a console:

$ composer require "everypay/everypay-php":"@stable"

Composer.json

Include require line in your composer.json file

{
	"require": {
    	"everypay/everypay-php": "@stable"
    }
}

and run from console in the root directory of your project:

$ composer update

After this you must require autoload file from composer.

<?php
require_once 'vendor/autoload.php';

Getting Started

<?php

use Everypay\Everypay;
use Everypay\Payment;

/**
 * Either your live secret API key or your sandbox secret API key.
 */
Everypay::setApiKey('sk_YoUraPikEy');

/** 
 * Set this true to test your sandbox account (also provide your sandbox secret API key above).
 * Ommit it or set it false to actually use your live account (also provide your live secret API key above 
 * - but be carefull, this is no longer a test!).
 */
Everypay::$isTest = true;

$params = array(
    'card_number'       => '4111111111111111',
    'expiration_month'  => '01',
    'expiration_year'   => '2020',
    'cvv'               => '123',
	'holder_name'       => 'John Doe',
    'amount'            => 1000 # amount in cents for 10 EURO.
);

Payment::create($params);

Documentation

Please see https://www.everypay.gr/api/ for up to date documentation.

Testing

First fill in your API keys in file fixtures.ini (please provide your sandbox-account API key).

Then, in root folder run one of the following available commands.

  • command-1 makes real API requests and applies to a 3D Secure account type.

  • command-2 makes real API requests and applies to an eCommerce account type.

  • command-3 just performs local tests that do not make any real calls anywhere.

#command-1: testing with real requests to API 3D-Secure account
phpunit --configuration ./phpunit_remote.xml --group 3dsecure

#command-2: testing with real requests to API eCommerce account
phpunit --configuration ./phpunit_remote.xml --group ecommerce

#command-3: testing locally with mocks (default)
phpunit --configuration ./phpunit_local.xml

You may provide a specific test file at the end of each command (eg tests/PaymentTests.php) or else all tests will be performed (default).

Note 1: if you try to run one of the "live" API commands (1 or 2) that does not respond to your exact account type (3D-Secure or eCommerce) then that tests may fail or be skipped.

Note 2: if you do not have phpunit installed in your system, you may use composer to install it (provided you have already installed composer itself).

#in everypay-php root folder
composer update

Note 3: as regards the "live" API requests (commands 1 and 2) make sure that in every test file, inside public function setUp, you safely provide the following command (already provided by default) in order for the calls to be redirected to your appropriate sandbox account rather than the real account.

<?php
Everypay::$isTest = true;

Attention: not providing this command along with filling a real API key rather than the sandbox API key, will make your remote test calls (see commands 1 and 2 above) to be directed to your real account and therefore may result in real charges!