Subscriptions API

Überblick

Methoden zur Verwaltung von Abonnements: Siehe Produktanleitung und Begriffserläuterung.

Endpunktpfade: https://api.xsolla.com.

Benutzeroberfläche (UI)

Benutzeroberfläche (UI) öffnen

Nutzen Sie folgenden Link, um die Benutzeroberfläche in einem neuen Fenster zu öffnen: https://secure.xsolla.com/paystation2/?access_token=ACCESS_TOKEN; wobei ACCESS_TOKEN jener Token ist, der über die API empfangen wird.

Für Testzwecke steht Ihnen folgende URL zur Verfügung: https://sandbox-secure.xsolla.com/paystation2/?access_token=ACCESS_TOKEN.

Notice: Parameter access_token enthält personenbezogene Nutzerdaten. Bitte stellen Sie sicher, dass Sie Server-zu-Server-Kommunikation einsetzen, wenn Sie diesen Parameter abrufen.

Liste der Testkarten

Sie können folgende Karten In der Testumgebung (Sandbox-Modus) verwenden, um erfolgreiche Zahlungen zu simulieren:

Karte3-D Secure
Kartennummer: 4111111111111111
Gültig bis: 12/40
CVV2: 123
Kartentyp: VISA
Nein
Kartennummer: 5555555555554444
Gültig bis: 11/40
CVV2: 321
Kartentyp: MasterCard
Nein
Kartennummer: 4000000000000010
Gültig bis: 12/40
CVV2: 123
Kartentyp: VISA
Ja
Kartennummer: 5200000000000114
Gültig bis: 11/40
CVV2: 321
Kartentyp: MasterCard
Ja
Kartennummer: 6759649826438453
Gültig bis: 12/40
CVV2: 321
Kartentyp: Maestro
Ja

Zusätzlich können Sie folgende Daten verwenden, um abgelehnte Transaktionen zu simulieren:

Karte3-D SecureBeschreibung
Kartennummer: 4000000000000002
Gültig bis: 12/40
CVV2: 123
Kartentyp: VISA
NeinUnzureichende Mittel
Kartennummer: 5200000000000007
Gültig bis: 11/40
CVV2: 321
Kartentyp: MasterCard
NeinUnzureichende Mittel
Kartennummer: 4000000000000036
Gültig bis: 12/40
CVV2: 123
Kartentyp: VISA
JaAbgelehnt
Kartennummer: 5200000000000031
Gültig bis: 11/40
CVV2: 321
Kartentyp: MasterCard
JaAbgelehnt

Liste der Fehler

CodeBeschreibung
0004-0001Token abgelaufen oder falsch.
0004-0008Falsche URL (Zugriff auf die Testumgebung unter secure.xsolla.com oder auf den Live-Modus unter sandbox-secure.xsolla.com).
0002-0004Vereinbarung wurde nicht unterzeichnet.
0004-0010Tokenlose Integration ist untersagt.
0010-0001Pakete wurde nicht gefunden.
0010-0003Für die Pakete ist kein DRM konfiguriert.
1000-0003Für das Projekt sind keine Module eingeschaltet.

Verwaltung von Abonnements

Methoden zur Verwaltung von Abonnements: Siehe Produktanleitung und Begriffserläuterung.

Abo-Modell anlegen

Legt ein Abo-Modell an.

HTTP-ANFRAGE

POST https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans

ParameterTypBeschreibung
project_id
integerProjekt-ID.
external_id
stringExterne ID des Abo-Modells (32 Zeichen). Optional.
name
array of stringsBezeichnung des Abo-Modells. Besteht aus Paaren vom Typ "localization":"plan name" (Sprache:Bezeichnung des Abo-Modells).
description
array of stringsBeschreibung zum Abo-Modell. Besteht aus Paaren vom Typ "localization":"plan description" (Sprache:Beschreibung zum Abo-Modell). Optional.
group_id
stringGruppen-ID, mit der die Abo-Modelle verknüpft sind.
charge
objectDetails zur Abrechnung (Objekt).
charge.period
objectAbrechnungszeitraum (Objekt).
charge.period.value
integerAnzahl der Zeiteinheiten.
charge.period.type
stringZeiteinheit: day / month.
charge.amount
floatAbrechnungsbetrag.
charge.currency
stringKaufwährung. Währungscode, bestehend aus drei Buchstaben gemäß ISO 4217.
expiration
objectDetails zum Auslaufen des Abonnements (Objekt).
expiration.value
integerZeitliche Gültigkeit.
expiration.type
stringZeiteinheit: day / month.
trial
objectAngaben zum Probezeitraum (Objekt). Optional.
trial.value
integerProbezeitraum.
trial.type
stringZeiteinheit: day.
grace_period
objectAngaben zur Übergangsfrist. Optional.
grace_period.value
integerÜbergangsfrist.
grace_period.type
stringZeiteinheit: day.
tags
arrayAbo-Modell-Markierungen. Optional.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "charge": {
    "amount": "10",
    "currency": "USD",
    "period": {
      "type": "month",
      "value": "1"
    }
  },
  "description": {
    "en": "2x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": null
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": "2"
  },
  "name": {
    "en": "Experience boost"
  },
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "trial": {
    "type": "day",
    "value": "7"
  }
}
curl --request POST \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"charge":{"amount":"10","currency":"USD","period":{"value":"1","type":"month"}},"name":{"en":"Experience boost"},"description":{"en":"2x more experience!"},"trial":{"value":"7","type":"day"},"grace_period":{"value":"2","type":"day"},"external_id":"exp","expiration":{"value":null,"type":"day"},"status":{"value":"active","counters":{"active":0,"canceled":0,"frozen":0,"non_renewing":0}}}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"charge":{"amount":"10","currency":"USD","period":{"value":"1","type":"month"}},"name":{"en":"Experience boost"},"description":{"en":"2x more experience!"},"trial":{"value":"7","type":"day"},"grace_period":{"value":"2","type":"day"},"external_id":"exp","expiration":{"value":null,"type":"day"},"status":{"value":"active","counters":{"active":0,"canceled":0,"frozen":0,"non_renewing":0}}}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"charge\":{\"amount\":\"10\",\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"2x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"charge\":{\"amount\":\"10\",\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"2x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}}}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("POST", "/merchant/v2/projects/{project_id}/subscriptions/plans", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"charge\":{\"amount\":\"10\",\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"2x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}}}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"charge\":{\"amount\":\"10\",\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"2x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}}}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans")
  .post(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "charge": {
    "amount": "10",
    "currency": "USD",
    "period": {
      "value": "1",
      "type": "month"
    }
  },
  "name": {
    "en": "Experience boost"
  },
  "description": {
    "en": "2x more experience!"
  },
  "trial": {
    "value": "7",
    "type": "day"
  },
  "grace_period": {
    "value": "2",
    "type": "day"
  },
  "external_id": "exp",
  "expiration": {
    "value": null,
    "type": "day"
  },
  "status": {
    "value": "active",
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    }
  }
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}

Abo-Modell-Parameter aktualisieren

Aktualisiert die Abo-Modell-Parameter.

HTTP-ANFRAGE

PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}

ParameterTypBeschreibung
project_id
integerProjekt-ID.
plan_id
integerID des Abo-Modells.
external_id
stringExterne ID des Abo-Modells (32 Zeichen). Optional.
name
array of stringsBezeichnung des Abo-Modells. Besteht aus Paaren vom Typ "localization":"plan name" (Sprache:Bezeichnung des Abo-Modells).
description
array of stringsBeschreibung zum Abo-Modell. Besteht aus Paaren vom Typ "localization":"plan description" (Sprache:Beschreibung zum Abo-Modell). Optional.
group_id
stringGruppen-ID, mit der die Abo-Modelle verknüpft sind.
charge
objectDetails zur Abrechnung (Objekt).
charge.period
objectAbrechnungszeitraum (Objekt).
charge.period.value
integerAnzahl der Zeiteinheiten.
charge.period.type
stringZeiteinheit: day / month.
charge.amount
floatAbrechnungsbetrag.
charge.currency
stringKaufwährung. Währungscode, bestehend aus drei Buchstaben gemäß ISO 4217.
expiration
objectDetails zum Auslaufen des Abonnements (Objekt).
expiration.value
integerZeitliche Gültigkeit.
expiration.type
stringZeiteinheit: day / month.
trial
objectAngaben zum Probezeitraum (Objekt). Optional.
trial.value
integerProbezeitraum.
trial.type
stringZeiteinheit: day.
grace_period
objectAngaben zur Übergangsfrist. Optional.
grace_period.value
integerÜbergangsfrist.
grace_period.type
stringZeiteinheit: day.
tags
arrayAbo-Modell-Markierungen. Optional.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • java
  • js
  • python
  • ruby
Anfrage
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": "1"
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": null
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": "2"
  },
  "name": {
    "en": "Experience boost"
  },
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": null,
  "trial": {
    "type": "day",
    "value": "7"
  }
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id} \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"charge":{"amount":20,"currency":"USD","period":{"value":"1","type":"month"}},"name":{"en":"Experience boost"},"description":{"en":"3x more experience!"},"trial":{"value":"7","type":"day"},"grace_period":{"value":"2","type":"day"},"external_id":"exp","expiration":{"value":null,"type":"day"},"status":{"value":"active","counters":{"active":0,"canceled":0,"frozen":0,"non_renewing":0}},"tags":null}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"charge":{"amount":20,"currency":"USD","period":{"value":"1","type":"month"}},"name":{"en":"Experience boost"},"description":{"en":"3x more experience!"},"trial":{"value":"7","type":"day"},"grace_period":{"value":"2","type":"day"},"external_id":"exp","expiration":{"value":null,"type":"day"},"status":{"value":"active","counters":{"active":0,"canceled":0,"frozen":0,"non_renewing":0}},"tags":null}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"charge\":{\"amount\":20,\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"3x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}},\"tags\":null}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"charge\":{\"amount\":20,\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"3x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}},\"tags\":null}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "value": "1",
      "type": "month"
    }
  },
  "name": {
    "en": "Experience boost"
  },
  "description": {
    "en": "3x more experience!"
  },
  "trial": {
    "value": "7",
    "type": "day"
  },
  "grace_period": {
    "value": "2",
    "type": "day"
  },
  "external_id": "exp",
  "expiration": {
    "value": null,
    "type": "day"
  },
  "status": {
    "value": "active",
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    }
  },
  "tags": null
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"charge\":{\"amount\":20,\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"3x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}},\"tags\":null}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"charge\":{\"amount\":20,\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"3x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}},\"tags\":null}"

response = http.request(request)
puts response.read_body
Antwort
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}

Abo-Modell aktivieren

Schaltet ein Abo-Modell aktiv.

HTTP-ANFRAGE

PATCH https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}

ParameterTypBeschreibung
project_id
integerProjekt-ID.
plan_id
integerID des Abo-Modells.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
PATCH https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "status": {
    "value": "active"
  }
}
curl --request PATCH \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id} \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"status":{"value":"active"}}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"status":{"value":"active"}}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}');
$request->setRequestMethod('PATCH');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}");
var request = new RestRequest(Method.PATCH);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"status\":{\"value\":\"active\"}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"status\":{\"value\":\"active\"}}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PATCH", "/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"status\":{\"value\":\"active\"}}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"status\":{\"value\":\"active\"}}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}")
  .patch(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "status": {
    "value": "active"
  }
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PATCH", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort


Abo-Modell deaktivieren

Deaktiviert ein Abo-Modell.

HTTP-ANFRAGE

DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}

ParameterTypBeschreibung
project_id
integerProjekt-ID.
plan_id
integerID des Abo-Modells.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request DELETE \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id} \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}');
$request->setRequestMethod('DELETE');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}");
var request = new RestRequest(Method.DELETE);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("DELETE", "/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}")
  .delete(null)
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort


Abo-Modell löschen

Löscht ein Abo-Modell.

HTTP-ANFRAGE

DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete

