2017 © Pedro Peláez
 

library gopay-simple

GoPay Inline Simple Payment Gateway

image

markette/gopay-simple

GoPay Inline Simple Payment Gateway

  • Wednesday, February 28, 2018
  • by f3l1x
  • Repository
  • 3 Watchers
  • 1 Stars
  • 14,450 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 12 % Grown

The README.md

, (*1)

, (*2)

Website 🚀 contributte.org | Contact 👨🏻‍💻 f3l1x.io | Twitter 🐦 @contributte , (*3)

Disclaimer

:warning: This project is no longer being maintained. Please use contributte/gopay-inline.
Composer markette/gopay-simple
Version
PHP
License

Documentation

Goal

One class rule-them-all, best way is $gopay->call()., (*4)

Install

composer require markette/gopay-simple

Requirements

You need GoID, ClientID and ClientSecret., (*5)

Usage

This super simple class provides a few methods, 2 public and 4 protected, for easy extending / prototyping., (*6)

Public

  • call(string $method, string $endpoint, array $args = []) : stdClass
  • setMode(int $gopay::DEV/PROD) : void
  • $useragent : PHP+Markette/GopaySimple/{VERSION}
  • $options : [] (cURL options)

Protected

  • authenticate(array $args) : stdClass (token)
  • makeRequest(string $method, string $endpoint, array $args = []) : string
  • getEndpoint(string $type) : string
  • getEndpointUrl(string $uri) : string

Common part

use Markette\GopaySimple\GopaySimple;

$gopay = new GopaySimple($clientId, $clientSecret);

# For testing purpose
$gopay->setMode($gopay::DEV);

Authorization (Oauth)

Auth process is very simple and automatic. So, you do not have to do anything., (*7)

If you really need override authorization, you have to extend GopaySimple and call authenticate($args) directly., (*8)

Payments

POST+payments/payment
$response = $gopay->call('POST', 'payments/payment', [
    'payer' => [
        'default_payment_instrument' => 'BANK_ACCOUNT',
        'allowed_payment_instruments' => ['BANK_ACCOUNT'],
        'default_swift' => 'FIOBCZPP',
        'allowed_swifts' => ['FIOBCZPP', 'BREXCZPP'],
        'contact' => [
            'first_name' => 'Zbynek',
            'last_name' => 'Zak',
            'email' => 'zbynek.zak@gopay.cz',
            'phone_number' => '+420777456123',
            'city' => 'C.Budejovice',
            'street' => 'Plana 67',
            'postal_code' => '373 01',
            'country_code' => 'CZE',
        ],
    ],
    'target': ['type' => 'ACCOUNT', 'goid' => '_YOUR_GO_ID_',
    'amount' => 150,
    'currency' => 'CZK',
    'order_number' => '001',
    'order_description' => 'pojisteni01',
    'items' => [
        ['name' => 'item01', 'amount' => 50],
        ['name' => 'item02', 'amount' => 100],
    ],
    'additional_params' => [
        array('name' => 'invoicenumber', 'value' => '20160001')
    ],
    'return_url' => 'http://www.your-url.tld/return',
    'notify_url' => 'http://www.your-url.tld/notify',
    'lang' => 'cs',
]);
GET+payments/payment/{id}
$response = $gopay->call('GET', 'payments/payment/{id}');

Best practice

You should inject GopaySimple into your service layer. And configure $args before creating payment for target., (*9)

Example of GopayService., (*10)

Testing

  1. Start build-in server at tests/buildin/run.sh
  2. Run tester at tests/tester

Development

This package was maintain by these authors., (*11)

, (*12)


Consider to support contributte development team. Also thank you for being used this package., (*13)

The Versions

28/02 2018

dev-master

9999999-dev https://github.com/Markette/GopaySimple

GoPay Inline Simple Payment Gateway

  Sources   Download

BSD-3-Clause New BSD

The Requires

  • ext-curl *
  • php >=5.6

 

The Development Requires

api inline payment simple eshop gopay

03/04 2016

v1.0

1.0.0.0 https://github.com/Markette/GopaySimple

GoPay Inline Simple Payment Gateway

  Sources   Download

New BSD

The Requires

  • php >=5.6
  • ext-curl *

 

The Development Requires

api inline payment simple eshop gopay