2017 © Pedro PelĆ”ez
 

library paymentninjaclient

Powerful client for Payment.Ninja REAST API

image

alxmsl/paymentninjaclient

Powerful client for Payment.Ninja REAST API

  • Monday, February 29, 2016
  • by alxmsl
  • Repository
  • 1 Watchers
  • 1 Stars
  • 36 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

PaymentNinjaClient

License Latest Stable Version Total Downloads, (*1)

Build Status Scrutinizer Code Quality Code Coverage Dependency Status, (*2)

Powerful client for Payment.Ninja REST API, (*3)

Usage flow

  1. User inputs and submits data
  2. Merchant calls method card/getToken via JSONP or AJAX and receives a temporary token for 10 minutes
  3. Merchant submits credit card token to a server with other payment data
  4. Merchant calls method card/process with credit card token
  5. If success is true and ACS object is returned
    1. Merchant POSTs ACS parameters PaReq, MD, TermUrl to aACS url in a browser
    2. User inputs and submits his 3DSecure password
    3. ACS POSTs parameters PaRes, MD back to merchant's ACS return url
    4. Merchant calls method card/authenticate passing PaRes and MD parameters
    5. If success is true then merchant can provide a service to a user
  6. If success is true and ACS object is not returned, then merchant can show a success page to user
  7. If remember was passed, merchant will receive a permanentToken parameter with card/process or card/authenticate method responses. You can use permanentToken without requiring a user to input the credit card data again
  8. If recurring was passed, merchant will receive a recurring object, containing recurring frequency and ending date. Merchant can create new payments for a user calling the card/processRecurring method
  9. If verify_card was passed, then transaction price will be set to €1, that will be put on hold and then instantly returned
  10. verify_card can be effectively used with recurring, recurring_interval, recurring_trial or remember parameters as it checks the validity of a card via money hold/return
  11. Merchant receives asynchronous callback with transaction details and can provide aļæ¼service to a user if status is completed

Installation

For simplified usage all what you need is require packet via composer, (*4)

    $ composer require alxmsl/paymentninjaclient

In third-party projects, require packet in your composer.json, (*5)

    "alxmsl/paymentninjaclient": "*"

...and update composer: composer update, (*6)

Usages

Firstly, create client instance with public and private key, that was provided in your account, (*7)

    use alxmsl\PaymentNinja\Client;
    $Client = new Client('<public key>', '<private key>');

Now you can create request for REST API methods, (*8)

  • user/resolve via Client::userResolve()
  • user/changeRecurring via Client::userChangeRecurring()
  • user/cancelRecurring via Client::userCancelRecurring()
  • card/getToken via Client::cardGetToken()
  • card/process via Client::cardProcess()
  • card/authenticate via Client::cardAuthenticate()
  • card/processRecurring via Client::cardProcessRecurring()

For request execution you should call Request::execute() method. For example below code, (*9)

    use alxmsl\PaymentNinja\Client;
    $Client = new Client('pU811cKE4', 'Pr1v4tEKEy');
    $R = $Client->userResolve('aaa@aaa.ru', 'aaa@aaa.ru', '127.0.0.1')->execute();
    var_dump($R);

...going to follow output, (*10)

    class alxmsl\PaymentNinja\Response\UserResponse#8 (1) {
      private $id =>
      string(5) "46919"
    }

Console usage

Surely, you can use simple CLI utilities for calling REST API methods, (*11)

  • user/resolve via ./bin/user/resolve
  • user/changeRecurring via ./bin/user/changeRecurring
  • user/cancelRecurring via ./bin/user/cancelRecurring
  • card/getToken via ./bin/card/getToken
  • card/process via ./bin/card/process
  • card/authenticate via ./bin/card/authenticate
  • card/processRecurring via ./bin/card/processRecurring

So, user resolving example must be present as, (*12)

    $ php ./bin/user/resolve.php -b='pU811cKE4' -r='Pr1v4tEKEy' -e='aaa@aaa.ru' -u='aaa@aaa.ru' -i='127.0.0.1'
    user's data
        id: 46919

Each utility supports their quick help page, (*13)

$ php bin/card/getToken.php --help
Using: /usr/local/bin/php bin/card/getToken.php [-h|--help] [-c|--callback] -m|--month -n|--number -b|--public -s|--security -y|--year
-h, --help  - show help
-c, --callback  - callback JSONP function name
-m, --month  - expiration month
-n, --number  - card number
-b, --public  - project public key
-s, --security  - card security code
-y, --year  - expiration year

Tests

For completely tests running just call phpunit command, (*14)

    PHPUnit 4.7.7 by Sebastian Bergmann and contributors.

    Runtime:    PHP 5.5.23 with Xdebug 2.3.2
    Configuration:  /Users/alxmsl/sources/PaymentNinjaClient.github/phpunit.xml.dist

    .................

    Time: 233 ms, Memory: 6.50Mb

    OK (17 tests, 90 assertions)

License

Copyright 2015 Alexey Maslov alexey.y.maslov@gmail.com, (*15)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at, (*16)

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License., (*17)

The Versions

29/02 2016

dev-master

9999999-dev

Powerful client for Payment.Ninja REAST API

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Avatar alxmsl

api rest payment ninja payment.ninja

29/02 2016

v1.0.6

1.0.6.0

Powerful client for Payment.Ninja REAST API

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Avatar alxmsl

api rest payment ninja payment.ninja

11/02 2016

v1.0.5

1.0.5.0

Powerful client for Payment.Ninja REAST API

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Avatar alxmsl

api rest payment ninja payment.ninja

13/09 2015

v1.0.3

1.0.3.0

Powerful client for Payment.Ninja REAST API

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Avatar alxmsl

api rest payment ninja payment.ninja

11/09 2015

v1.0.2

1.0.2.0

Powerful client for Payment.Ninja REAST API

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Avatar alxmsl

api rest payment ninja payment.ninja

10/09 2015

v1.0.1

1.0.1.0

Powerful client for Payment.Ninja REAST API

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Avatar alxmsl

api rest payment ninja payment.ninja

10/09 2015

v1.0.0

1.0.0.0

Powerful client for Payment.Ninja REAST API

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Avatar alxmsl

api rest payment ninja payment.ninja