ParameterTypBeschreibung
project_id
integerProjekt-ID.
plan_id
integerID des Abo-Modells.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request DELETE \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete');
$request->setRequestMethod('DELETE');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete");
var request = new RestRequest(Method.DELETE);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("DELETE", "/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete")
  .delete(null)
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort


Abo-Modelle abrufen

Listet alle Abo-Modelle auf.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans

ParameterTypBeschreibung
project_id
integerProjekt-ID.
external_id
stringExterne ID des Abo-Modells (32 Zeichen).
limit
integerBegrenzung der Elementanzahl auf der Seite.
offset
integerElementnummer, aus der die Liste generiert wird (die Zählung beginnt bei 0).
group_id
stringGruppen-ID, mit der die Abo-Modelle verknüpft sind.
product_id
integerProdukt-ID, mit der die Abo-Modelle verknüpft sind.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10' \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString(array(
  'limit' => '10'
)));

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]

Produkt anlegen

Legt ein abonnement-basiertes Produkt an.

HTTP-ANFRAGE

POST https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products

ParameterTypBeschreibung
project_id
integerProjekt-ID.
name
stringProduktbezeichnung.
group_id
stringGruppen-ID, mit der die Abo-Modelle verknüpft sind.
description
stringLokalisierte Beschreibungen des Gegenstands (Array).
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "description": [],
  "group_id": "charge",
  "name": "Channel2"
}
curl --request POST \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"description":[],"group_id":"charge","name":"Channel2"}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"description":[],"group_id":"charge","name":"Channel2"}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"description\":[],\"group_id\":\"charge\",\"name\":\"Channel2\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"description\":[],\"group_id\":\"charge\",\"name\":\"Channel2\"}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("POST", "/merchant/v2/projects/{project_id}/subscriptions/products", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"description\":[],\"group_id\":\"charge\",\"name\":\"Channel2\"}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"description\":[],\"group_id\":\"charge\",\"name\":\"Channel2\"}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products")
  .post(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "description": [],
  "group_id": "charge",
  "name": "Channel2"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}

Produkt aktualisieren

Aktualisiert ein abonnement-basiertes Produkt.

HTTP-ANFRAGE

PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}

ParameterTypBeschreibung
project_id
integerProjekt-ID.
product_id
integerProdukt-ID, mit der die Abo-Modelle verknüpft sind.
name
stringProduktbezeichnung.
group_id
stringGruppen-ID, mit der die Abo-Modelle verknüpft sind.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "description": [],
  "group_id": "charge1323",
  "name": "Channel2123"
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/ \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"description":[],"group_id":"charge1323","name":"Channel2123"}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"description":[],"group_id":"charge1323","name":"Channel2123"}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"description\":[],\"group_id\":\"charge1323\",\"name\":\"Channel2123\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"description\":[],\"group_id\":\"charge1323\",\"name\":\"Channel2123\"}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"description\":[],\"group_id\":\"charge1323\",\"name\":\"Channel2123\"}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"description\":[],\"group_id\":\"charge1323\",\"name\":\"Channel2123\"}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "description": [],
  "group_id": "charge1323",
  "name": "Channel2123"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}

Produkt löschen

Löscht ein abonnement-basiertes Produkt.

HTTP-ANFRAGE

DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}

ParameterTypBeschreibung
project_id
integerProjekt-ID.
product_id
integerProdukt-ID, mit der die Abo-Modelle verknüpft sind.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request DELETE \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id} \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}');
$request->setRequestMethod('DELETE');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}");
var request = new RestRequest(Method.DELETE);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("DELETE", "/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}")
  .delete(null)
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort


Produkt anfordern

Listet alle abonnement-basierten Produkte auf.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products

ParameterTypBeschreibung
project_id
integerProjekt-ID.
group_id
stringGruppen-ID, mit der die Abo-Modelle verknüpft sind.
product_id
integerProdukt-ID, mit der die Abo-Modelle verknüpft sind.
limit
integerBegrenzung der Elementanzahl auf der Seite.
offset
integerElementnummer, aus der die Liste generiert wird (die Zählung beginnt bei 0).
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/subscriptions/products", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]

Abonnement abrufen

Ruft bestimmte Abonnementangaben mithilfe einer ID ab.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}

ParameterTypBeschreibung
project_id
integerProjekt-ID. Erforderlich.
subscription_id
integerAbonnement-ID. Erforderlich.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id} \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
[
  {
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}

]
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}

Abonnement aktualisieren

Aktualisiert ein Abonnement, indem entweder dessen Status ('active', 'canceled' oder 'non_renewing') geändert oder das nächste Abrechnungsdatum zeitlich verschoben wird.

HTTP-ANFRAGE

PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}

ParameterTypBeschreibung
project_id
integerProjekt-ID.
subscription_id
integerAbonnement-ID.
user_id
stringBenutzer-ID.
status
stringStatus: active / canceled / non_renewing.
cancel_subscription_payment
booleanWird 'true' festgelegt, so wird die letzte, für dieses Abonnement getätigte Zahlung zurückerstattet. Funktioniert nur dann, wenn zugleich der Status auf 'canceled' gesetzt wird.
timeshift
objectZeitliche Zurückstellung der Abrechnung.
timeshift.type
stringAbrechnungszeiteinheit, kann "day" oder "month" sein.
timeshift.value
stringAnzahl der Einheiten, um die die Abrechnung verschoben wird. Der Wert hängt ab vom timeshift.type-Parameter und kann zwischen:
  • 1 und 366 liegen, falls für den timeshift.type-Parameter "day" festgelegt wurde,
  • 1 und 12 liegen, falls für den timeshift.type-Parameter "month" festgelegt wurde
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "comment": "Canceled by the user with the latest payment refund",
  "status": "active"
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id} \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"comment":"Canceled by the user with the latest payment refund","status":"active"}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"comment":"Canceled by the user with the latest payment refund","status":"active"}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"comment\":\"Canceled by the user with the latest payment refund\",\"status\":\"active\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"comment\":\"Canceled by the user with the latest payment refund\",\"status\":\"active\"}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"comment\":\"Canceled by the user with the latest payment refund\",\"status\":\"active\"}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"comment\":\"Canceled by the user with the latest payment refund\",\"status\":\"active\"}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "comment": "Canceled by the user with the latest payment refund",
  "status": "active"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}

Abonnements abrufen

Listet alle sich automatisch verlängernden Abonnements auf.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/subscriptions

ParameterTypBeschreibung
merchant_id
integerHändler-ID. Erforderlich.
project_id
array of integersIDs für Projekte.
user_id
stringBenutzer-ID (v1).
plan_id
array of integersIDs für Abo-Modelle.
product_id
array of integersIDs für Abonnementbasiertes Produkt.
group_id
array of stringsIDs für die Abonnementgruppen.
status
array of integersAbonnementstatus.
datetime_from
datetimeAbfragedatum. Damit findet man Abonnements, die nach dem angegebenen Datum erstellt wurden.
datetime_to
datetimeAbfragedatum. Damit findet man Abonnements, die vor dem angegebenen Datum erstellt wurden.
limit
integerBegrenzung der Elementanzahl auf der Seite.
offset
integerElementnummer, aus der die Liste generiert wird (die Zählung beginnt bei 0).
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/subscriptions

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/subscriptions \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/subscriptions');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/subscriptions");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/merchants/{merchant_id}/subscriptions", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/subscriptions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/subscriptions")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/subscriptions");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
[
  {
    "id": 45,
    "cost": 0.03,
    "dateCreate": "2013-09-05T15:27:47+0400",
    "dateEnd": "2014-02-06T11:32:48+0400",
    "dateLastCharge": null,
    "dateNextCharge": null,
    "email": "test@test.com",
    "currency": "USD",
    "user": "User1",
    "status": 2,
    "chargeAmount": "0.0300",
    "planId": 12345,
    "projectId": 12345,
    "productId": null,
    "productName": null,
    "name": {
      "en": "Example"
    }
  }
]
[
  {
    "id": 45,
    "cost": 0.03,
    "dateCreate": "2013-09-05T15:27:47+0400",
    "dateEnd": "2014-02-06T11:32:48+0400",
    "dateLastCharge": null,
    "dateNextCharge": null,
    "email": "test@test.com",
    "currency": "USD",
    "user": "User1",
    "status": 2,
    "chargeAmount": "0.0300",
    "planId": 12345,
    "projectId": 12345,
    "productId": null,
    "productName": null,
    "name": {
      "en": "Example"
    }
  }
]
[
  {
    "id": 45,
    "cost": 0.03,
    "dateCreate": "2013-09-05T15:27:47+0400",
    "dateEnd": "2014-02-06T11:32:48+0400",
    "dateLastCharge": null,
    "dateNextCharge": null,
    "email": "test@test.com",
    "currency": "USD",
    "user": "User1",
    "status": 2,
    "chargeAmount": "0.0300",
    "planId": 12345,
    "projectId": 12345,
    "productId": null,
    "productName": null,
    "name": {
      "en": "Example"
    }
  }
]
[
  {
    "id": 45,
    "cost": 0.03,
    "dateCreate": "2013-09-05T15:27:47+0400",
    "dateEnd": "2014-02-06T11:32:48+0400",
    "dateLastCharge": null,
    "dateNextCharge": null,
    "email": "test@test.com",
    "currency": "USD",
    "user": "User1",
    "status": 2,
    "chargeAmount": "0.0300",
    "planId": 12345,
    "projectId": 12345,
    "productId": null,
    "productName": null,
    "name": {
      "en": "Example"
    }
  }
]
[
  {
    "id": 45,
    "cost": 0.03,
    "dateCreate": "2013-09-05T15:27:47+0400",
    "dateEnd": "2014-02-06T11:32:48+0400",
    "dateLastCharge": null,
    "dateNextCharge": null,
    "email": "test@test.com",
    "currency": "USD",
    "user": "User1",
    "status": 2,
    "chargeAmount": "0.0300",
    "planId": 12345,
    "projectId": 12345,
    "productId": null,
    "productName": null,
    "name": {
      "en": "Example"
    }
  }
]
[
  {
    "id": 45,
    "cost": 0.03,
    "dateCreate": "2013-09-05T15:27:47+0400",
    "dateEnd": "2014-02-06T11:32:48+0400",
    "dateLastCharge": null,
    "dateNextCharge": null,
    "email": "test@test.com",
    "currency": "USD",
    "user": "User1",
    "status": 2,
    "chargeAmount": "0.0300",
    "planId": 12345,
    "projectId": 12345,
    "productId": null,
    "productName": null,
    "name": {
      "en": "Example"
    }
  }
]
[
  {
    "id": 45,
    "cost": 0.03,
    "dateCreate": "2013-09-05T15:27:47+0400",
    "dateEnd": "2014-02-06T11:32:48+0400",
    "dateLastCharge": null,
    "dateNextCharge": null,
    "email": "test@test.com",
    "currency": "USD",
    "user": "User1",
    "status": 2,
    "chargeAmount": "0.0300",
    "planId": 12345,
    "projectId": 12345,
    "productId": null,
    "productName": null,
    "name": {
      "en": "Example"
    }
  }
]
[
  {
    "id": 45,
    "cost": 0.03,
    "dateCreate": "2013-09-05T15:27:47+0400",
    "dateEnd": "2014-02-06T11:32:48+0400",
    "dateLastCharge": null,
    "dateNextCharge": null,
    "email": "test@test.com",
    "currency": "USD",
    "user": "User1",
    "status": 2,
    "chargeAmount": "0.0300",
    "planId": 12345,
    "projectId": 12345,
    "productId": null,
    "productName": null,
    "name": {
      "en": "Example"
    }
  }
]

Zahlungen abrufen

Listet alle Abonnement-Zahlungen auf.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments

