PHP SDK for wallee.com
Clone or download
Thomas Hunziker
Thomas Hunziker Release 1.1.12
Latest commit bd28d6f Nov 6, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Release 1.1.12 Nov 6, 2018
test Release 1.1.4 Apr 6, 2018
.travis.yml Release 1.1.6 Apr 11, 2018
LICENSE Initial commit. Nov 17, 2016
README.md Release 1.1.11 Oct 19, 2018
autoload.php Release 1.1.7 Apr 25, 2018
composer.json Release 1.1.5 Apr 6, 2018

README.md

Build Status

wallee SDK for PHP

This repository contains the open source PHP SDK that allows you to access wallee from your PHP app.

Requirements

Documentation

https://app-wallee.com/doc/api/web-service

Installation

You can use Composer or install manually

Composer

The preferred method is via composer. Follow the installation instructions if you do not already have composer installed.

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

composer require wallee/sdk

Manual Installation

Alternatively you can download the package in its entirety. The Releases page lists all stable versions.

Uncompress the zip file you download, and include the autoloader in your project:

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

Usage

Basic Example

<?php

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

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

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

// Create API service instance
$transactionService = new \Wallee\Sdk\Service\TransactionService($client);

// 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);


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

$createdTransaction = $transactionService->create($spaceId, $transaction);

// Create Payment Page URL:
$redirectionUrl = $transactionService->buildPaymentPageUrl($spaceId, $createdTransaction->getId());

header('Location: ' . $redirectionUrl);

License

Please see the license file for more information.