curl --request POST \
--url https://api.example.com/api/v1/purchase/register \
--header 'Content-Type: application/json' \
--header 'x-stash-hmac-signature: <api-key>' \
--data '
{
"playerId": "<string>",
"transactionId": "<string>",
"currency": "<string>",
"decimalPlaces": 123,
"registrations": [
{
"guid": "<string>",
"productId": "<string>",
"cents": 123,
"quantity": 123,
"purchasePackId": "<string>",
"metadata": {}
}
],
"checkoutLinkId": "<string>",
"shopId": "<string>",
"environment": "PAYMENT_ENVIRONMENT_UNSPECIFIED",
"platform": "PURCHASE_PLATFORM_UNSPECIFIED",
"browser": "<string>",
"deviceId": "<string>",
"source": "PURCHASE_SOURCE_UNSPECIFIED",
"ipAddress": "<string>",
"region": "<string>",
"loyalty": {
"campaignId": "<string>",
"totalPoints": 123,
"pointsDelta": 123,
"currentTierId": "<string>",
"previousTierId": "<string>",
"pointsToNextTier": 123,
"pointsToNextMilestone": 123,
"nextMilestone": {
"milestoneId": "<string>",
"rewards": [
{
"itemId": "<string>",
"quantity": 123,
"type": "LOYALTY_REWARD_TYPE_UNSPECIFIED"
}
]
},
"pointsMultiplierPermille": 123,
"unlockedMilestones": [
{
"milestoneId": "<string>",
"rewards": [
{
"itemId": "<string>",
"quantity": 123,
"type": "LOYALTY_REWARD_TYPE_UNSPECIFIED"
}
]
}
]
}
}
'import requests
url = "https://api.example.com/api/v1/purchase/register"
payload = {
"playerId": "<string>",
"transactionId": "<string>",
"currency": "<string>",
"decimalPlaces": 123,
"registrations": [
{
"guid": "<string>",
"productId": "<string>",
"cents": 123,
"quantity": 123,
"purchasePackId": "<string>",
"metadata": {}
}
],
"checkoutLinkId": "<string>",
"shopId": "<string>",
"environment": "PAYMENT_ENVIRONMENT_UNSPECIFIED",
"platform": "PURCHASE_PLATFORM_UNSPECIFIED",
"browser": "<string>",
"deviceId": "<string>",
"source": "PURCHASE_SOURCE_UNSPECIFIED",
"ipAddress": "<string>",
"region": "<string>",
"loyalty": {
"campaignId": "<string>",
"totalPoints": 123,
"pointsDelta": 123,
"currentTierId": "<string>",
"previousTierId": "<string>",
"pointsToNextTier": 123,
"pointsToNextMilestone": 123,
"nextMilestone": {
"milestoneId": "<string>",
"rewards": [
{
"itemId": "<string>",
"quantity": 123,
"type": "LOYALTY_REWARD_TYPE_UNSPECIFIED"
}
]
},
"pointsMultiplierPermille": 123,
"unlockedMilestones": [
{
"milestoneId": "<string>",
"rewards": [
{
"itemId": "<string>",
"quantity": 123,
"type": "LOYALTY_REWARD_TYPE_UNSPECIFIED"
}
]
}
]
}
}
headers = {
"x-stash-hmac-signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-stash-hmac-signature': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
playerId: '<string>',
transactionId: '<string>',
currency: '<string>',
decimalPlaces: 123,
registrations: [
{
guid: '<string>',
productId: '<string>',
cents: 123,
quantity: 123,
purchasePackId: '<string>',
metadata: {}
}
],
checkoutLinkId: '<string>',
shopId: '<string>',
environment: 'PAYMENT_ENVIRONMENT_UNSPECIFIED',
platform: 'PURCHASE_PLATFORM_UNSPECIFIED',
browser: '<string>',
deviceId: '<string>',
source: 'PURCHASE_SOURCE_UNSPECIFIED',
ipAddress: '<string>',
region: '<string>',
loyalty: {
campaignId: '<string>',
totalPoints: 123,
pointsDelta: 123,
currentTierId: '<string>',
previousTierId: '<string>',
pointsToNextTier: 123,
pointsToNextMilestone: 123,
nextMilestone: {
milestoneId: '<string>',
rewards: [{itemId: '<string>', quantity: 123, type: 'LOYALTY_REWARD_TYPE_UNSPECIFIED'}]
},
pointsMultiplierPermille: 123,
unlockedMilestones: [
{
milestoneId: '<string>',
rewards: [{itemId: '<string>', quantity: 123, type: 'LOYALTY_REWARD_TYPE_UNSPECIFIED'}]
}
]
}
})
};
fetch('https://api.example.com/api/v1/purchase/register', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/purchase/register",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'playerId' => '<string>',
'transactionId' => '<string>',
'currency' => '<string>',
'decimalPlaces' => 123,
'registrations' => [
[
'guid' => '<string>',
'productId' => '<string>',
'cents' => 123,
'quantity' => 123,
'purchasePackId' => '<string>',
'metadata' => [
]
]
],
'checkoutLinkId' => '<string>',
'shopId' => '<string>',
'environment' => 'PAYMENT_ENVIRONMENT_UNSPECIFIED',
'platform' => 'PURCHASE_PLATFORM_UNSPECIFIED',
'browser' => '<string>',
'deviceId' => '<string>',
'source' => 'PURCHASE_SOURCE_UNSPECIFIED',
'ipAddress' => '<string>',
'region' => '<string>',
'loyalty' => [
'campaignId' => '<string>',
'totalPoints' => 123,
'pointsDelta' => 123,
'currentTierId' => '<string>',
'previousTierId' => '<string>',
'pointsToNextTier' => 123,
'pointsToNextMilestone' => 123,
'nextMilestone' => [
'milestoneId' => '<string>',
'rewards' => [
[
'itemId' => '<string>',
'quantity' => 123,
'type' => 'LOYALTY_REWARD_TYPE_UNSPECIFIED'
]
]
],
'pointsMultiplierPermille' => 123,
'unlockedMilestones' => [
[
'milestoneId' => '<string>',
'rewards' => [
[
'itemId' => '<string>',
'quantity' => 123,
'type' => 'LOYALTY_REWARD_TYPE_UNSPECIFIED'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-stash-hmac-signature: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/purchase/register"
payload := strings.NewReader("{\n \"playerId\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"currency\": \"<string>\",\n \"decimalPlaces\": 123,\n \"registrations\": [\n {\n \"guid\": \"<string>\",\n \"productId\": \"<string>\",\n \"cents\": 123,\n \"quantity\": 123,\n \"purchasePackId\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"checkoutLinkId\": \"<string>\",\n \"shopId\": \"<string>\",\n \"environment\": \"PAYMENT_ENVIRONMENT_UNSPECIFIED\",\n \"platform\": \"PURCHASE_PLATFORM_UNSPECIFIED\",\n \"browser\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"source\": \"PURCHASE_SOURCE_UNSPECIFIED\",\n \"ipAddress\": \"<string>\",\n \"region\": \"<string>\",\n \"loyalty\": {\n \"campaignId\": \"<string>\",\n \"totalPoints\": 123,\n \"pointsDelta\": 123,\n \"currentTierId\": \"<string>\",\n \"previousTierId\": \"<string>\",\n \"pointsToNextTier\": 123,\n \"pointsToNextMilestone\": 123,\n \"nextMilestone\": {\n \"milestoneId\": \"<string>\",\n \"rewards\": [\n {\n \"itemId\": \"<string>\",\n \"quantity\": 123,\n \"type\": \"LOYALTY_REWARD_TYPE_UNSPECIFIED\"\n }\n ]\n },\n \"pointsMultiplierPermille\": 123,\n \"unlockedMilestones\": [\n {\n \"milestoneId\": \"<string>\",\n \"rewards\": [\n {\n \"itemId\": \"<string>\",\n \"quantity\": 123,\n \"type\": \"LOYALTY_REWARD_TYPE_UNSPECIFIED\"\n }\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-stash-hmac-signature", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/purchase/register")
.header("x-stash-hmac-signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"playerId\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"currency\": \"<string>\",\n \"decimalPlaces\": 123,\n \"registrations\": [\n {\n \"guid\": \"<string>\",\n \"productId\": \"<string>\",\n \"cents\": 123,\n \"quantity\": 123,\n \"purchasePackId\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"checkoutLinkId\": \"<string>\",\n \"shopId\": \"<string>\",\n \"environment\": \"PAYMENT_ENVIRONMENT_UNSPECIFIED\",\n \"platform\": \"PURCHASE_PLATFORM_UNSPECIFIED\",\n \"browser\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"source\": \"PURCHASE_SOURCE_UNSPECIFIED\",\n \"ipAddress\": \"<string>\",\n \"region\": \"<string>\",\n \"loyalty\": {\n \"campaignId\": \"<string>\",\n \"totalPoints\": 123,\n \"pointsDelta\": 123,\n \"currentTierId\": \"<string>\",\n \"previousTierId\": \"<string>\",\n \"pointsToNextTier\": 123,\n \"pointsToNextMilestone\": 123,\n \"nextMilestone\": {\n \"milestoneId\": \"<string>\",\n \"rewards\": [\n {\n \"itemId\": \"<string>\",\n \"quantity\": 123,\n \"type\": \"LOYALTY_REWARD_TYPE_UNSPECIFIED\"\n }\n ]\n },\n \"pointsMultiplierPermille\": 123,\n \"unlockedMilestones\": [\n {\n \"milestoneId\": \"<string>\",\n \"rewards\": [\n {\n \"itemId\": \"<string>\",\n \"quantity\": 123,\n \"type\": \"LOYALTY_REWARD_TYPE_UNSPECIFIED\"\n }\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/purchase/register")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-stash-hmac-signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"playerId\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"currency\": \"<string>\",\n \"decimalPlaces\": 123,\n \"registrations\": [\n {\n \"guid\": \"<string>\",\n \"productId\": \"<string>\",\n \"cents\": 123,\n \"quantity\": 123,\n \"purchasePackId\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"checkoutLinkId\": \"<string>\",\n \"shopId\": \"<string>\",\n \"environment\": \"PAYMENT_ENVIRONMENT_UNSPECIFIED\",\n \"platform\": \"PURCHASE_PLATFORM_UNSPECIFIED\",\n \"browser\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"source\": \"PURCHASE_SOURCE_UNSPECIFIED\",\n \"ipAddress\": \"<string>\",\n \"region\": \"<string>\",\n \"loyalty\": {\n \"campaignId\": \"<string>\",\n \"totalPoints\": 123,\n \"pointsDelta\": 123,\n \"currentTierId\": \"<string>\",\n \"previousTierId\": \"<string>\",\n \"pointsToNextTier\": 123,\n \"pointsToNextMilestone\": 123,\n \"nextMilestone\": {\n \"milestoneId\": \"<string>\",\n \"rewards\": [\n {\n \"itemId\": \"<string>\",\n \"quantity\": 123,\n \"type\": \"LOYALTY_REWARD_TYPE_UNSPECIFIED\"\n }\n ]\n },\n \"pointsMultiplierPermille\": 123,\n \"unlockedMilestones\": [\n {\n \"milestoneId\": \"<string>\",\n \"rewards\": [\n {\n \"itemId\": \"<string>\",\n \"quantity\": 123,\n \"type\": \"LOYALTY_REWARD_TYPE_UNSPECIFIED\"\n }\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"statuses": [
{
"status": "PURCHASE_REGISTRATION_STATUS_UNSPECIFIED",
"guid": "<string>",
"productId": "<string>",
"message": "<string>"
}
]
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Register payment intent
Step 1: Registers a purchase intent with the game backend. The game backend is expected to reserve inventory for the purchase. IMPORTANT: Always expects HTTP 200 OK response with inline error codes in the body.
curl --request POST \
--url https://api.example.com/api/v1/purchase/register \
--header 'Content-Type: application/json' \
--header 'x-stash-hmac-signature: <api-key>' \
--data '
{
"playerId": "<string>",
"transactionId": "<string>",
"currency": "<string>",
"decimalPlaces": 123,
"registrations": [
{
"guid": "<string>",
"productId": "<string>",
"cents": 123,
"quantity": 123,
"purchasePackId": "<string>",
"metadata": {}
}
],
"checkoutLinkId": "<string>",
"shopId": "<string>",
"environment": "PAYMENT_ENVIRONMENT_UNSPECIFIED",
"platform": "PURCHASE_PLATFORM_UNSPECIFIED",
"browser": "<string>",
"deviceId": "<string>",
"source": "PURCHASE_SOURCE_UNSPECIFIED",
"ipAddress": "<string>",
"region": "<string>",
"loyalty": {
"campaignId": "<string>",
"totalPoints": 123,
"pointsDelta": 123,
"currentTierId": "<string>",
"previousTierId": "<string>",
"pointsToNextTier": 123,
"pointsToNextMilestone": 123,
"nextMilestone": {
"milestoneId": "<string>",
"rewards": [
{
"itemId": "<string>",
"quantity": 123,
"type": "LOYALTY_REWARD_TYPE_UNSPECIFIED"
}
]
},
"pointsMultiplierPermille": 123,
"unlockedMilestones": [
{
"milestoneId": "<string>",
"rewards": [
{
"itemId": "<string>",
"quantity": 123,
"type": "LOYALTY_REWARD_TYPE_UNSPECIFIED"
}
]
}
]
}
}
'import requests
url = "https://api.example.com/api/v1/purchase/register"
payload = {
"playerId": "<string>",
"transactionId": "<string>",
"currency": "<string>",
"decimalPlaces": 123,
"registrations": [
{
"guid": "<string>",
"productId": "<string>",
"cents": 123,
"quantity": 123,
"purchasePackId": "<string>",
"metadata": {}
}
],
"checkoutLinkId": "<string>",
"shopId": "<string>",
"environment": "PAYMENT_ENVIRONMENT_UNSPECIFIED",
"platform": "PURCHASE_PLATFORM_UNSPECIFIED",
"browser": "<string>",
"deviceId": "<string>",
"source": "PURCHASE_SOURCE_UNSPECIFIED",
"ipAddress": "<string>",
"region": "<string>",
"loyalty": {
"campaignId": "<string>",
"totalPoints": 123,
"pointsDelta": 123,
"currentTierId": "<string>",
"previousTierId": "<string>",
"pointsToNextTier": 123,
"pointsToNextMilestone": 123,
"nextMilestone": {
"milestoneId": "<string>",
"rewards": [
{
"itemId": "<string>",
"quantity": 123,
"type": "LOYALTY_REWARD_TYPE_UNSPECIFIED"
}
]
},
"pointsMultiplierPermille": 123,
"unlockedMilestones": [
{
"milestoneId": "<string>",
"rewards": [
{
"itemId": "<string>",
"quantity": 123,
"type": "LOYALTY_REWARD_TYPE_UNSPECIFIED"
}
]
}
]
}
}
headers = {
"x-stash-hmac-signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-stash-hmac-signature': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
playerId: '<string>',
transactionId: '<string>',
currency: '<string>',
decimalPlaces: 123,
registrations: [
{
guid: '<string>',
productId: '<string>',
cents: 123,
quantity: 123,
purchasePackId: '<string>',
metadata: {}
}
],
checkoutLinkId: '<string>',
shopId: '<string>',
environment: 'PAYMENT_ENVIRONMENT_UNSPECIFIED',
platform: 'PURCHASE_PLATFORM_UNSPECIFIED',
browser: '<string>',
deviceId: '<string>',
source: 'PURCHASE_SOURCE_UNSPECIFIED',
ipAddress: '<string>',
region: '<string>',
loyalty: {
campaignId: '<string>',
totalPoints: 123,
pointsDelta: 123,
currentTierId: '<string>',
previousTierId: '<string>',
pointsToNextTier: 123,
pointsToNextMilestone: 123,
nextMilestone: {
milestoneId: '<string>',
rewards: [{itemId: '<string>', quantity: 123, type: 'LOYALTY_REWARD_TYPE_UNSPECIFIED'}]
},
pointsMultiplierPermille: 123,
unlockedMilestones: [
{
milestoneId: '<string>',
rewards: [{itemId: '<string>', quantity: 123, type: 'LOYALTY_REWARD_TYPE_UNSPECIFIED'}]
}
]
}
})
};
fetch('https://api.example.com/api/v1/purchase/register', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/purchase/register",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'playerId' => '<string>',
'transactionId' => '<string>',
'currency' => '<string>',
'decimalPlaces' => 123,
'registrations' => [
[
'guid' => '<string>',
'productId' => '<string>',
'cents' => 123,
'quantity' => 123,
'purchasePackId' => '<string>',
'metadata' => [
]
]
],
'checkoutLinkId' => '<string>',
'shopId' => '<string>',
'environment' => 'PAYMENT_ENVIRONMENT_UNSPECIFIED',
'platform' => 'PURCHASE_PLATFORM_UNSPECIFIED',
'browser' => '<string>',
'deviceId' => '<string>',
'source' => 'PURCHASE_SOURCE_UNSPECIFIED',
'ipAddress' => '<string>',
'region' => '<string>',
'loyalty' => [
'campaignId' => '<string>',
'totalPoints' => 123,
'pointsDelta' => 123,
'currentTierId' => '<string>',
'previousTierId' => '<string>',
'pointsToNextTier' => 123,
'pointsToNextMilestone' => 123,
'nextMilestone' => [
'milestoneId' => '<string>',
'rewards' => [
[
'itemId' => '<string>',
'quantity' => 123,
'type' => 'LOYALTY_REWARD_TYPE_UNSPECIFIED'
]
]
],
'pointsMultiplierPermille' => 123,
'unlockedMilestones' => [
[
'milestoneId' => '<string>',
'rewards' => [
[
'itemId' => '<string>',
'quantity' => 123,
'type' => 'LOYALTY_REWARD_TYPE_UNSPECIFIED'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-stash-hmac-signature: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/purchase/register"
payload := strings.NewReader("{\n \"playerId\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"currency\": \"<string>\",\n \"decimalPlaces\": 123,\n \"registrations\": [\n {\n \"guid\": \"<string>\",\n \"productId\": \"<string>\",\n \"cents\": 123,\n \"quantity\": 123,\n \"purchasePackId\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"checkoutLinkId\": \"<string>\",\n \"shopId\": \"<string>\",\n \"environment\": \"PAYMENT_ENVIRONMENT_UNSPECIFIED\",\n \"platform\": \"PURCHASE_PLATFORM_UNSPECIFIED\",\n \"browser\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"source\": \"PURCHASE_SOURCE_UNSPECIFIED\",\n \"ipAddress\": \"<string>\",\n \"region\": \"<string>\",\n \"loyalty\": {\n \"campaignId\": \"<string>\",\n \"totalPoints\": 123,\n \"pointsDelta\": 123,\n \"currentTierId\": \"<string>\",\n \"previousTierId\": \"<string>\",\n \"pointsToNextTier\": 123,\n \"pointsToNextMilestone\": 123,\n \"nextMilestone\": {\n \"milestoneId\": \"<string>\",\n \"rewards\": [\n {\n \"itemId\": \"<string>\",\n \"quantity\": 123,\n \"type\": \"LOYALTY_REWARD_TYPE_UNSPECIFIED\"\n }\n ]\n },\n \"pointsMultiplierPermille\": 123,\n \"unlockedMilestones\": [\n {\n \"milestoneId\": \"<string>\",\n \"rewards\": [\n {\n \"itemId\": \"<string>\",\n \"quantity\": 123,\n \"type\": \"LOYALTY_REWARD_TYPE_UNSPECIFIED\"\n }\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-stash-hmac-signature", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/purchase/register")
.header("x-stash-hmac-signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"playerId\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"currency\": \"<string>\",\n \"decimalPlaces\": 123,\n \"registrations\": [\n {\n \"guid\": \"<string>\",\n \"productId\": \"<string>\",\n \"cents\": 123,\n \"quantity\": 123,\n \"purchasePackId\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"checkoutLinkId\": \"<string>\",\n \"shopId\": \"<string>\",\n \"environment\": \"PAYMENT_ENVIRONMENT_UNSPECIFIED\",\n \"platform\": \"PURCHASE_PLATFORM_UNSPECIFIED\",\n \"browser\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"source\": \"PURCHASE_SOURCE_UNSPECIFIED\",\n \"ipAddress\": \"<string>\",\n \"region\": \"<string>\",\n \"loyalty\": {\n \"campaignId\": \"<string>\",\n \"totalPoints\": 123,\n \"pointsDelta\": 123,\n \"currentTierId\": \"<string>\",\n \"previousTierId\": \"<string>\",\n \"pointsToNextTier\": 123,\n \"pointsToNextMilestone\": 123,\n \"nextMilestone\": {\n \"milestoneId\": \"<string>\",\n \"rewards\": [\n {\n \"itemId\": \"<string>\",\n \"quantity\": 123,\n \"type\": \"LOYALTY_REWARD_TYPE_UNSPECIFIED\"\n }\n ]\n },\n \"pointsMultiplierPermille\": 123,\n \"unlockedMilestones\": [\n {\n \"milestoneId\": \"<string>\",\n \"rewards\": [\n {\n \"itemId\": \"<string>\",\n \"quantity\": 123,\n \"type\": \"LOYALTY_REWARD_TYPE_UNSPECIFIED\"\n }\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/purchase/register")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-stash-hmac-signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"playerId\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"currency\": \"<string>\",\n \"decimalPlaces\": 123,\n \"registrations\": [\n {\n \"guid\": \"<string>\",\n \"productId\": \"<string>\",\n \"cents\": 123,\n \"quantity\": 123,\n \"purchasePackId\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"checkoutLinkId\": \"<string>\",\n \"shopId\": \"<string>\",\n \"environment\": \"PAYMENT_ENVIRONMENT_UNSPECIFIED\",\n \"platform\": \"PURCHASE_PLATFORM_UNSPECIFIED\",\n \"browser\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"source\": \"PURCHASE_SOURCE_UNSPECIFIED\",\n \"ipAddress\": \"<string>\",\n \"region\": \"<string>\",\n \"loyalty\": {\n \"campaignId\": \"<string>\",\n \"totalPoints\": 123,\n \"pointsDelta\": 123,\n \"currentTierId\": \"<string>\",\n \"previousTierId\": \"<string>\",\n \"pointsToNextTier\": 123,\n \"pointsToNextMilestone\": 123,\n \"nextMilestone\": {\n \"milestoneId\": \"<string>\",\n \"rewards\": [\n {\n \"itemId\": \"<string>\",\n \"quantity\": 123,\n \"type\": \"LOYALTY_REWARD_TYPE_UNSPECIFIED\"\n }\n ]\n },\n \"pointsMultiplierPermille\": 123,\n \"unlockedMilestones\": [\n {\n \"milestoneId\": \"<string>\",\n \"rewards\": [\n {\n \"itemId\": \"<string>\",\n \"quantity\": 123,\n \"type\": \"LOYALTY_REWARD_TYPE_UNSPECIFIED\"\n }\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"statuses": [
{
"status": "PURCHASE_REGISTRATION_STATUS_UNSPECIFIED",
"guid": "<string>",
"productId": "<string>",
"message": "<string>"
}
]
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Authorizations
Versioned HMAC-SHA256 signature for server-to-server communication between game backends and Stash services. Recommended over the deprecated legacyHmac scheme for the best security. Header format: v1;{shopId};{unixMillisTimestamp};{base64Signature} (semicolon-delimited). {base64Signature} is the base64-encoded HMAC-SHA256 of the string {unixMillisTimestamp}.{requestBody} signed with your Egress API key, where {requestBody} is the compact request JSON. The timestamp must be within 5 minutes of Stash server time. Your shopId is your immutable shop identifier; it and your Egress API key are available in Stash Studio under Project Settings > API Secrets.
Body
Request to register a purchase intent with the game backend, at which point the game backend is expected to reserve the inventory for the purchase.
Request to register a purchase intent with the game backend, at which point the game backend is expected to reserve the inventory for the purchase.
Number of decimal places in this request's cents values for this ISO 4217 currency, under the minor-unit standard configured for your shop: Unicode CLDR release 32 by default. See cents in GetCatalog for the standards a shop can use and their sources. Always sent, including the literal 0 for zero-decimal currencies (e.g. JPY, KRW).