ParameterTypBeschreibung
project_id
integerProjekt-ID.
user_id
stringBenutzer-ID.
status
stringStatus: processing / canceled / done.
limit
integerBegrenzung der Elementanzahl auf der Seite.
offset
integerElementnummer, aus der die Liste generiert wird (die Zählung beginnt bei 0).
datetime_from
datetimeBeginn des Zeitraums.
datetime_to
datetimeEnde des Zeitraums.
subscription_id
integerAbonnement-ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments?limit=100

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments?limit=100' \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString(array(
  'limit' => '100'
)));

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments?limit=100");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/subscriptions/payments?limit=100", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments?limit=100")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments?limit=100")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments?limit=100");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 67683,
    "id_payment": 203960,
    "status": "fail",
    "subscription": {
      "charge_amount": 1,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 3646,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nJ79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 12345,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "10",
        "name": "user2"
      }
    }
  },
  {
    "date_payment": "2015-09-21T17:06:47+0300",
    "id": 1531,
    "id_payment": 168866,
    "status": "done",
    "subscription": {
      "charge_amount": 1,
      "comment": "  \r\n",
      "currency": "RUB",
      "date_create": "2015-09-21T17:06:47+0300",
      "date_end": null,
      "date_last_charge": "2015-09-21T18:10:09+0300",
      "date_next_charge": "2015-09-22T18:10:09+0300",
      "id": 1204846,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nX9",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 240,
        "localized_name": null,
        "name": null,
        "project_id": 70,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": null,
      "status": "new",
      "user": {
        "id": "12",
        "name": "user1"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 67683,
    "id_payment": 203960,
    "status": "fail",
    "subscription": {
      "charge_amount": 1,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 3646,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nJ79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 12345,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "10",
        "name": "user2"
      }
    }
  },
  {
    "date_payment": "2015-09-21T17:06:47+0300",
    "id": 1531,
    "id_payment": 168866,
    "status": "done",
    "subscription": {
      "charge_amount": 1,
      "comment": "  \r\n",
      "currency": "RUB",
      "date_create": "2015-09-21T17:06:47+0300",
      "date_end": null,
      "date_last_charge": "2015-09-21T18:10:09+0300",
      "date_next_charge": "2015-09-22T18:10:09+0300",
      "id": 1204846,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nX9",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 240,
        "localized_name": null,
        "name": null,
        "project_id": 70,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": null,
      "status": "new",
      "user": {
        "id": "12",
        "name": "user1"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 67683,
    "id_payment": 203960,
    "status": "fail",
    "subscription": {
      "charge_amount": 1,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 3646,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nJ79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 12345,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "10",
        "name": "user2"
      }
    }
  },
  {
    "date_payment": "2015-09-21T17:06:47+0300",
    "id": 1531,
    "id_payment": 168866,
    "status": "done",
    "subscription": {
      "charge_amount": 1,
      "comment": "  \r\n",
      "currency": "RUB",
      "date_create": "2015-09-21T17:06:47+0300",
      "date_end": null,
      "date_last_charge": "2015-09-21T18:10:09+0300",
      "date_next_charge": "2015-09-22T18:10:09+0300",
      "id": 1204846,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nX9",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 240,
        "localized_name": null,
        "name": null,
        "project_id": 70,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": null,
      "status": "new",
      "user": {
        "id": "12",
        "name": "user1"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 67683,
    "id_payment": 203960,
    "status": "fail",
    "subscription": {
      "charge_amount": 1,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 3646,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nJ79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 12345,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "10",
        "name": "user2"
      }
    }
  },
  {
    "date_payment": "2015-09-21T17:06:47+0300",
    "id": 1531,
    "id_payment": 168866,
    "status": "done",
    "subscription": {
      "charge_amount": 1,
      "comment": "  \r\n",
      "currency": "RUB",
      "date_create": "2015-09-21T17:06:47+0300",
      "date_end": null,
      "date_last_charge": "2015-09-21T18:10:09+0300",
      "date_next_charge": "2015-09-22T18:10:09+0300",
      "id": 1204846,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nX9",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 240,
        "localized_name": null,
        "name": null,
        "project_id": 70,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": null,
      "status": "new",
      "user": {
        "id": "12",
        "name": "user1"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 67683,
    "id_payment": 203960,
    "status": "fail",
    "subscription": {
      "charge_amount": 1,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 3646,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nJ79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 12345,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "10",
        "name": "user2"
      }
    }
  },
  {
    "date_payment": "2015-09-21T17:06:47+0300",
    "id": 1531,
    "id_payment": 168866,
    "status": "done",
    "subscription": {
      "charge_amount": 1,
      "comment": "  \r\n",
      "currency": "RUB",
      "date_create": "2015-09-21T17:06:47+0300",
      "date_end": null,
      "date_last_charge": "2015-09-21T18:10:09+0300",
      "date_next_charge": "2015-09-22T18:10:09+0300",
      "id": 1204846,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nX9",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 240,
        "localized_name": null,
        "name": null,
        "project_id": 70,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": null,
      "status": "new",
      "user": {
        "id": "12",
        "name": "user1"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 67683,
    "id_payment": 203960,
    "status": "fail",
    "subscription": {
      "charge_amount": 1,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 3646,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nJ79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 12345,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "10",
        "name": "user2"
      }
    }
  },
  {
    "date_payment": "2015-09-21T17:06:47+0300",
    "id": 1531,
    "id_payment": 168866,
    "status": "done",
    "subscription": {
      "charge_amount": 1,
      "comment": "  \r\n",
      "currency": "RUB",
      "date_create": "2015-09-21T17:06:47+0300",
      "date_end": null,
      "date_last_charge": "2015-09-21T18:10:09+0300",
      "date_next_charge": "2015-09-22T18:10:09+0300",
      "id": 1204846,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nX9",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 240,
        "localized_name": null,
        "name": null,
        "project_id": 70,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": null,
      "status": "new",
      "user": {
        "id": "12",
        "name": "user1"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 67683,
    "id_payment": 203960,
    "status": "fail",
    "subscription": {
      "charge_amount": 1,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 3646,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nJ79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 12345,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "10",
        "name": "user2"
      }
    }
  },
  {
    "date_payment": "2015-09-21T17:06:47+0300",
    "id": 1531,
    "id_payment": 168866,
    "status": "done",
    "subscription": {
      "charge_amount": 1,
      "comment": "  \r\n",
      "currency": "RUB",
      "date_create": "2015-09-21T17:06:47+0300",
      "date_end": null,
      "date_last_charge": "2015-09-21T18:10:09+0300",
      "date_next_charge": "2015-09-22T18:10:09+0300",
      "id": 1204846,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nX9",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 240,
        "localized_name": null,
        "name": null,
        "project_id": 70,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": null,
      "status": "new",
      "user": {
        "id": "12",
        "name": "user1"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 67683,
    "id_payment": 203960,
    "status": "fail",
    "subscription": {
      "charge_amount": 1,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 3646,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nJ79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 12345,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "10",
        "name": "user2"
      }
    }
  },
  {
    "date_payment": "2015-09-21T17:06:47+0300",
    "id": 1531,
    "id_payment": 168866,
    "status": "done",
    "subscription": {
      "charge_amount": 1,
      "comment": "  \r\n",
      "currency": "RUB",
      "date_create": "2015-09-21T17:06:47+0300",
      "date_end": null,
      "date_last_charge": "2015-09-21T18:10:09+0300",
      "date_next_charge": "2015-09-22T18:10:09+0300",
      "id": 1204846,
      "plan": {
        "charge": {
          "amount": 1,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8nX9",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 240,
        "localized_name": null,
        "name": null,
        "project_id": 70,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": null,
      "status": "new",
      "user": {
        "id": "12",
        "name": "user1"
      }
    }
  }
]

Benutzerdaten anfordern

Listet alle getätigten Zahlungen eines bestimmten Benutzers auf.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/payments

ParameterTypBeschreibung
project_id
integerProjekt-ID.
user_id
stringBenutzer-ID.
status
stringStatus: processing / canceled / done.
limit
integerBegrenzung der Elementanzahl auf der Seite.
offset
integerElementnummer, aus der die Liste generiert wird (die Zählung beginnt bei 0).
datetime_from
datetimeBeginn des Zeitraums.
datetime_to
datetimeEnde des Zeitraums.
subscription_id
integerAbonnement-ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments?datetime_from=2013-04-05T15:34:17&datetime_to=2017-04-05T15:34:17&limit=100&user_id=12

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments?datetime_from=2013-04-05T15%3A34%3A17&datetime_to=2017-04-05T15%3A34%3A17&user_id=12&limit=100' \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString(array(
  'datetime_from' => '2013-04-05T15:34:17',
  'datetime_to' => '2017-04-05T15:34:17',
  'user_id' => '12',
  'limit' => '100'
)));

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments?datetime_from=2013-04-05T15%3A34%3A17&datetime_to=2017-04-05T15%3A34%3A17&user_id=12&limit=100");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/subscriptions/payments?datetime_from=2013-04-05T15%3A34%3A17&datetime_to=2017-04-05T15%3A34%3A17&user_id=12&limit=100", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments?datetime_from=2013-04-05T15%3A34%3A17&datetime_to=2017-04-05T15%3A34%3A17&user_id=12&limit=100")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments?datetime_from=2013-04-05T15%3A34%3A17&datetime_to=2017-04-05T15%3A34%3A17&user_id=12&limit=100")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments?datetime_from=2013-04-05T15%3A34%3A17&datetime_to=2017-04-05T15%3A34%3A17&user_id=12&limit=100");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 6746083,
    "id_payment": 202789960,
    "status": "fail",
    "subscription": {
      "charge_amount": 100,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 36946,
      "plan": {
        "charge": {
          "amount": 100,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8n34J79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 1234,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "12",
        "name": "John"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 6746083,
    "id_payment": 202789960,
    "status": "fail",
    "subscription": {
      "charge_amount": 100,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 36946,
      "plan": {
        "charge": {
          "amount": 100,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8n34J79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 1234,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "12",
        "name": "John"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 6746083,
    "id_payment": 202789960,
    "status": "fail",
    "subscription": {
      "charge_amount": 100,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 36946,
      "plan": {
        "charge": {
          "amount": 100,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8n34J79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 1234,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "12",
        "name": "John"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 6746083,
    "id_payment": 202789960,
    "status": "fail",
    "subscription": {
      "charge_amount": 100,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 36946,
      "plan": {
        "charge": {
          "amount": 100,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8n34J79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 1234,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "12",
        "name": "John"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 6746083,
    "id_payment": 202789960,
    "status": "fail",
    "subscription": {
      "charge_amount": 100,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 36946,
      "plan": {
        "charge": {
          "amount": 100,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8n34J79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 1234,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "12",
        "name": "John"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 6746083,
    "id_payment": 202789960,
    "status": "fail",
    "subscription": {
      "charge_amount": 100,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 36946,
      "plan": {
        "charge": {
          "amount": 100,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8n34J79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 1234,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "12",
        "name": "John"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 6746083,
    "id_payment": 202789960,
    "status": "fail",
    "subscription": {
      "charge_amount": 100,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 36946,
      "plan": {
        "charge": {
          "amount": 100,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8n34J79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 1234,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "12",
        "name": "John"
      }
    }
  }
]
[
  {
    "date_payment": "2016-04-05T10:01:01+0300",
    "id": 6746083,
    "id_payment": 202789960,
    "status": "fail",
    "subscription": {
      "charge_amount": 100,
      "comment": null,
      "currency": "RUB",
      "date_create": "2015-05-28T14:33:54+0300",
      "date_end": "2016-04-05T10:01:07+0300",
      "date_last_charge": "2015-06-03T16:07:29+0300",
      "date_next_charge": "2015-06-04T00:00:00+0300",
      "id": 36946,
      "plan": {
        "charge": {
          "amount": 100,
          "currency": "RUB",
          "period": {
            "type": "day",
            "value": 1
          }
        },
        "description": null,
        "expiration": {
          "type": "day",
          "value": 0
        },
        "external_id": "E8n34J79",
        "grace_period": {
          "type": "day",
          "value": 0
        },
        "group_id": "charge",
        "id": 24,
        "localized_name": null,
        "name": null,
        "project_id": 1234,
        "status": {
          "counters": {
            "active": 0,
            "canceled": 0,
            "frozen": 0,
            "non_renewing": 0
          },
          "value": "deleted"
        },
        "tags": null,
        "trial": {
          "type": "day",
          "value": 0
        },
        "type": "charge"
      },
      "product": {
        "description": null,
        "group_id": "charge",
        "id": 1,
        "name": "charge"
      },
      "status": "freeze",
      "user": {
        "id": "12",
        "name": "John"
      }
    }
  }
]

Währungen abrufen

Listet alle unterstützten Abonnement-Währungen auf.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/currencies

ParameterTypBeschreibung
project_id
integerProjekt-ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/currencies

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/currencies \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/currencies');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/currencies");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/subscriptions/currencies", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/currencies")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/currencies")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/currencies");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
[
  "AED",
  "ALL",
  "AMD",
  "ARS",
  "AUD",
  "AZN",
  "BAM",
  "BBD",
  "BGN",
  "BHD",
  "BND",
  "BRL",
  "BYN",
  "BZD",
  "CAD",
  "CHF",
  "CLP",
  "CNY",
  "COP",
  "CRC",
  "CZK",
  "DKK",
  "DZD",
  "EGP",
  "EUR",
  "GBP",
  "GEL",
  "GHS",
  "GIP",
  "GTQ",
  "HKD",
  "HRK",
  "HUF",
  "IDR",
  "ILS",
  "INR",
  "IQD",
  "IRR",
  "ISK",
  "JMD",
  "JOD",
  "JPY",
  "KES",
  "KGS",
  "KRW",
  "KWD",
  "KZT",
  "LAK",
  "LBP",
  "LKR",
  "MAD",
  "MDL",
  "MKD",
  "MMK",
  "MNT",
  "MUR",
  "MXN",
  "MYR",
  "NGN",
  "NIO",
  "NOK",
  "NPR",
  "NZD",
  "OMR",
  "PAB",
  "PEN",
  "PHP",
  "PKR",
  "PLN",
  "PYG",
  "QAR",
  "RON",
  "RSD",
  "RUB",
  "SAR",
  "SEK",
  "SGD",
  "SVC",
  "THB",
  "TND",
  "TRY",
  "TWD",
  "UAH",
  "USD",
  "UYU",
  "UZS",
  "VEF",
  "VND",
  "XOF",
  "YER",
  "ZAR"
]
[
  "AED",
  "ALL",
  "AMD",
  "ARS",
  "AUD",
  "AZN",
  "BAM",
  "BBD",
  "BGN",
  "BHD",
  "BND",
  "BRL",
  "BYN",
  "BZD",
  "CAD",
  "CHF",
  "CLP",
  "CNY",
  "COP",
  "CRC",
  "CZK",
  "DKK",
  "DZD",
  "EGP",
  "EUR",
  "GBP",
  "GEL",
  "GHS",
  "GIP",
  "GTQ",
  "HKD",
  "HRK",
  "HUF",
  "IDR",
  "ILS",
  "INR",
  "IQD",
  "IRR",
  "ISK",
  "JMD",
  "JOD",
  "JPY",
  "KES",
  "KGS",
  "KRW",
  "KWD",
  "KZT",
  "LAK",
  "LBP",
  "LKR",
  "MAD",
  "MDL",
  "MKD",
  "MMK",
  "MNT",
  "MUR",
  "MXN",
  "MYR",
  "NGN",
  "NIO",
  "NOK",
  "NPR",
  "NZD",
  "OMR",
  "PAB",
  "PEN",
  "PHP",
  "PKR",
  "PLN",
  "PYG",
  "QAR",
  "RON",
  "RSD",
  "RUB",
  "SAR",
  "SEK",
  "SGD",
  "SVC",
  "THB",
  "TND",
  "TRY",
  "TWD",
  "UAH",
  "USD",
  "UYU",
  "UZS",
  "VEF",
  "VND",
  "XOF",
  "YER",
  "ZAR"
]
[
  "AED",
  "ALL",
  "AMD",
  "ARS",
  "AUD",
  "AZN",
  "BAM",
  "BBD",
  "BGN",
  "BHD",
  "BND",
  "BRL",
  "BYN",
  "BZD",
  "CAD",
  "CHF",
  "CLP",
  "CNY",
  "COP",
  "CRC",
  "CZK",
  "DKK",
  "DZD",
  "EGP",
  "EUR",
  "GBP",
  "GEL",
  "GHS",
  "GIP",
  "GTQ",
  "HKD",
  "HRK",
  "HUF",
  "IDR",
  "ILS",
  "INR",
  "IQD",
  "IRR",
  "ISK",
  "JMD",
  "JOD",
  "JPY",
  "KES",
  "KGS",
  "KRW",
  "KWD",
  "KZT",
  "LAK",
  "LBP",
  "LKR",
  "MAD",
  "MDL",
  "MKD",
  "MMK",
  "MNT",
  "MUR",
  "MXN",
  "MYR",
  "NGN",
  "NIO",
  "NOK",
  "NPR",
  "NZD",
  "OMR",
  "PAB",
  "PEN",
  "PHP",
  "PKR",
  "PLN",
  "PYG",
  "QAR",
  "RON",
  "RSD",
  "RUB",
  "SAR",
  "SEK",
  "SGD",
  "SVC",
  "THB",
  "TND",
  "TRY",
  "TWD",
  "UAH",
  "USD",
  "UYU",
  "UZS",
  "VEF",
  "VND",
  "XOF",
  "YER",
  "ZAR"
]
[
  "AED",
  "ALL",
  "AMD",
  "ARS",
  "AUD",
  "AZN",
  "BAM",
  "BBD",
  "BGN",
  "BHD",
  "BND",
  "BRL",
  "BYN",
  "BZD",
  "CAD",
  "CHF",
  "CLP",
  "CNY",
  "COP",
  "CRC",
  "CZK",
  "DKK",
  "DZD",
  "EGP",
  "EUR",
  "GBP",
  "GEL",
  "GHS",
  "GIP",
  "GTQ",
  "HKD",
  "HRK",
  "HUF",
  "IDR",
  "ILS",
  "INR",
  "IQD",
  "IRR",
  "ISK",
  "JMD",
  "JOD",
  "JPY",
  "KES",
  "KGS",
  "KRW",
  "KWD",
  "KZT",
  "LAK",
  "LBP",
  "LKR",
  "MAD",
  "MDL",
  "MKD",
  "MMK",
  "MNT",
  "MUR",
  "MXN",
  "MYR",
  "NGN",
  "NIO",
  "NOK",
  "NPR",
  "NZD",
  "OMR",
  "PAB",
  "PEN",
  "PHP",
  "PKR",
  "PLN",
  "PYG",
  "QAR",
  "RON",
  "RSD",
  "RUB",
  "SAR",
  "SEK",
  "SGD",
  "SVC",
  "THB",
  "TND",
  "TRY",
  "TWD",
  "UAH",
  "USD",
  "UYU",
  "UZS",
  "VEF",
  "VND",
  "XOF",
  "YER",
  "ZAR"
]
[
  "AED",
  "ALL",
  "AMD",
  "ARS",
  "AUD",
  "AZN",
  "BAM",
  "BBD",
  "BGN",
  "BHD",
  "BND",
  "BRL",
  "BYN",
  "BZD",
  "CAD",
  "CHF",
  "CLP",
  "CNY",
  "COP",
  "CRC",
  "CZK",
  "DKK",
  "DZD",
  "EGP",
  "EUR",
  "GBP",
  "GEL",
  "GHS",
  "GIP",
  "GTQ",
  "HKD",
  "HRK",
  "HUF",
  "IDR",
  "ILS",
  "INR",
  "IQD",
  "IRR",
  "ISK",
  "JMD",
  "JOD",
  "JPY",
  "KES",
  "KGS",
  "KRW",
  "KWD",
  "KZT",
  "LAK",
  "LBP",
  "LKR",
  "MAD",
  "MDL",
  "MKD",
  "MMK",
  "MNT",
  "MUR",
  "MXN",
  "MYR",
  "NGN",
  "NIO",
  "NOK",
  "NPR",
  "NZD",
  "OMR",
  "PAB",
  "PEN",
  "PHP",
  "PKR",
  "PLN",
  "PYG",
  "QAR",
  "RON",
  "RSD",
  "RUB",
  "SAR",
  "SEK",
  "SGD",
  "SVC",
  "THB",
  "TND",
  "TRY",
  "TWD",
  "UAH",
  "USD",
  "UYU",
  "UZS",
  "VEF",
  "VND",
  "XOF",
  "YER",
  "ZAR"
]
[
  "AED",
  "ALL",
  "AMD",
  "ARS",
  "AUD",
  "AZN",
  "BAM",
  "BBD",
  "BGN",
  "BHD",
  "BND",
  "BRL",
  "BYN",
  "BZD",
  "CAD",
  "CHF",
  "CLP",
  "CNY",
  "COP",
  "CRC",
  "CZK",
  "DKK",
  "DZD",
  "EGP",
  "EUR",
  "GBP",
  "GEL",
  "GHS",
  "GIP",
  "GTQ",
  "HKD",
  "HRK",
  "HUF",
  "IDR",
  "ILS",
  "INR",
  "IQD",
  "IRR",
  "ISK",
  "JMD",
  "JOD",
  "JPY",
  "KES",
  "KGS",
  "KRW",
  "KWD",
  "KZT",
  "LAK",
  "LBP",
  "LKR",
  "MAD",
  "MDL",
  "MKD",
  "MMK",
  "MNT",
  "MUR",
  "MXN",
  "MYR",
  "NGN",
  "NIO",
  "NOK",
  "NPR",
  "NZD",
  "OMR",
  "PAB",
  "PEN",
  "PHP",
  "PKR",
  "PLN",
  "PYG",
  "QAR",
  "RON",
  "RSD",
  "RUB",
  "SAR",
  "SEK",
  "SGD",
  "SVC",
  "THB",
  "TND",
  "TRY",
  "TWD",
  "UAH",
  "USD",
  "UYU",
  "UZS",
  "VEF",
  "VND",
  "XOF",
  "YER",
  "ZAR"
]
[
  "AED",
  "ALL",
  "AMD",
  "ARS",
  "AUD",
  "AZN",
  "BAM",
  "BBD",
  "BGN",
  "BHD",
  "BND",
  "BRL",
  "BYN",
  "BZD",
  "CAD",
  "CHF",
  "CLP",
  "CNY",
  "COP",
  "CRC",
  "CZK",
  "DKK",
  "DZD",
  "EGP",
  "EUR",
  "GBP",
  "GEL",
  "GHS",
  "GIP",
  "GTQ",
  "HKD",
  "HRK",
  "HUF",
  "IDR",
  "ILS",
  "INR",
  "IQD",
  "IRR",
  "ISK",
  "JMD",
  "JOD",
  "JPY",
  "KES",
  "KGS",
  "KRW",
  "KWD",
  "KZT",
  "LAK",
  "LBP",
  "LKR",
  "MAD",
  "MDL",
  "MKD",
  "MMK",
  "MNT",
  "MUR",
  "MXN",
  "MYR",
  "NGN",
  "NIO",
  "NOK",
  "NPR",
  "NZD",
  "OMR",
  "PAB",
  "PEN",
  "PHP",
  "PKR",
  "PLN",
  "PYG",
  "QAR",
  "RON",
  "RSD",
  "RUB",
  "SAR",
  "SEK",
  "SGD",
  "SVC",
  "THB",
  "TND",
  "TRY",
  "TWD",
  "UAH",
  "USD",
  "UYU",
  "UZS",
  "VEF",
  "VND",
  "XOF",
  "YER",
  "ZAR"
]
[
  "AED",
  "ALL",
  "AMD",
  "ARS",
  "AUD",
  "AZN",
  "BAM",
  "BBD",
  "BGN",
  "BHD",
  "BND",
  "BRL",
  "BYN",
  "BZD",
  "CAD",
  "CHF",
  "CLP",
  "CNY",
  "COP",
  "CRC",
  "CZK",
  "DKK",
  "DZD",
  "EGP",
  "EUR",
  "GBP",
  "GEL",
  "GHS",
  "GIP",
  "GTQ",
  "HKD",
  "HRK",
  "HUF",
  "IDR",
  "ILS",
  "INR",
  "IQD",
  "IRR",
  "ISK",
  "JMD",
  "JOD",
  "JPY",
  "KES",
  "KGS",
  "KRW",
  "KWD",
  "KZT",
  "LAK",
  "LBP",
  "LKR",
  "MAD",
  "MDL",
  "MKD",
  "MMK",
  "MNT",
  "MUR",
  "MXN",
  "MYR",
  "NGN",
  "NIO",
  "NOK",
  "NPR",
  "NZD",
  "OMR",
  "PAB",
  "PEN",
  "PHP",
  "PKR",
  "PLN",
  "PYG",
  "QAR",
  "RON",
  "RSD",
  "RUB",
  "SAR",
  "SEK",
  "SGD",
  "SVC",
  "THB",
  "TND",
  "TRY",
  "TWD",
  "UAH",
  "USD",
  "UYU",
  "UZS",
  "VEF",
  "VND",
  "XOF",
  "YER",
  "ZAR"
]

Gutscheine

Gutschein anfordern

Fordert nähere Informationen zum Gutschein mit Hilfe seines Codes an.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}/details 

ParameterTypBeschreibung
project_id
integerProjekt-ID.
code
stringGutscheincode.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}/details  

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{coupon_id}/details \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{coupon_id}/details');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{coupon_id}/details");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/coupons/{coupon_id}/details", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{coupon_id}/details")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{coupon_id}/details")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{coupon_id}/details");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
{
  "campaign_code": "12345",
  "coupon_code": "1234",
  "coupon_id": 89613970,
  "expiration_date": "2019-02-02 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": ,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "12345",
  "coupon_code": "1234",
  "coupon_id": 89613970,
  "expiration_date": "2019-02-02 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": ,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "12345",
  "coupon_code": "1234",
  "coupon_id": 89613970,
  "expiration_date": "2019-02-02 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": ,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "12345",
  "coupon_code": "1234",
  "coupon_id": 89613970,
  "expiration_date": "2019-02-02 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": ,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "12345",
  "coupon_code": "1234",
  "coupon_id": 89613970,
  "expiration_date": "2019-02-02 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": ,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "12345",
  "coupon_code": "1234",
  "coupon_id": 89613970,
  "expiration_date": "2019-02-02 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": ,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "12345",
  "coupon_code": "1234",
  "coupon_id": 89613970,
  "expiration_date": "2019-02-02 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": ,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "12345",
  "coupon_code": "1234",
  "coupon_id": 89613970,
  "expiration_date": "2019-02-02 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": ,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}

Einen Gutschein einlösen

Einen Gutschein mittels seines Codes einlösen.

HTTP-ANFRAGE

POST https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}/redeem

ParameterTypBeschreibung
project_id
integerProjekt-ID.
code
stringGutscheincode.
user_id
stringBenutzer-ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}/redeem

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "user_id": 1234
}
curl --request POST \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}/redeem \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"user_id":1234}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"user_id":1234}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}/redeem');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}/redeem");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"user_id\":1234}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"user_id\":1234}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("POST", "/merchant/v2/projects/{project_id}/coupons/{code}/redeem", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}/redeem")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"user_id\":1234}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"user_id\":1234}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}/redeem")
  .post(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "user_id": 1234
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}/redeem");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
{
  "campaign_code": "new_campaign",
  "coupon_code": "ddgf5bn4",
  "coupon_id": 89613996,
  "expiration_date": "2019-12-31 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": 20,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "new_campaign",
  "coupon_code": "ddgf5bn4",
  "coupon_id": 89613996,
  "expiration_date": "2019-12-31 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": 20,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "new_campaign",
  "coupon_code": "ddgf5bn4",
  "coupon_id": 89613996,
  "expiration_date": "2019-12-31 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": 20,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "new_campaign",
  "coupon_code": "ddgf5bn4",
  "coupon_id": 89613996,
  "expiration_date": "2019-12-31 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": 20,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "new_campaign",
  "coupon_code": "ddgf5bn4",
  "coupon_id": 89613996,
  "expiration_date": "2019-12-31 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": 20,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "new_campaign",
  "coupon_code": "ddgf5bn4",
  "coupon_id": 89613996,
  "expiration_date": "2019-12-31 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": 20,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "new_campaign",
  "coupon_code": "ddgf5bn4",
  "coupon_id": 89613996,
  "expiration_date": "2019-12-31 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": 20,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}
{
  "campaign_code": "new_campaign",
  "coupon_code": "ddgf5bn4",
  "coupon_id": 89613996,
  "expiration_date": "2019-12-31 00:00:00",
  "is_active": 1,
  "project_id": 12345,
  "redeems_count_for_user": 10,
  "redeems_count_remain": 20,
  "subscription_coupon": null,
  "virtual_currency_amount": 100,
  "virtual_items": []
}

Kampagne erstellen

Erstellen Sie einen Gutschein für eine Kampagne.

HTTP-ANFRAGE

POST https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions

ParameterTypBeschreibung
merchant_id
integerHändler-ID. Erforderlich.
campaign_code
stringKampagnenname. Erforderlich.
project_id
integerProjekt-ID. Erforderlich.
campaign_names
objectObjekt, das lokalisierte Kampagnennamen enthält. Erforderlich.
expiration_date
datetimeDas Ablaufdatum im JJJJ-MM-TT'Z'HH:MM:SS-Format laut ISO 8601.
virtual_currency_amount
floatBetrag der virtuellen Währung in einer Belohnung.
virtual_items
arrayArray von virtuellen Gegenständen in einer Belohnung.
virtual_items.sku
stringSKU des virtuellen Gegenstands. Erforderlich bei der Übermittlung des virtual_items-Arrays.
virtual_items.quantity
integerAnzahl der virtuellen Gegenstände. Erforderlich bei der Übermittlung des virtual_items-Arrays.
subscription_coupon
objectObjekt, das die Abo-Parameter einer Belohnung enthält.
subscription_coupon.plan_id
integerAbo-Modell-ID. Erforderlich, falls das subscription_coupon-Objekt übermittelt wird.
subscription_coupon.product_id
integerAbo-Produkt-ID. Erforderlich bei der Übermittlung des subscription_coupon-Objekts.
trial_period
integerProbezeitraum in Tagen. Erforderlich bei der Übermittlung des subscription_coupon-Objekts.
redeems_count
integerMaximale Anzahl der Gutscheine zum Einlösen. Wenn ‘null’ bestanden wurde, ist die Anzahl Gutscheine unbeschränkt.
redeems_count_for_user
integerMaximale Anzahl der einlösbaren Gutscheine pro Nutzer. Wenn ‘null’ übermittelt wurde, ist die Anzahl der einlösbaren Gutscheine unbeschränkt.
campaign_redeems_count_for_user
integerMaximale Anzahl der Gutscheine, die ein Benutzer innerhalb einer Kampagne einlösen kann. Wenn ’null’ bestanden wurde, ist die Anzahl Gutscheine unbeschränkt.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
POST https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "campaign_code": "sample_campaign",
  "campaign_names": {
    "en": "Campaign Name",
    "ru": "Название кампании"
  },
  "campaign_redeems_count_for_user": "1",
  "expiration_date": "2019-12-31",
  "project_id": "12345",
  "redeems_count": "10",
  "redeems_count_for_user": "1",
  "subscription_coupon": null,
  "virtual_currency_amount": "100"
}
curl --request POST \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"campaign_code":"sample_campaign","project_id":"12345","campaign_names":{"en":"Campaign Name","ru":"Название кампании"},"expiration_date":"2019-12-31","redeems_count":"10","redeems_count_for_user":"1","campaign_redeems_count_for_user":"1","virtual_currency_amount":"100","subscription_coupon":null}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"campaign_code":"sample_campaign","project_id":"12345","campaign_names":{"en":"Campaign Name","ru":"Название кампании"},"expiration_date":"2019-12-31","redeems_count":"10","redeems_count_for_user":"1","campaign_redeems_count_for_user":"1","virtual_currency_amount":"100","subscription_coupon":null}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"campaign_code\":\"sample_campaign\",\"project_id\":\"12345\",\"campaign_names\":{\"en\":\"Campaign Name\",\"ru\":\"Название кампании\"},\"expiration_date\":\"2019-12-31\",\"redeems_count\":\"10\",\"redeems_count_for_user\":\"1\",\"campaign_redeems_count_for_user\":\"1\",\"virtual_currency_amount\":\"100\",\"subscription_coupon\":null}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"campaign_code\":\"sample_campaign\",\"project_id\":\"12345\",\"campaign_names\":{\"en\":\"Campaign Name\",\"ru\":\"Название кампании\"},\"expiration_date\":\"2019-12-31\",\"redeems_count\":\"10\",\"redeems_count_for_user\":\"1\",\"campaign_redeems_count_for_user\":\"1\",\"virtual_currency_amount\":\"100\",\"subscription_coupon\":null}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("POST", "/merchant/v2/merchants/{merchant_id}/coupon_promotions", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"campaign_code\":\"sample_campaign\",\"project_id\":\"12345\",\"campaign_names\":{\"en\":\"Campaign Name\",\"ru\":\"Название кампании\"},\"expiration_date\":\"2019-12-31\",\"redeems_count\":\"10\",\"redeems_count_for_user\":\"1\",\"campaign_redeems_count_for_user\":\"1\",\"virtual_currency_amount\":\"100\",\"subscription_coupon\":null}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"campaign_code\":\"sample_campaign\",\"project_id\":\"12345\",\"campaign_names\":{\"en\":\"Campaign Name\",\"ru\":\"Название кампании\"},\"expiration_date\":\"2019-12-31\",\"redeems_count\":\"10\",\"redeems_count_for_user\":\"1\",\"campaign_redeems_count_for_user\":\"1\",\"virtual_currency_amount\":\"100\",\"subscription_coupon\":null}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions")
  .post(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "campaign_code": "sample_campaign",
  "project_id": "12345",
  "campaign_names": {
    "en": "Campaign Name",
    "ru": "Название кампании"
  },
  "expiration_date": "2019-12-31",
  "redeems_count": "10",
  "redeems_count_for_user": "1",
  "campaign_redeems_count_for_user": "1",
  "virtual_currency_amount": "100",
  "subscription_coupon": null
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
{
  "id": 9134
}
{
  "id": 9134
}
{
  "id": 9134
}
{
  "id": 9134
}
{
  "id": 9134
}
{
  "id": 9134
}
{
  "id": 9134
}
{
  "id": 9134
}

Gutschein zur Kampagne hinzufügen

Fügen Sie einen Gutscheincode zu einer Kampagne hinzu.

HTTP-ANFRAGE

POST https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions/{campaign_id}/coupons

ParameterTypBeschreibung
merchant_id
integerHändler-ID. Erforderlich.
campaign_id
integerKampagnen-ID. Erforderlich.
coupon_code
stringGutscheincode. Erforderlich.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
POST https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions/{campaign_id}/coupons

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "coupon_code": "34bryrb3"
}
curl --request POST \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions/{campaign_id}/coupons \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"coupon_code":"34bryrb3"}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"coupon_code":"34bryrb3"}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions/{campaign_id}/coupons');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions/{campaign_id}/coupons");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"coupon_code\":\"34bryrb3\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"coupon_code\":\"34bryrb3\"}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("POST", "/merchant/v2/merchants/{merchant_id}/coupon_promotions/{campaign_id}/coupons", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions/{campaign_id}/coupons")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"coupon_code\":\"34bryrb3\"}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"coupon_code\":\"34bryrb3\"}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions/{campaign_id}/coupons")
  .post(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "coupon_code": "34bryrb3"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/coupon_promotions/{campaign_id}/coupons");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort


Kampagne mit einer Werbeaktion verbinden

Verbinden Sie einen Gutschein für eine Kampagne mit einer bestimmten Werbeaktion.

HTTP-ANFRAGE

PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/coupons

ParameterTypBeschreibung
merchant_id
integerHändler-ID. Erforderlich.
promotion_id
integerID der Werbeaktion. Erforderlich.
campaigns
array of integersArray von Kampagnen-IDs. Erforderlich.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/coupons?campaigns=1234

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "campaigns": [
    9135
  ]
}
curl --request PUT \
  --url 'https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/coupons?campaigns=1234' \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"campaigns":[9135]}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"campaigns":[9135]}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/coupons');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setQuery(new http\QueryString(array(
  'campaigns' => '1234'
)));

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/coupons?campaigns=1234");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"campaigns\":[9135]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"campaigns\":[9135]}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/coupons?campaigns=1234", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/coupons?campaigns=1234")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"campaigns\":[9135]}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"campaigns\":[9135]}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/coupons?campaigns=1234")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "campaigns": [
    9135
  ]
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/coupons?campaigns=1234");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort


