2017 © Pedro Peláez
 

library sdk

wallee SDK for PHP

image

wallee/sdk

wallee SDK for PHP

  • Friday, July 20, 2018
  • by schurter-cw
  • Repository
  • 2 Watchers
  • 1 Stars
  • 948 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 15 Versions
  • 57 % Grown

The README.md

Build Status, (*1)

wallee PHP Library

The wallee PHP library wraps around the wallee API. This library facilitates your interaction with various services such as transactions, accounts, and subscriptions., (*2)

Documentation

wallee Web Service API, (*3)

Requirements

  • PHP 5.6.0 and above

Installation

You can use Composer or install manually, (*4)

Composer

The preferred method is via composer. Follow the installation instructions if you do not already have composer installed., (*5)

Once composer is installed, execute the following command in your project root to install this library:, (*6)

composer require wallee/sdk

Manual Installation

Alternatively you can download the package in its entirety. The Releases page lists all stable versions., (*7)

Uncompress the zip file you download, and include the autoloader in your project:, (*8)

require_once '/path/to/php-sdk/autoload.php';

Usage

The library needs to be configured with your account's space id, user id, and secret key which are available in your wallee account dashboard. Set space_id, user_id, and api_secret to their values., (*9)

Configuring a Service

require_once(__DIR__ . '/autoload.php');

// Configuration
$spaceId = 405;
$userId = 512;
$secret = 'FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=';

// Setup API client
$client = new \Wallee\Sdk\ApiClient($userId, $secret);

// Get API service instance
$client->getTransactionService();
$client->getTransactionPaymentPageService();

To get started with sending transactions, please review the example below:, (*10)

require_once(__DIR__ . '/autoload.php');

// Configuration
$spaceId = 405;
$userId = 512;
$secret = 'FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=';

// Setup API client
$client = new \Wallee\Sdk\ApiClient($userId, $secret);

// Create transaction
$lineItem = new \Wallee\Sdk\Model\LineItemCreate();
$lineItem->setName('Red T-Shirt');
$lineItem->setUniqueId('5412');
$lineItem->setSku('red-t-shirt-123');
$lineItem->setQuantity(1);
$lineItem->setAmountIncludingTax(29.95);
$lineItem->setType(\Wallee\Sdk\Model\LineItemType::PRODUCT);


$transactionPayload = new \Wallee\Sdk\Model\TransactionCreate();
$transactionPayload->setCurrency('EUR');
$transactionPayload->setLineItems(array($lineItem));
$transactionPayload->setAutoConfirmationEnabled(true);

$transaction = $client->getTransactionService()->create($spaceId, $transactionPayload);

// Create Payment Page URL:
$redirectionUrl = $client->getTransactionPaymentPageService()->paymentPageUrl($spaceId, $transaction->getId());

header('Location: ' . $redirectionUrl);

HTTP Client

You can either use php curl or php socket extentions. It is recommend you install the necessary extentions and enable them on your system., (*11)

You have to ways two specify which HTTP client you prefer., (*12)

$userId = 512;
$secret = 'FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=';

// Setup API client
$client = new \Wallee\Sdk\ApiClient($userId, $secret);

$httpClientType = \Wallee\Sdk\Http\HttpClientFactory::TYPE_CURL; // or \Wallee\Sdk\Http\HttpClientFactory::TYPE_SOCKET

$client->setHttpClientType($httpClientType);

//Setup a custom connection timeout if needed. (Default value is: 25 seconds)
$client->setConnectionTimeout(20);

You can also specify the HTTP client via the WLE_HTTP_CLIENT environment variable. The possible string values are curl or socket., (*13)

<?php
putenv('WLE_HTTP_CLIENT=curl');
?>

Integrating Webhook Payload Signing Mechanism into webhook callback handler

The HTTP request which is sent for a state change of an entity now includes an additional field state, which provides information about the update of the monitored entity's state. This enhancement is a result of the implementation of our webhook encryption mechanism., (*14)

Payload field state provides direct information about the state update of the entity, making additional API calls to retrieve the entity state redundant., (*15)

⚠️ Warning: Generic Pseudocode

The provided pseudocode is intentionally generic and serves to illustrate the process of enhancing your API to leverage webhook payload signing. It is not a complete implementation., (*16)

Please ensure that you adapt and extend this code to meet the specific needs of your application, including appropriate security measures and error handling. For a detailed webhook payload signing mechanism understanding we highly recommend referring to our comprehensive Webhook Payload Signing Documentation., (*17)

public function handleWebhook() {
    $requestPayload = file_get_contents('php://input');
    $signature = $_SERVER['HTTP_X_SIGNATURE'] ?? '';

    if (empty($signature)) {
        // Make additional API call to retrieve the entity state
        // ...
    } else {
        if ($client->getWebhookEncryptionService()->isContentValid($signature, $requestPayload)) {
            // Parse requestPayload to extract 'state' value
            // $state = ...
            // Process entity's state change
            // $this->processEntityStateChange($state);
            // ...
        }
    }

    // Process the received webhook data
    // ...

}

License

Please see the license file for more information., (*18)

The Versions

20/07 2018

dev-master

9999999-dev https://www.wallee.com

wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

20/07 2018

1.1.9

1.1.9.0 https://www.wallee.com

wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

19/07 2018

1.1.8

1.1.8.0 https://www.wallee.com

wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

25/04 2018

1.1.7

1.1.7.0 https://www.wallee.com

wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

11/04 2018

1.1.6

1.1.6.0 https://www.wallee.com

wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

06/04 2018

1.1.5

1.1.5.0 https://www.wallee.com

wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

06/04 2018

1.1.4

1.1.4.0

wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

19/12 2017

1.1.2

1.1.2.0 http://wallee.com

Wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

01/11 2017

1.1.1

1.1.1.0 http://wallee.com

Wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

07/07 2017

1.1.0

1.1.0.0 http://wallee.com

Wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

07/06 2017

1.0.4

1.0.4.0 http://wallee.com

Wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

02/03 2017

1.0.3

1.0.3.0 http://wallee.com

Wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

13/01 2017

1.0.2

1.0.2.0 http://wallee.com

Wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

10/01 2017

1.0.1

1.0.1.0 http://wallee.com

Wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee

17/11 2016

1.0

1.0.0.0 http://wallee.com

Wallee SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api php payment sdk wallee