Cash Kiosks API v2.0
Game Catalog API
The API is designed to provide a game catalog, i.e. the list of all projects available in the Xsolla system. The API provides basic information on each project such as project name, project icon, payment parameters, etc. The above-mentioned information can be used to create payment pages for the projects.
The game catalog API can be useful for payments via cash kiosks and placing so-called “game buttons” in their UIs. Replacing the usual Xsolla button replaced with a “game button” on a cash kiosk’s screen allows users to make payments in their favorite projects in an easy and habitual way.
API URL: https://api.xsolla.com/projects/list/index.php
Request Format
Request Parameters for Obtaining Game List
| Field name | Type | Description | Example |
|---|---|---|---|
| ID | integer | Payment system counterparty ID. Required. | 184 |
| sign | integer | Signature for unauthorized access prevention. Required. | 0a8d9fb24fcbac2efafec5e51045d05c |
Generating the Signature
A signature ensures security when checking and making payments. It is created by MD5-hashing a string taht is a concatenation of the above parameters, separated by “|”, in the order shown below.
- php
1md5(<ID>|<secret_key>)
secret_key: Counterparty’s secret key.
Example: The signature for counterparty #184 with the secret key “SecretKey” is formed as follows:
$sign=md5(“184|SecretKey”)=0a8d9fb24fcbac2efafec5e51045d05c
Request Example:
https://api.xsolla.com/projects/list/index.php?id=184&sign=0a8d9fb24fcbac2efafec5e51045d05c
Response Format
The response is in XML format and contains both the game list and basic information about each game. The XML has the following structure:
- php
1<projectlist>
2 <project>
3 <id>12345</id>
4 <name>Game</name>
5 <virtual_currency>Game of currency</virtual_currency>
6 <logo>http://static.xsolla.com/img/game/12345.gif</logo>
7 <limits>
8 <min>Minimum of amount game of currency</min>
9 <max>max of amount game of currency</max>
10 </limits>
11 <prompt>enter nickname of personage</prompt>
12 <v1>nickname of personage</v1>
13 </project>
14 ...
15</projectlist>
Field Description
| Field name | Type | Description |
|---|---|---|
| projectlist | array | List of projects (project). Project fields are described below. |
| project | string | Contains the following fields: id, name, virtual_currency, logo, limits, prompt, “v1”, “v2”, “v3”, each described below. |
| id | integer | Game ID. |
| name | string | Name. |
| virtual_currency | string | Virtual currency name. |
| logo | string | Game logo URL. |
| limits | array | Contains min and max fields. If limits is not set for the project, the section is not shown. |
| min | string | Minimum virtual currency quantity. |
| max | string | Maximum virtual currency quantity. |
| prompt | string | Message prompting to enter the parameters. |
| local | string | Interface language (locale). |
| v1 | string | Message prompting to enter basic user identification parameters for the project. |
| v2 | string | Message prompting to enter one of the additional user identification parameters for the project. |
| v3 | string | Message prompting to enter one of the additional user identification parameters for the project. |
Response format in case of an error
In case of an error, the API will respond with an XML message.
1<error>
2 <description>Incorrect signature</description>
3</error>
| Field name | Type | Description |
|---|---|---|
| error | string | Contains description, described below. |
| description | string | Error description. |
Error Description
| Error | Type | Description |
|---|---|---|
| Incorrect signature | string | Invalid signature submitted (sign). |
| Temporary technical error | string | Invalid counterparty ID (id), server breakdown, or another error. |
Interaction with Agent
Overview
There are two possible interaction options:
- Xsolla button. This button is placed at the agent side. After clicking the button, the user is prompted to enter a number they have received before and make the payment to this number. To enable payments via the Xsolla button, fill in the
accountfield (project, “v1”, “v2”, “v3” fields must remain empty). Theaccountfield must contain the 9-digit Xsolla number. To set up a Xsolla button, contact the manager to obtain a logo and the number. - Game buttons. These buttons are placed at the agent side, each corresponding to a different game. The user clicks on the button of a particular game and then logs in to make a payment to their own account. To enable payments via game-specific buttons, fill the
project, “v1”, “v2” and “v3” fields (leaveaccountfield empty). You will be able to sendproject, “v1”, “v2” and “v3” fields after the particular project (game) button is configured at the terminal. Theprojectand “v1” fields are mandatory, while “v2” and “v3” are optional and depend on each specific project. To set up game buttons, contact the manager to obtain game logos, game’s internal ids and authorization methods (rules for filling out the “v1”, “v2”, “v3” fields) and other information for each game.
A button is an element of the agent’s system that initiates a payment through the Xsolla system.
Before connecting the agent to the Xsolla system, make sure to clarify the following:
- Partner number (type) in the Xsolla system. You can get it by contacting your Customer Success Manager at Xsolla.
- secret_key, a confidential string parameter that is required to generate the digital signature (MD5 string). You can find it in Publisher Account through your Customer Success Manager.
You can interact with the API by sending HTTP requests to the API gateway at:
- http
1https://ps.xsolla.com/api/gate
The API accepts GET or POST requests. All parameters must be UTF-8-encoded, as using non-matching encodings will result in signature issues.
Request Format
The Xsolla gateway accepts three types of requests:
- Check whether payment is possible (
command=check) - Make a payment (
command=pay) - Calculate the cost and amount of game currency (
command=calculate)
order field of the response will contain the number of the previously performed payment.Check Command: Identify User by Xsolla Number
| Field name | Type | Description | Example |
|---|---|---|---|
| command | string | Check whether a payment is possible. Required. | check |
| account | integer | Xsolla number (9 digits). Required. | check |
| sum | float | Amount of payment in the agreed currency. Decimal separator: “.”; 2 decimal places. Optional. | 100.98 |
| type | integer | Your partner number in Xsolla. Required. | 151 |
| date | string | Date in the YYYYMMDDHHMMSS format. Required. | 20060425180622 |
| md5 | string | Signature used to prevent unauthorized access. Required. | 0a8d9fb24fcbac2efafec5e51045d05c |
Check command: Identify User by Project/v1/v2/v3
| Field name | Type | Description | Example |
|---|---|---|---|
| command | string | Check whether a payment is possible. Required. | check |
| project | integer | Project identifier in the Xsolla system; found in Publisher Account. Required. | 4783 |
| v1 | string | User identification parameter (usually the in-game nickname). Required. | XsollaUser |
| v2 | string | Additional user identification parameter (depends on project settings). Optional. | 0 |
| v3 | string | Additional user identification parameter (depends on project settings). Optional. | 0 |
| sum | float | Amount of payment in the agreed currency. Decimal separator: “.”; 2 decimal places. Optional. | 100.98 |
| type | integer | Your partner number in Xsolla. Required. | 151 |
| date | string | Date in the YYYYMMDDHHMMSS format. Required. | 20060425180622 |
| md5 | string | Signature used to prevent unauthorized access. Required. | 0a8d9fb24fcbac2efafec5e51045d05c |
Pay Command: Identify Subscriber by Account
| Field name | Type | Description | Example |
|---|---|---|---|
| command | string | Check whether a payment is possible. Required. | pay |
| account | integer | Xsolla number (9 digits). Required. | 1234567, 001234567 |
| sum | float | Amount of payment in the agreed currency. Decimal separator: “.”; 2 decimal places. Required. | 100.98 |
| id | string | Unique transaction number in the partner system. Required. | xsollaid1 |
| type | integer | Your partner number in Xsolla. Required. | 151 |
| date | string | Date in the YYYYMMDDHHMMSS format. Required. | 20060425180622 |
| test | boolean | Test flag: 1 if this is a test payment, 0 (default value) otherwise. Optional. | 1 |
| md5 | string | Signature used to prevent unauthorized access. Required. | 0a8d9fb24fcbac2efafec5e51045d05c |
Pay Command: Identify Subscriber by Project/v1/v2/v3
| Field name | Type | Description | Example |
|---|---|---|---|
| command | string | Check whether a payment is possible. Required. | check |
| project | integer | Project (game) number. Required. | 4783 |
| v1 | string | User identification parameter (usually the in-game nickname). Required. | XsollaUser |
| v2 | string | Additional user identification parameter (depends on project settings). Optional. | 0 |
| v3 | string | Additional user identification parameter (depends on project settings). Optional. | 0 |
| sum | float | Amount of payment in the agreed currency. Decimal separator: “.”; 2 decimal places. Optional. | 100.98 |
| id | string | Unique transaction number in the partner system. Required. | xsollaid2 |
| type | integer | Your partner number in Xsolla. Required. | 151 |
| date | string | Date in the YYYYMMDDHHMMSS format. Required. | 20060425180622 |
| test | boolean | Test flag: 1 if this is a test payment, 0 (default value) otherwise. Optional. | 1 |
| md5 | string | Signature used to prevent unauthorized access. Required. | 0a8d9fb24fcbac2efafec5e51045d05c |
order field of the response will contain the number of the previously performed payment.Calculate Command
| Field name | Type | Description | Example |
|---|---|---|---|
| command | string | Check whether a payment is possible. Required. | calculate |
| project | integer | Project (game) number. Required. | 4783 |
| sum | float | Amount of payment in the agreed currency. Decimal separator: “.”; 2 decimal places. Required unless out is specified. | 100.98 |
| out | float | Amount of game currency. Decimal separator: “.”; 2 decimal places. Required unless sum is specified. | 10.98 |
| type | integer | Your partner number in Xsolla. Required. | 151 |
| date | string | Date in the YYYYMMDDHHMMSS format. Required. | 20060425180622 |
| md5 | string | Signature used to prevent unauthorized access. Required. | 0a8d9fb24fcbac2efafec5e51045d05c |
Generating MD5 field
The signature ensures secure payments and payment checks. It is generated by taking an MD5 hash of a string derived by concatenating the values of all the parameters transmitted, in the same order in which they follow in request, including optional parameters, if any, and the private key of the payment system, which you can get from your your Xsolla Customer Success Manager.
Check Command
- php
1<?php
2 $request['command']='check';
3 $request['account']=1234567;
4 $request['sum']=150.75;
5 $request['type']=151;
6 $request['date']='20110117000516';
7 $md5='';
8 foreach ($request as $value) {
9 $md5.=$value;
10 }
11 $request['md5']=md5($md5.$secret_key);
12?>
Line:
check1234567150.7515120110117000516test
MD5:
1cad5a2c3457cffa8e857a507a7050ba
Pay Command
- php
1<?php
2$request['command']='pay';
3$request['account']=1234567;
4$request['sum']=150.75;
5$request['id']=384957;
6$request['type']=151;
7$request['date']='20110117000516';
8$md5='';
9foreach ($request as $value) {
10$md5.=$value;
11}
12$request['md5']=md5($md5.$secret_key);
13?>
Line:
pay1234567150.7538495715120110117000516test
MD5:
7cfa05abde4ae2464142bf2ac7a72f32
Calculate Command
- php
1<?php
2 $request['command']='calculate';
3 $request['project']=4783;
4 $request['out']=12;
5 $request['type']=151;
6 $request['date']='20110117000516';
7 $md5='';
8 foreach ($request as $value) {
9 $md5.=$value;
10 }
11 $request['md5']=md5($md5.$secret_key);
12?>
Line:
calculate47831215120110117000516test
MD5:
e73e11a9cad00e205358e05254905af5
Responses Codes
The system generates an XML containing the status code in result and the description in comment.
| Result | Comment | Description |
|---|---|---|
| 0 | OK | Payment allowed (in case of the check command) or successfully/previously completed (in case of the pay command). |
| 1 | technical problem | Service under maintenance (resend the notification later). |
| 11 | type is not exists or disabled | Type does not exist or is disabled. |
| 2 | xsolla-number not correct | Incorrect Xsolla number length. |
| 3 | xsolla-number not found | Xsolla number not found. |
| 4 | Stop | Xsolla number not intended for payment. |
| 5 | sum error | Invalid amount. |
| 6 | bonus error | Output error. |
| 7 | md5 error | MD5 hash mismatch. |
| 8 | IP error | Prohibited IP address. |
| 9 | request is not correct | Required parameters missing or invalid command specified. |
| 10 | project is not exists | Project does not exist (disabled or permanently deleted). |
Payment System Transaction Registry API
The document is intended for developers who want to use the payment system transaction registry API to let their users pay for virtual items and services of their project. The document requires basic knowledge of APIs, HTTP requests, and software architectures.
Interacting with the API
- The work is only possible via server-server integration;
- All parameters should be UTF-8-encoded;
- Data is returned in CSV format.
Description of API Methods
- Get – receive payment data.
API URL
Basic URL: https://api.xsolla.com/payments/
URL Mask
- http
1https://api.xsolla.com/payments/v<number versions>/<command>?<parameter1=value1>&<parameter2=value2
Get
Creates a request to get data on payments from all payment systems of the given counterparty for the last 24 hours.
Getting API Access
To get API access, contact your Customer Success Manager or email to csm@xsolla.com to get a unique partner ID and secret key.
Request Example
https://api.xsolla.com/payments/v1/Get?date=2013-08-20&id=1234&sign=8f683701c03b03fe49e6ef7bbfafb8fb
Input Parameters
| Field name | Type | Description | Example |
|---|---|---|---|
| date | string | The reply contains payment data for the last 24 hours. The date is formatted as YYYY-MM-DD (in GMT+4 time zone). | 2013-08-20 |
| id | integer | Unique partner ID. To get an ID, please contact your Customer Success Manager or email to csm@xsolla.com. | 1234 |
| sign | string | Signature for preventing unauthorized access. | 8f683701c03b03fe49e6ef7bbfafb8fb |
Response
The reply is provided in the CSV format, with “,” used as the separator:
69927355,95188933,394,2013-08-01T06:49:25+04:00,91.0000,RUB,done
Field Description:
| Field name | Type | Description | Example |
|---|---|---|---|
| xsolla_id | integer | Transaction number within the Xsolla system. Required. | 12345678 |
| ps_id | integer | Transaction number as sent by the payment system. Required. | 1234 |
| pid | integer | Payment system ID. Required. | 64 |
| datetime | string | Time of payment (GMT+4 time zone). Required. | 2013-08-01T06:49:25+04:00 |
| amount | float | Amount paid by the user. Required. | 10.98 |
| currency | string | Payment currency. Required. | USD |
| status | string | Payment status (the report includes payments with statuses done — payment completed successfully — and canceled — payment canceled). Required. | done |
Generating the Signature
The parameters are sorted alphabetically by keys. The signature is an MD5 hash of a string that is a concatenation of parameter values and the secret key (you can learn one from the manager). The separator is “|”.
Request Example
1date = 2013-08-20;
2id=1234;
3secret_key=password.
The string will look as follows:
2013-08-20|1234|password
MD5 of the above string:
e8df0ff2e4360300a5142cc28d86b422
List of completion codes
| HTTP status of the response | Error message | Error description |
|---|---|---|
| 200 | Success | |
| 400 | Wrong parameters | Invalid parameters sent |
| 400 | Wrong ID partner | Invalid counterparty |
| 400 | Wrong date | Invalid date |
| 403 | Incorrect sign | Invalid signature |
| 404 | Unknown command | Unknown command |
| 500 | Internal API error |
Transaction Reconciliation with Payment Systems
Reconciliation via Email Notification
Transaction reconciliation consists in the payment system’s sending an email with an attachment of a particular format. The frequency of reconciliation must be negotiated in advance.
Reconciliation document format
The reconciliation document has the following format:
- UTF-8 encoding
- CSV format (comma or semicolon as the delimeter)
- Sent from a previously agreed email to stats@xsolla.com
- Email subject: “stats registry”
- Attachment file name: stats_registry_period, where period is determined by start_dateTend_date in format YYYY-MM-DD. If the period consists of one day (24 hours), the portion including and after T can be omitted
Stats for processed transactions for November 24, 2010.
Filename: stats_registry_2010-11-24.csv
Stats for processed transactions for the period from October 10 to December 16, 2010.
Filename: stats_registry_2010-01-10T2010-12-16.csv
Stats for processed transactions for May 2011.
Filename: stats_registry_2011-05-01T2011-05-31.csv
Document Content
| Parameter | Type | Description |
|---|---|---|
| const | string | Transaction id in the merchant’s system (id in your system). Required unless pid is passed. |
| pid | string | Transaction id in Xsolla system (we send it in the request). Required unless const is passed. |
| amount | string | Payment amount. Decimal separator: “.”, 2 decimal places. Required. |
| payout | string | Xsolla payout amount. Required. |
| currency | string | Payment currency (ISO 4217). Required. |
| state | string | Payment status. Only send payments with statuses success or cancelled. A canceled payment is a payment that was originally approved but later canceled by the user. Required. |
| time | string | Time and date of payment (YYYY-MM-DD HH:MM:SS). Required. |
| desc | string | Additional parameter, for example some payment details we pass in the request (email, nick, phone). Optional. |
Registry Example
Example 1
- http
197035765;6654448;10.00;9.50;RUB;done;2011-09-01 13:30:45;nickname
2
397035766;6634558;150.00;145.00;RUB;done;2011-09-01 16:43:54;vassilliy@mail.ru
Example 2 (if there is no pid in the payment system)
- http
1564;;10.00;9.50;RUB;done;2011-09-01 13:30:45;nickname
2
3456;;150.00;145.00;RUB;done;2011-09-01 16:43:54;vassilliy@mail.ru
Example 3 (if there is no desc — note the semicolon at the end)
- http
1564;6654855;10.00;9.50;RUB;done;2011-09-01 13:30:45;
2
3456;4588554;150.00;145.00;RUB;done;2011-09-01 16:43:54;
Reconciliation via Payment System API
Transaction reconciliation can also be done via the payment system’s HTTP (HTTPS) API. After querying the API, Xsolla must receive the following parameters:
| Parameter | Type | Description |
|---|---|---|
| const | string | Transaction id in the merchant’s system (id in your system). Required unless pid is passed. |
| pid | string | Transaction id in Xsolla system (we send it in the request). Required unless const is passed. |
| amount | string | Payment amount. Decimal separator: “.”, 2 decimal places. Required. |
| payout | string | Xsolla payout amount. Required. |
| currency | string | Payment currency (ISO 4217). Required. |
| state | string | Payment status. Only send payments with statuses success or cancelled. A canceled payment is a payment that was originally approved but later canceled by the user. Required. |
| time | string | Time and date of payment (YYYY-MM-DD HH:MM:SS). Required. |
| desc | string | Additional parameter, for example some payment details we pass in the request (email, nick, phone). Optional. |
Faute de frappe ou autre erreur dans le texte ? Sélectionnez le texte concerné et appuyez sur Ctrl+Entrée.