Werbeaktionen

Werbeaktion anlegen

Legt eine neue Werbeaktion an.

HTTP-ANFRAGE

POST https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
technical_name
stringArbeitstitel der Werbeaktion.
label
array of stringsArray der lokalisierten Kennzeichnungen, die im Zahlungsportal angezeigt werden.
name
array of stringsArray der lokalisierten Bezeichnungen der Werbeaktion.
description
array of stringsArray der lokalisierten Werbeaktionsbeschreibungen.
project_id
integerProjekt-ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
POST https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions

Headers:
Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "description": {
    "en": "Promotion with 30% discount",
    "ru": "Акция со скидкой 30%"
  },
  "label": {
    "en": "30%",
    "ru": "30%"
  },
  "name": {
    "en": "30% discount",
    "ru": "скидка 30%"
  },
  "project_id": 12345,
  "technical_name": "Sale promotion"
}
curl --request POST \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"name":{"en":"30% discount","ru":"скидка 30%"},"description":{"en":"Promotion with 30% discount","ru":"Акция со скидкой 30%"},"label":{"en":"30%","ru":"30%"},"technical_name":"Sale promotion","project_id":12345}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"name":{"en":"30% discount","ru":"скидка 30%"},"description":{"en":"Promotion with 30% discount","ru":"Акция со скидкой 30%"},"label":{"en":"30%","ru":"30%"},"technical_name":"Sale promotion","project_id":12345}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"name\":{\"en\":\"30% discount\",\"ru\":\"скидка 30%\"},\"description\":{\"en\":\"Promotion with 30% discount\",\"ru\":\"Акция со скидкой 30%\"},\"label\":{\"en\":\"30%\",\"ru\":\"30%\"},\"technical_name\":\"Sale promotion\",\"project_id\":12345}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"name\":{\"en\":\"30% discount\",\"ru\":\"скидка 30%\"},\"description\":{\"en\":\"Promotion with 30% discount\",\"ru\":\"Акция со скидкой 30%\"},\"label\":{\"en\":\"30%\",\"ru\":\"30%\"},\"technical_name\":\"Sale promotion\",\"project_id\":12345}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("POST", "/merchant/v2/merchants/{merchant_id}/promotions", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"name\":{\"en\":\"30% discount\",\"ru\":\"скидка 30%\"},\"description\":{\"en\":\"Promotion with 30% discount\",\"ru\":\"Акция со скидкой 30%\"},\"label\":{\"en\":\"30%\",\"ru\":\"30%\"},\"technical_name\":\"Sale promotion\",\"project_id\":12345}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"name\":{\"en\":\"30% discount\",\"ru\":\"скидка 30%\"},\"description\":{\"en\":\"Promotion with 30% discount\",\"ru\":\"Акция со скидкой 30%\"},\"label\":{\"en\":\"30%\",\"ru\":\"30%\"},\"technical_name\":\"Sale promotion\",\"project_id\":12345}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions")
  .post(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "name": {
    "en": "30% discount",
    "ru": "скидка 30%"
  },
  "description": {
    "en": "Promotion with 30% discount",
    "ru": "Акция со скидкой 30%"
  },
  "label": {
    "en": "30%",
    "ru": "30%"
  },
  "technical_name": "Sale promotion",
  "project_id": 12345
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
{
  "id": 17890
}
{
  "id": 17890
}
{
  "id": 17890
}
{
  "id": 17890
}
{
  "id": 17890
}
{
  "id": 17890
}
{
  "id": 17890
}
{
  "id": 17890
}

Werbeaktion anfordern

Ruft eine Werbeaktion auf.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
promotion_id
integerID der Werbeaktion.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/ \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
{
  "description": {
    "en": "Promotion with 30% discount",
    "ru": "Акция со скидкой 30%"
  },
  "enabled": false,
  "id": 17890,
  "label": {
    "en": "30%",
    "ru": "30%"
  },
  "name": {
    "en": "30% discount",
    "ru": "Скидка 30%"
  },
  "project_id": 40544,
  "read_only": false,
  "show_banner": true,
  "technical_name": "Sale promotion"
}
{
  "description": {
    "en": "Promotion with 30% discount",
    "ru": "Акция со скидкой 30%"
  },
  "enabled": false,
  "id": 17890,
  "label": {
    "en": "30%",
    "ru": "30%"
  },
  "name": {
    "en": "30% discount",
    "ru": "Скидка 30%"
  },
  "project_id": 40544,
  "read_only": false,
  "show_banner": true,
  "technical_name": "Sale promotion"
}
{
  "description": {
    "en": "Promotion with 30% discount",
    "ru": "Акция со скидкой 30%"
  },
  "enabled": false,
  "id": 17890,
  "label": {
    "en": "30%",
    "ru": "30%"
  },
  "name": {
    "en": "30% discount",
    "ru": "Скидка 30%"
  },
  "project_id": 40544,
  "read_only": false,
  "show_banner": true,
  "technical_name": "Sale promotion"
}
{
  "description": {
    "en": "Promotion with 30% discount",
    "ru": "Акция со скидкой 30%"
  },
  "enabled": false,
  "id": 17890,
  "label": {
    "en": "30%",
    "ru": "30%"
  },
  "name": {
    "en": "30% discount",
    "ru": "Скидка 30%"
  },
  "project_id": 40544,
  "read_only": false,
  "show_banner": true,
  "technical_name": "Sale promotion"
}
{
  "description": {
    "en": "Promotion with 30% discount",
    "ru": "Акция со скидкой 30%"
  },
  "enabled": false,
  "id": 17890,
  "label": {
    "en": "30%",
    "ru": "30%"
  },
  "name": {
    "en": "30% discount",
    "ru": "Скидка 30%"
  },
  "project_id": 40544,
  "read_only": false,
  "show_banner": true,
  "technical_name": "Sale promotion"
}
{
  "description": {
    "en": "Promotion with 30% discount",
    "ru": "Акция со скидкой 30%"
  },
  "enabled": false,
  "id": 17890,
  "label": {
    "en": "30%",
    "ru": "30%"
  },
  "name": {
    "en": "30% discount",
    "ru": "Скидка 30%"
  },
  "project_id": 40544,
  "read_only": false,
  "show_banner": true,
  "technical_name": "Sale promotion"
}
{
  "description": {
    "en": "Promotion with 30% discount",
    "ru": "Акция со скидкой 30%"
  },
  "enabled": false,
  "id": 17890,
  "label": {
    "en": "30%",
    "ru": "30%"
  },
  "name": {
    "en": "30% discount",
    "ru": "Скидка 30%"
  },
  "project_id": 40544,
  "read_only": false,
  "show_banner": true,
  "technical_name": "Sale promotion"
}
{
  "description": {
    "en": "Promotion with 30% discount",
    "ru": "Акция со скидкой 30%"
  },
  "enabled": false,
  "id": 17890,
  "label": {
    "en": "30%",
    "ru": "30%"
  },
  "name": {
    "en": "30% discount",
    "ru": "Скидка 30%"
  },
  "project_id": 40544,
  "read_only": false,
  "show_banner": true,
  "technical_name": "Sale promotion"
}

Werbeaktion aktualisieren

Aktualisiert eine Werbeaktion. Falls die Werbeaktion schreibgeschützt ist (read_only = true), können Sie den Parameter "project_id" nicht ändern.

HTTP-ANFRAGE

PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
promotion_id
integerID der Werbeaktion.
technical_name
stringArbeitstitel der Werbeaktion.
label
array of stringsArray der lokalisierten Kennzeichnungen, die im Zahlungsportal angezeigt werden.
name
array of stringsArray der lokalisierten Bezeichnungen der Werbeaktion.
description
array of stringsArray der lokalisierten Werbeaktionsbeschreibungen.
project_id
integerProjekt-ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/

Headers:
Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "description": {
    "en": "Promotion with 5% discount",
    "ru": "Акция со скидкой 5%"
  },
  "label": {
    "en": "5%",
    "ru": "5%"
  },
  "name": {
    "en": "5% discount",
    "ru": "скидка 5%"
  },
  "project_id": 40544,
  "technical_name": "Sale promotion"
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/ \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"description":{"en":"Promotion with 5% discount","ru":"Акция со скидкой 5%"},"label":{"en":"5%","ru":"5%"},"name":{"en":"5% discount","ru":"скидка 5%"},"technical_name":"Sale promotion","project_id":40544}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"description":{"en":"Promotion with 5% discount","ru":"Акция со скидкой 5%"},"label":{"en":"5%","ru":"5%"},"name":{"en":"5% discount","ru":"скидка 5%"},"technical_name":"Sale promotion","project_id":40544}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"description\":{\"en\":\"Promotion with 5% discount\",\"ru\":\"Акция со скидкой 5%\"},\"label\":{\"en\":\"5%\",\"ru\":\"5%\"},\"name\":{\"en\":\"5% discount\",\"ru\":\"скидка 5%\"},\"technical_name\":\"Sale promotion\",\"project_id\":40544}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"description\":{\"en\":\"Promotion with 5% discount\",\"ru\":\"Акция со скидкой 5%\"},\"label\":{\"en\":\"5%\",\"ru\":\"5%\"},\"name\":{\"en\":\"5% discount\",\"ru\":\"скидка 5%\"},\"technical_name\":\"Sale promotion\",\"project_id\":40544}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"description\":{\"en\":\"Promotion with 5% discount\",\"ru\":\"Акция со скидкой 5%\"},\"label\":{\"en\":\"5%\",\"ru\":\"5%\"},\"name\":{\"en\":\"5% discount\",\"ru\":\"скидка 5%\"},\"technical_name\":\"Sale promotion\",\"project_id\":40544}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"description\":{\"en\":\"Promotion with 5% discount\",\"ru\":\"Акция со скидкой 5%\"},\"label\":{\"en\":\"5%\",\"ru\":\"5%\"},\"name\":{\"en\":\"5% discount\",\"ru\":\"скидка 5%\"},\"technical_name\":\"Sale promotion\",\"project_id\":40544}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "description": {
    "en": "Promotion with 5% discount",
    "ru": "Акция со скидкой 5%"
  },
  "label": {
    "en": "5%",
    "ru": "5%"
  },
  "name": {
    "en": "5% discount",
    "ru": "скидка 5%"
  },
  "technical_name": "Sale promotion",
  "project_id": 40544
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort


