PHPackages                             twitchalerts/xsolla-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. twitchalerts/xsolla-sdk-php

ActiveLibrary[API Development](/categories/api)

twitchalerts/xsolla-sdk-php
===========================

Xsolla SDK for PHP. Xsolla is the authorized reseller and merchant providing e-commerce services for online games.

9.0.0(1y ago)05MITPHPPHP ^7.1|^8.0

Since Oct 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/twitchalerts/xsolla-sdk-php)[ Packagist](https://packagist.org/packages/twitchalerts/xsolla-sdk-php)[ Docs](https://xsolla.com)[ RSS](/packages/twitchalerts-xsolla-sdk-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (6)Versions (7)Used By (0)

Xsolla SDK for PHP
==================

[](#xsolla-sdk-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/2501eb1510d66f004ba84f269dd7db4861afb9353713927f517d49297e7da664/68747470733a2f2f706f7365722e707567782e6f72672f78736f6c6c612f78736f6c6c612d73646b2d7068702f762f737461626c652e706e67)](https://packagist.org/packages/xsolla/xsolla-sdk-php)[![Build Status](https://camo.githubusercontent.com/eeb0e727b4f57a7cabf5b6de973c3afe238968a27058e0a2bbabe35dd3cbec0a/68747470733a2f2f7472617669732d63692e6f72672f78736f6c6c612f78736f6c6c612d73646b2d7068702e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/xsolla/xsolla-sdk-php)[![Code Coverage](https://camo.githubusercontent.com/96b30f5267d4ee129b25bb10ca2f966872227d406ad282148272c52bb3e92241/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f78736f6c6c612f78736f6c6c612d73646b2d7068702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/xsolla/xsolla-sdk-php/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/88bcfd359c0ce2ea7d34815b0a301dffa00a7e15cc6054c1be7dec326db3381b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f78736f6c6c612f78736f6c6c612d73646b2d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/xsolla/xsolla-sdk-php/?branch=master)[![Downloads](https://camo.githubusercontent.com/679d92f81fb3979ad44341618ef3d97de0ba1fef757c385af262a0cc6dbc69bb/68747470733a2f2f706f7365722e707567782e6f72672f78736f6c6c612f78736f6c6c612d73646b2d7068702f642f746f74616c2e706e67)](https://packagist.org/packages/xsolla/xsolla-sdk-php)[![Join the chat at https://gitter.im/xsolla/xsolla-sdk-php](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/xsolla/xsolla-sdk-php?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![GitHub license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://raw.githubusercontent.com/xsolla/xsolla-sdk-php/master/LICENSE)

An official PHP SDK for interacting with [Xsolla API](https://developers.xsolla.com/api/)

[![Payment UI screenshot](https://camo.githubusercontent.com/66ff996aaaa31f6628473ebb6e815c460ccb85531f3445bacb9b6c7a62e936b5/687474703a2f2f78736f6c6c612e6361636865666c792e6e65742f696d672f7073335f676974687562322e706e67)](https://camo.githubusercontent.com/66ff996aaaa31f6628473ebb6e815c460ccb85531f3445bacb9b6c7a62e936b5/687474703a2f2f78736f6c6c612e6361636865666c792e6e65742f696d672f7073335f676974687562322e706e67)

Features
--------

[](#features)

- Full customisation of Payment UI with the help of different methods of getting token.
- Client for all API methods, making your integration easy and convenient. You can use it for setting up and updating virtual currency, items and subscription plans, for managing the users balance, for checking the finance information with the help of Report API and so on.
- Convenient webhook server:
    - To start you need only one callback function.
    - All security checking already implemented: signature authentication and IP whitelisting.
    - Full customisation of notification processing logic, if standard server class doesn’t suit you.
- SDK is built on Guzzle v3, and utilizes many of its features, including persistent connections, parallel requests, events and plugins (via Symfony2 EventDispatcher), service descriptions, over-the-wire logging, caching, flexible batching, and request retrying with truncated exponential back off.

Requirements
------------

[](#requirements)

- PHP ^7.3 or ^8.0
- The following PHP extensions are required:
    - curl
    - json

Getting Started
---------------

[](#getting-started)

Please register your [Publisher Account](https://publisher.xsolla.com/signup) and create the project. In order to use the PHP SDK Library you'll need:

- MERCHANT\_ID
- API\_KEY
- PROJECT\_ID
- PROJECT\_KEY

You can obtain these parameters using the information in your [Company Profile](https://publisher.xsolla.com/company) and [Project Settings](https://publisher.xsolla.com/projects).

Installation
------------

[](#installation)

### Installing via Composer

[](#installing-via-composer)

The recommended way to install Xsolla SDK for PHP is through [Composer](http://getcomposer.org).

```
$ cd /path/to/your/project
$ composer require xsolla/xsolla-sdk-php
```

After installing, you need to require Composer's autoloader:

```
require '/path/to/vendor/autoload.php';
```

### Installing via Phar

[](#installing-via-phar)

You can [download the packaged phar](https://github.com/xsolla/xsolla-sdk-php/releases) and include it in your scripts to get started:

```
require '/path/to/xsolla.phar';
```

### Installing via Zip

[](#installing-via-zip)

You can [download the zip file](https://github.com/xsolla/xsolla-sdk-php/releases), unzip it into your project to a location of your choosing, and include the autoloader:

```
require '/path/to/xsolla-autoloader.php';
```

Quick Examples
--------------

[](#quick-examples)

### Integrate Payment UI

[](#integrate-payment-ui)

To integrate Payment UI into your game you should obtain an access token. An access token is a string that identifies game, user and purchase parameters.

There are number of ways for getting token. The easiest one is to use the *createCommonPaymentUIToken* method, you will need to pass only ID of project in Xsolla system and ID of the user in your game:

```

```

### Receive webhooks

[](#receive-webhooks)

There is a build in server class to help you to handle the webhooks.

```
