Coder Social home page Coder Social logo

everypay-php's Introduction

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!

everypay-php's People

Contributors

akdeveloper avatar ioannis-papikas avatar kostaskrv avatar mkitsos avatar mplexus avatar x3nos avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.