Werbeaktion überprüfen

Sie müssen eine Werbeaktion vor der Aktivierung überprüfen. Diese Methode liefert gegebenenfalls eine Liste der Fehler.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/review

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
promotion_id
integerID der Werbeaktion.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/review

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/review \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/review');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/review");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/review", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/review")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/review")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/review");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
[
  {
    "component": "rewards",
    "message": "Please select a reward"
  }
]
[
  {
    "component": "rewards",
    "message": "Please select a reward"
  }
]
[
  {
    "component": "rewards",
    "message": "Please select a reward"
  }
]
[
  {
    "component": "rewards",
    "message": "Please select a reward"
  }
]
[
  {
    "component": "rewards",
    "message": "Please select a reward"
  }
]
[
  {
    "component": "rewards",
    "message": "Please select a reward"
  }
]
[
  {
    "component": "rewards",
    "message": "Please select a reward"
  }
]
[
  {
    "component": "rewards",
    "message": "Please select a reward"
  }
]

Werbeaktion zu-/abschalten

Schaltet den Status einer Werbeaktion von aktiv auf inaktiv bzw. von inaktiv auf aktiv.

HTTP-ANFRAGE

PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/toggle

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
promotion_id
integerID der Werbeaktion.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/toggle

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/toggle \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/toggle');
$request->setRequestMethod('PUT');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/toggle");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/toggle", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/toggle")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/toggle")
  .put(null)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/toggle");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort


