2017 © Pedro PelĆ”ez
 

library paysera-wallet-php-client

PHP client for Paysera.com Wallet API

image

evp/paysera-wallet-php-client

PHP client for Paysera.com Wallet API

  • Tuesday, July 10, 2018
  • by mariusbalcytis
  • Repository
  • 21 Watchers
  • 11 Stars
  • 10,349 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 15 Forks
  • 0 Open issues
  • 26 Versions
  • 10 % Grown

The README.md

PHP client for Paysera.com Wallet API

This is repository for PHP client, used with Paysera.com Wallet API., (*1)

OAuth example

<?php

// setup autoloader for Paysera Wallet API library
require_once '../../lib-wallet-php-client/src/Paysera/WalletApi/Autoloader.php';
Paysera_WalletApi_Autoloader::register();

// credentials for API
$clientId = 'CLIENT_ID';
// $secret - shared secret to use in MAC auth
$secret = 'SECRET';
// or information about certificate to use in SSL auth
//$secret = Paysera_WalletApi_Http_ClientCertificate::create()
//    ->setCertificatePath('/path/to/cert.crt')
//    ->setPrivateKeyPath('/path/to/private.key');

// create main object to use for all functionality
$api = new Paysera_WalletApi($clientId, $secret);

// for sandbox environment, use the following code instead:
// $api = new Paysera_WalletApi($clientId, $secret, Paysera_WalletApi_Util_Router::createForSandbox());

// get service, responsible for OAuth code grant type integration
$oauth = $api->oauthConsumer();

// example how to get ask and get information about paysera.com user
session_start();
try {
    if (!isset($_SESSION['token'])) {           // no token in session - let's get the token
        $token = $oauth->getOAuthAccessToken(); // this gets code query parameter if available and exchanges for token
        if ($token === null) {                  // no code parameter - redirect user to authentication endpoint
            $redirectUri = null;                // URL of this file; it's optional parameter
            header('Location: ' . $oauth->getAuthorizationUri(array(            // scopes are optional, no scope allows to get user ID/wallet ID
                Paysera_WalletApi_OAuth_Consumer::SCOPE_EMAIL,                  // to get user's main email address
                // Paysera_WalletApi_OAuth_Consumer::SCOPE_IDENTITY,            // this scope allows to get personal code, name and surname
                // Paysera_WalletApi_OAuth_Consumer::SCOPE_FULL_NAME,           // use this scope if only name and surname is needed
                // Paysera_WalletApi_OAuth_Consumer::SCOPE_IDENTITY_OFFLINE,    // this allows to get identity by user ID, after token has expired, using API, not related to token
            ), $redirectUri));
        } else {
            $_SESSION['token'] = $token;
        }
    }

    if (isset($_SESSION['token'])) {
        $tokenRelatedClient = $api->walletClientWithToken($_SESSION['token']);
        echo '<pre>';
        $user = $tokenRelatedClient->getUser();
        var_dump($user);
        // $user->getId();                                            // you can save user ID (on paysera.com), user's email etc.
        // var_dump($api->walletClient()->getUserIdentity($userId));  // if you have offline scope, you can get info by user ID later
        echo '</pre>';
        $_SESSION['token'] = $tokenRelatedClient->getCurrentAccessToken();     // this could be refreshed, re-save
    }

} catch (Exception $e) {
    echo '

', $e, '
'; }

Contacts

If you have any further questions feel free to contact us:, (*2)

ā€žPaysera LTā€œ, UAB \ Pilaitės pr. 16 \ LT-04352 Vilnius \ Email: info@paysera.lt \ Tel. +37052071558, (*3)

The Versions

10/07 2018

dev-master

9999999-dev

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

10/07 2018

1.17.0

1.17.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

10/07 2018

1.16.0

1.16.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

11/08 2017

1.15.0

1.15.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

28/07 2017

1.14.0

1.14.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

18/07 2017

1.13.0

1.13.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

27/02 2017

1.12.0

1.12.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

11/01 2017

1.11.0

1.11.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

24/10 2016

1.10.1

1.10.1.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

11/10 2016

1.10.0

1.10.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

11/07 2016

1.9.0

1.9.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

25/05 2016

1.8.0

1.8.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

05/04 2016

1.7.0

1.7.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

24/02 2016

1.6.1

1.6.1.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

03/11 2015

1.6.0

1.6.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

25/09 2015

1.5.0

1.5.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

25/09 2015

1.4.2

1.4.2.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

29/07 2015

1.4.1

1.4.1.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

27/07 2015

1.4.0

1.4.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

16/07 2015

1.3.0

1.3.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

14/07 2015

1.2.3

1.2.3.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

13/07 2015

1.2.2

1.2.2.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

09/07 2015

1.2.1

1.2.1.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

17/06 2015

1.2.0

1.2.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

12/06 2015

1.1.0

1.1.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

The Development Requires

by Marius Balčytis

07/05 2015

1.0.0

1.0.0.0

PHP client for Paysera.com Wallet API

  Sources   Download

by Marius Balčytis