Werbeaktion löschen

Löscht eine Werbeaktion. Sie können Werbeaktionen nur dann löschen, wenn dem Parameter 'enabled' der Wert 'false' zugeteilt wurde.

HTTP-ANFRAGE

DELETE https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
promotion_id
integerID der Werbeaktion.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
DELETE https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request DELETE \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/ \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/');
$request->setRequestMethod('DELETE');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/");
var request = new RestRequest(Method.DELETE);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("DELETE", "/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/")
  .delete(null)
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort


Liste der Werbeaktionen abrufen

Listet alle Werbeaktionen auf.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions

Headers:
Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/merchants/{merchant_id}/promotions", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
[
  {
    "datetime": {
      "from": "2020-02-02T00:00:00+04:00",
      "to": "-0001-11-30T01:28:41+04:00"
    },
    "enabled": true,
    "id": 17840,
    "is_active": true,
    "is_infinite": false,
    "project": {
      "id": 12345,
      "localized_name": "Christmas sale"
    },
    "read_only": false,
    "technical_name": "christmas"
  },
  {
    "datetime": null,
    "enabled": false,
    "id": 17891,
    "is_active": false,
    "is_infinite": true,
    "project": {
      "id": 12345,
      "localized_name": "30% discount"
    },
    "read_only": false,
    "technical_name": "Sale promotion"
  }
]
[
  {
    "datetime": {
      "from": "2020-02-02T00:00:00+04:00",
      "to": "-0001-11-30T01:28:41+04:00"
    },
    "enabled": true,
    "id": 17840,
    "is_active": true,
    "is_infinite": false,
    "project": {
      "id": 12345,
      "localized_name": "Christmas sale"
    },
    "read_only": false,
    "technical_name": "christmas"
  },
  {
    "datetime": null,
    "enabled": false,
    "id": 17891,
    "is_active": false,
    "is_infinite": true,
    "project": {
      "id": 12345,
      "localized_name": "30% discount"
    },
    "read_only": false,
    "technical_name": "Sale promotion"
  }
]
[
  {
    "datetime": {
      "from": "2020-02-02T00:00:00+04:00",
      "to": "-0001-11-30T01:28:41+04:00"
    },
    "enabled": true,
    "id": 17840,
    "is_active": true,
    "is_infinite": false,
    "project": {
      "id": 12345,
      "localized_name": "Christmas sale"
    },
    "read_only": false,
    "technical_name": "christmas"
  },
  {
    "datetime": null,
    "enabled": false,
    "id": 17891,
    "is_active": false,
    "is_infinite": true,
    "project": {
      "id": 12345,
      "localized_name": "30% discount"
    },
    "read_only": false,
    "technical_name": "Sale promotion"
  }
]
[
  {
    "datetime": {
      "from": "2020-02-02T00:00:00+04:00",
      "to": "-0001-11-30T01:28:41+04:00"
    },
    "enabled": true,
    "id": 17840,
    "is_active": true,
    "is_infinite": false,
    "project": {
      "id": 12345,
      "localized_name": "Christmas sale"
    },
    "read_only": false,
    "technical_name": "christmas"
  },
  {
    "datetime": null,
    "enabled": false,
    "id": 17891,
    "is_active": false,
    "is_infinite": true,
    "project": {
      "id": 12345,
      "localized_name": "30% discount"
    },
    "read_only": false,
    "technical_name": "Sale promotion"
  }
]
[
  {
    "datetime": {
      "from": "2020-02-02T00:00:00+04:00",
      "to": "-0001-11-30T01:28:41+04:00"
    },
    "enabled": true,
    "id": 17840,
    "is_active": true,
    "is_infinite": false,
    "project": {
      "id": 12345,
      "localized_name": "Christmas sale"
    },
    "read_only": false,
    "technical_name": "christmas"
  },
  {
    "datetime": null,
    "enabled": false,
    "id": 17891,
    "is_active": false,
    "is_infinite": true,
    "project": {
      "id": 12345,
      "localized_name": "30% discount"
    },
    "read_only": false,
    "technical_name": "Sale promotion"
  }
]
[
  {
    "datetime": {
      "from": "2020-02-02T00:00:00+04:00",
      "to": "-0001-11-30T01:28:41+04:00"
    },
    "enabled": true,
    "id": 17840,
    "is_active": true,
    "is_infinite": false,
    "project": {
      "id": 12345,
      "localized_name": "Christmas sale"
    },
    "read_only": false,
    "technical_name": "christmas"
  },
  {
    "datetime": null,
    "enabled": false,
    "id": 17891,
    "is_active": false,
    "is_infinite": true,
    "project": {
      "id": 12345,
      "localized_name": "30% discount"
    },
    "read_only": false,
    "technical_name": "Sale promotion"
  }
]
[
  {
    "datetime": {
      "from": "2020-02-02T00:00:00+04:00",
      "to": "-0001-11-30T01:28:41+04:00"
    },
    "enabled": true,
    "id": 17840,
    "is_active": true,
    "is_infinite": false,
    "project": {
      "id": 12345,
      "localized_name": "Christmas sale"
    },
    "read_only": false,
    "technical_name": "christmas"
  },
  {
    "datetime": null,
    "enabled": false,
    "id": 17891,
    "is_active": false,
    "is_infinite": true,
    "project": {
      "id": 12345,
      "localized_name": "30% discount"
    },
    "read_only": false,
    "technical_name": "Sale promotion"
  }
]
[
  {
    "datetime": {
      "from": "2020-02-02T00:00:00+04:00",
      "to": "-0001-11-30T01:28:41+04:00"
    },
    "enabled": true,
    "id": 17840,
    "is_active": true,
    "is_infinite": false,
    "project": {
      "id": 12345,
      "localized_name": "Christmas sale"
    },
    "read_only": false,
    "technical_name": "christmas"
  },
  {
    "datetime": null,
    "enabled": false,
    "id": 17891,
    "is_active": false,
    "is_infinite": true,
    "project": {
      "id": 12345,
      "localized_name": "30% discount"
    },
    "read_only": false,
    "technical_name": "Sale promotion"
  }
]

Thema festlegen

Legt das Thema einer Werbeaktion fest. Falls die Werbeaktion schreibgeschützt ist (read_only = true), können Sie das Thema nicht aktualisieren. Das Thema kann folgende Werte annehmen: 'purchase', 'items', 'packages'.

HTTP-ANFRAGE

PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
promotion_id
integerID der Werbeaktion.
purchase
booleanLegt fest, ob die Werbeaktion auf den gesamten Einkauf zutrifft.
items
arrayArray der virtuellen Gegenstände, die bei der Werbeaktion zum Einsatz kommen.
items.sku
stringSKU des Gegenstands.
packages
arrayArray der Angebotspakete mit virtueller Währung, die bei der Werbeaktion zum Einsatz kommen.
subscriptions
objectAbo-Modelle oder Produkte, die bei der Werbeaktion zum Einsatz kommen.
subscriptions.plans
arrayArray der Abo-Modelle, die bei der Werbeaktion zum Einsatz kommen.
subscriptions.products
arrayArray der Produkte, die auf Abonnements basieren und bei der Werbeaktion zum Einsatz kommen.
subscriptions.max_charges_count
integerMaximale Anzahl an Abrechnungen, die bei der Werbeaktion möglich sein soll.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject

Headers:
Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "digital_contents": null,
  "items": [
    {
      "id": 163109,
      "localized_name": "t-34",
      "sku": "1234"
    }
  ],
  "packages": null,
  "purchase": false,
  "subscriptions": null
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"purchase":false,"items":[{"id":163109,"sku":"1234","localized_name":"t-34"}],"packages":null,"subscriptions":null,"digital_contents":null}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"purchase":false,"items":[{"id":163109,"sku":"1234","localized_name":"t-34"}],"packages":null,"subscriptions":null,"digital_contents":null}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"purchase\":false,\"items\":[{\"id\":163109,\"sku\":\"1234\",\"localized_name\":\"t-34\"}],\"packages\":null,\"subscriptions\":null,\"digital_contents\":null}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"purchase\":false,\"items\":[{\"id\":163109,\"sku\":\"1234\",\"localized_name\":\"t-34\"}],\"packages\":null,\"subscriptions\":null,\"digital_contents\":null}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"purchase\":false,\"items\":[{\"id\":163109,\"sku\":\"1234\",\"localized_name\":\"t-34\"}],\"packages\":null,\"subscriptions\":null,\"digital_contents\":null}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"purchase\":false,\"items\":[{\"id\":163109,\"sku\":\"1234\",\"localized_name\":\"t-34\"}],\"packages\":null,\"subscriptions\":null,\"digital_contents\":null}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "purchase": false,
  "items": [
    {
      "id": 163109,
      "sku": "1234",
      "localized_name": "t-34"
    }
  ],
  "packages": null,
  "subscriptions": null,
  "digital_contents": null
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort


Thema anfordern

Fordert Informationen zum Thema der Werbeaktion an.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
promotion_id
integerID der Werbeaktion.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/subject");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
{
  "digital_contents": null,
  "id": 178,
  "items": [
    {
      "id": 1609,
      "localized_name": "T-34-3",
      "sku": "1234"
    }
  ],
  "packages": null,
  "purchase": false,
  "subscriptions": null
}
{
  "digital_contents": null,
  "id": 178,
  "items": [
    {
      "id": 1609,
      "localized_name": "T-34-3",
      "sku": "1234"
    }
  ],
  "packages": null,
  "purchase": false,
  "subscriptions": null
}
{
  "digital_contents": null,
  "id": 178,
  "items": [
    {
      "id": 1609,
      "localized_name": "T-34-3",
      "sku": "1234"
    }
  ],
  "packages": null,
  "purchase": false,
  "subscriptions": null
}
{
  "digital_contents": null,
  "id": 178,
  "items": [
    {
      "id": 1609,
      "localized_name": "T-34-3",
      "sku": "1234"
    }
  ],
  "packages": null,
  "purchase": false,
  "subscriptions": null
}
{
  "digital_contents": null,
  "id": 178,
  "items": [
    {
      "id": 1609,
      "localized_name": "T-34-3",
      "sku": "1234"
    }
  ],
  "packages": null,
  "purchase": false,
  "subscriptions": null
}
{
  "digital_contents": null,
  "id": 178,
  "items": [
    {
      "id": 1609,
      "localized_name": "T-34-3",
      "sku": "1234"
    }
  ],
  "packages": null,
  "purchase": false,
  "subscriptions": null
}
{
  "digital_contents": null,
  "id": 178,
  "items": [
    {
      "id": 1609,
      "localized_name": "T-34-3",
      "sku": "1234"
    }
  ],
  "packages": null,
  "purchase": false,
  "subscriptions": null
}
{
  "digital_contents": null,
  "id": 178,
  "items": [
    {
      "id": 1609,
      "localized_name": "T-34-3",
      "sku": "1234"
    }
  ],
  "packages": null,
  "purchase": false,
  "subscriptions": null
}

Zahlungssysteme festlegen

Legt die für eine Werbeaktion unterstützten Zahlungssysteme fest. Falls die Liste leer ist, können alle Zahlungssysteme für die Werbeaktion verwendet werden. Falls die Werbeaktion schreibgeschützt ist (read_only = true), können Sie diese Methode nicht aufrufen.

HTTP-ANFRAGE

PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
promotion_id
integerID der Werbeaktion.
payment_systems
arrayZahlungssysteme (array).
id
integerID des Zahlungssystems.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "payment_systems": [
    {
      "id": 24,
      "name": "PayPal"
    }
  ]
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"payment_systems":[{"id":24,"name":"PayPal"}]}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"payment_systems":[{"id":24,"name":"PayPal"}]}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"payment_systems\":[{\"id\":24,\"name\":\"PayPal\"}]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"payment_systems\":[{\"id\":24,\"name\":\"PayPal\"}]}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"payment_systems\":[{\"id\":24,\"name\":\"PayPal\"}]}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"payment_systems\":[{\"id\":24,\"name\":\"PayPal\"}]}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "payment_systems": [
    {
      "id": 24,
      "name": "PayPal"
    }
  ]
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort


Zahlungssysteme auflisten

Fordert die für eine Werbeaktion unterstützten Zahlungssysteme an. Falls die Liste leer ist, können alle Zahlungssysteme für die Werbeaktion verwendet werden.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
promotion_id
integerID der Werbeaktion.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/payment_systems");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
{
  "id": 17840,
  "payment_systems": [
    {
      "id": 27,
      "name": "Yandex.Money"
    }
  ]
}
{
  "id": 17840,
  "payment_systems": [
    {
      "id": 27,
      "name": "Yandex.Money"
    }
  ]
}
{
  "id": 17840,
  "payment_systems": [
    {
      "id": 27,
      "name": "Yandex.Money"
    }
  ]
}
{
  "id": 17840,
  "payment_systems": [
    {
      "id": 27,
      "name": "Yandex.Money"
    }
  ]
}
{
  "id": 17840,
  "payment_systems": [
    {
      "id": 27,
      "name": "Yandex.Money"
    }
  ]
}
{
  "id": 17840,
  "payment_systems": [
    {
      "id": 27,
      "name": "Yandex.Money"
    }
  ]
}
{
  "id": 17840,
  "payment_systems": [
    {
      "id": 27,
      "name": "Yandex.Money"
    }
  ]
}
{
  "id": 17840,
  "payment_systems": [
    {
      "id": 27,
      "name": "Yandex.Money"
    }
  ]
}

Belohnungen festlegen

Legt Belohnungen für eine Werbeaktion fest. Falls die Werbeaktion schreibgeschützt ist (read_only = true), können Sie die Belohnungen nicht aktualisieren.

HTTP-ANFRAGE

PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
promotion_id
integerID der Werbeaktion.
purchase
objectLegt die Belohnung für den gesamten Einkauf fest.
purchase.discount_percent
floatProzentualer Rabatt.
package
objectLegt die Belohnung für ein virtuelles Währungspaket fest.
package.bonus_percent
floatBelohnung als Prozentsatz der Paketmenge.
package.bonus_amount
floatBelohnung als absolute Menge der virtuellen Währung.
item
objectLegt die Belohnung für bestimmte virtuelle Gegenstände fest.
item.discount
arrayRabatte für bestimmte virtuelle Gegenstände.
item.discount[].sku
stringSKU des Gegenstands.
item.discount[].discount_percent
floatProzentualer Rabatt.
item.discount[].max_amount
integerMaximale Anzahl an Gegenständen, die für die Werbeaktion verwendet wird.
item.bonus
arrayZusätzliche virtuelle Gegenstände, die als Bonus verteilt werden.
item.bonus[].sku
stringSKU des Gegenstands.
item.bonus[].amount
integerAnzahl der virtuellen Gegenstände, die als Bonus verteilt werden.
subscription
objectLegt die Belohnung für ein Abonnement fest.
subscription.trial_days
integerProbezeitraum in Tagen.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "item": {
    "bonus": [
      {
        "quantity": 2,
        "sku": "1234"
      }
    ],
    "discount": [
      {
        "discount_percent": 5,
        "max_amount": 10,
        "sku": "1234"
      }
    ]
  },
  "package": {
    "bonus_amount": 5,
    "bonus_percent": 5
  },
  "purchase": {
    "discount_percent": 10
  },
  "subscription": {
    "trial_days": 30
  }
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"purchase":{"discount_percent":10},"package":{"bonus_percent":5,"bonus_amount":5},"item":{"discount":[{"sku":"1234","max_amount":10,"discount_percent":5}],"bonus":[{"sku":"1234","quantity":2}]},"subscription":{"trial_days":30}}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"purchase":{"discount_percent":10},"package":{"bonus_percent":5,"bonus_amount":5},"item":{"discount":[{"sku":"1234","max_amount":10,"discount_percent":5}],"bonus":[{"sku":"1234","quantity":2}]},"subscription":{"trial_days":30}}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"purchase\":{\"discount_percent\":10},\"package\":{\"bonus_percent\":5,\"bonus_amount\":5},\"item\":{\"discount\":[{\"sku\":\"1234\",\"max_amount\":10,\"discount_percent\":5}],\"bonus\":[{\"sku\":\"1234\",\"quantity\":2}]},\"subscription\":{\"trial_days\":30}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"purchase\":{\"discount_percent\":10},\"package\":{\"bonus_percent\":5,\"bonus_amount\":5},\"item\":{\"discount\":[{\"sku\":\"1234\",\"max_amount\":10,\"discount_percent\":5}],\"bonus\":[{\"sku\":\"1234\",\"quantity\":2}]},\"subscription\":{\"trial_days\":30}}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"purchase\":{\"discount_percent\":10},\"package\":{\"bonus_percent\":5,\"bonus_amount\":5},\"item\":{\"discount\":[{\"sku\":\"1234\",\"max_amount\":10,\"discount_percent\":5}],\"bonus\":[{\"sku\":\"1234\",\"quantity\":2}]},\"subscription\":{\"trial_days\":30}}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"purchase\":{\"discount_percent\":10},\"package\":{\"bonus_percent\":5,\"bonus_amount\":5},\"item\":{\"discount\":[{\"sku\":\"1234\",\"max_amount\":10,\"discount_percent\":5}],\"bonus\":[{\"sku\":\"1234\",\"quantity\":2}]},\"subscription\":{\"trial_days\":30}}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "purchase": {
    "discount_percent": 10
  },
  "package": {
    "bonus_percent": 5,
    "bonus_amount": 5
  },
  "item": {
    "discount": [
      {
        "sku": "1234",
        "max_amount": 10,
        "discount_percent": 5
      }
    ],
    "bonus": [
      {
        "sku": "1234",
        "quantity": 2
      }
    ]
  },
  "subscription": {
    "trial_days": 30
  }
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort


Belohnungen abrufen

Ruft eine Liste der Belohnungen ab, die zur Werbeaktion gehören.

HTTP-ANFRAGE

GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
promotion_id
integerID der Werbeaktion.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/rewards");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Antwort
{
  "id": 17840,
  "item": {
    "bonus": [
      {
        "id": 163109,
        "localized_name": "T-34-3",
        "quantity": 2,
        "sku": "1234"
      }
    ],
    "discount": [
      {
        "discount_percent": 5,
        "localized_name": "T-34-3",
        "max_amount": 10,
        "sku": "1234"
      }
    ]
  },
  "package": {
    "bonus_amount": 5,
    "bonus_percent": 5
  },
  "purchase": {
    "discount_percent": 10
  },
  "subscription": {
    "trial_days": 30
  }
}
{
  "id": 17840,
  "item": {
    "bonus": [
      {
        "id": 163109,
        "localized_name": "T-34-3",
        "quantity": 2,
        "sku": "1234"
      }
    ],
    "discount": [
      {
        "discount_percent": 5,
        "localized_name": "T-34-3",
        "max_amount": 10,
        "sku": "1234"
      }
    ]
  },
  "package": {
    "bonus_amount": 5,
    "bonus_percent": 5
  },
  "purchase": {
    "discount_percent": 10
  },
  "subscription": {
    "trial_days": 30
  }
}
{
  "id": 17840,
  "item": {
    "bonus": [
      {
        "id": 163109,
        "localized_name": "T-34-3",
        "quantity": 2,
        "sku": "1234"
      }
    ],
    "discount": [
      {
        "discount_percent": 5,
        "localized_name": "T-34-3",
        "max_amount": 10,
        "sku": "1234"
      }
    ]
  },
  "package": {
    "bonus_amount": 5,
    "bonus_percent": 5
  },
  "purchase": {
    "discount_percent": 10
  },
  "subscription": {
    "trial_days": 30
  }
}
{
  "id": 17840,
  "item": {
    "bonus": [
      {
        "id": 163109,
        "localized_name": "T-34-3",
        "quantity": 2,
        "sku": "1234"
      }
    ],
    "discount": [
      {
        "discount_percent": 5,
        "localized_name": "T-34-3",
        "max_amount": 10,
        "sku": "1234"
      }
    ]
  },
  "package": {
    "bonus_amount": 5,
    "bonus_percent": 5
  },
  "purchase": {
    "discount_percent": 10
  },
  "subscription": {
    "trial_days": 30
  }
}
{
  "id": 17840,
  "item": {
    "bonus": [
      {
        "id": 163109,
        "localized_name": "T-34-3",
        "quantity": 2,
        "sku": "1234"
      }
    ],
    "discount": [
      {
        "discount_percent": 5,
        "localized_name": "T-34-3",
        "max_amount": 10,
        "sku": "1234"
      }
    ]
  },
  "package": {
    "bonus_amount": 5,
    "bonus_percent": 5
  },
  "purchase": {
    "discount_percent": 10
  },
  "subscription": {
    "trial_days": 30
  }
}
{
  "id": 17840,
  "item": {
    "bonus": [
      {
        "id": 163109,
        "localized_name": "T-34-3",
        "quantity": 2,
        "sku": "1234"
      }
    ],
    "discount": [
      {
        "discount_percent": 5,
        "localized_name": "T-34-3",
        "max_amount": 10,
        "sku": "1234"
      }
    ]
  },
  "package": {
    "bonus_amount": 5,
    "bonus_percent": 5
  },
  "purchase": {
    "discount_percent": 10
  },
  "subscription": {
    "trial_days": 30
  }
}
{
  "id": 17840,
  "item": {
    "bonus": [
      {
        "id": 163109,
        "localized_name": "T-34-3",
        "quantity": 2,
        "sku": "1234"
      }
    ],
    "discount": [
      {
        "discount_percent": 5,
        "localized_name": "T-34-3",
        "max_amount": 10,
        "sku": "1234"
      }
    ]
  },
  "package": {
    "bonus_amount": 5,
    "bonus_percent": 5
  },
  "purchase": {
    "discount_percent": 10
  },
  "subscription": {
    "trial_days": 30
  }
}
{
  "id": 17840,
  "item": {
    "bonus": [
      {
        "id": 163109,
        "localized_name": "T-34-3",
        "quantity": 2,
        "sku": "1234"
      }
    ],
    "discount": [
      {
        "discount_percent": 5,
        "localized_name": "T-34-3",
        "max_amount": 10,
        "sku": "1234"
      }
    ]
  },
  "package": {
    "bonus_amount": 5,
    "bonus_percent": 5
  },
  "purchase": {
    "discount_percent": 10
  },
  "subscription": {
    "trial_days": 30
  }
}

Geltungszeiträume festlegen

Legt Datumsbereiche/Zeiträume fest, in denen eine Werbeaktion aktiv geschaltet ist. Falls die Werbeaktion schreibgeschützt ist (read_only = true), können Sie zwar neue Zeiträume hinzufügen, aber keine bestehenden bearbeiten.

HTTP-ANFRAGE

PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/periods

ParameterTypBeschreibung
merchant_id
integerHändler-ID.
promotion_id
integerID der Werbeaktion.
periods
arrayDatumsbereiche/Zeiträume (Array).
from
datetimeBeginn des Zeitraums.
to
datetimeEnde des Zeitraums.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Anfrage
PUT https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/periods

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "periods": [
    {
      "from": "2019-03-01T00:00:00+04:00",
      "to": "2019-04-01T00:00:00+04:00"
    }
  ]
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}/periods \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"periods":[{"from":"2019-03-01T00:00:00+04:00","to":"2019-04-01T00:00:00+04:00"}]}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"periods":[{"from":"2019-03-01T00:00:00+04:00","to":"2019-04-01T00:00:00+04:00"}]}'