curl --request POST \
--url https://api.example.com/api/v1/purchase/confirm \
--header 'Content-Type: application/json' \
--header 'x-stash-hmac-signature: <api-key>' \
--data '
{
"playerId": "<string>",
"transactionId": "<string>",
"currency": "<string>",
"decimalPlaces": 123,
"tax": 123,
"taxInclusive": true,
"total": 123,
"timeMillis": "<string>",
"items": [
{
"guid": "<string>",
"productId": "<string>",
"quantity": 123,
"cents": 123,
"purchasePackId": "<string>",
"metadata": {}
}
],
"checkoutLinkId": "<string>",
"orderId": "<string>",
"shopId": "<string>",
"environment": "PAYMENT_ENVIRONMENT_UNSPECIFIED",
"paymentMethodType": "PAYMENT_METHOD_TYPE_UNSPECIFIED",
"platform": "PURCHASE_PLATFORM_UNSPECIFIED",
"browser": "<string>",
"deviceId": "<string>",
"source": "PURCHASE_SOURCE_UNSPECIFIED",
"ipAddress": "<string>",
"region": "<string>",
"userEmail": "<string>",
"emailMarketingOptIn": true,
"bonusItems": [
{
"id": "<string>",
"quantity": 123
}
],
"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/confirm"
payload = {
"playerId": "<string>",
"transactionId": "<string>",
"currency": "<string>",
"decimalPlaces": 123,
"tax": 123,
"taxInclusive": True,
"total": 123,
"timeMillis": "<string>",
"items": [
{
"guid": "<string>",
"productId": "<string>",
"quantity": 123,
"cents": 123,
"purchasePackId": "<string>",
"metadata": {}
}
],
"checkoutLinkId": "<string>",
"orderId": "<string>",
"shopId": "<string>",
"environment": "PAYMENT_ENVIRONMENT_UNSPECIFIED",
"paymentMethodType": "PAYMENT_METHOD_TYPE_UNSPECIFIED",
"platform": "PURCHASE_PLATFORM_UNSPECIFIED",
"browser": "<string>",
"deviceId": "<string>",
"source": "PURCHASE_SOURCE_UNSPECIFIED",
"ipAddress": "<string>",
"region": "<string>",
"userEmail": "<string>",
"emailMarketingOptIn": True,
"bonusItems": [
{
"id": "<string>",
"quantity": 123
}
],
"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,
tax: 123,
taxInclusive: true,
total: 123,
timeMillis: '<string>',
items: [
{
guid: '<string>',
productId: '<string>',
quantity: 123,
cents: 123,
purchasePackId: '<string>',
metadata: {}
}
],
checkoutLinkId: '<string>',
orderId: '<string>',
shopId: '<string>',
environment: 'PAYMENT_ENVIRONMENT_UNSPECIFIED',
paymentMethodType: 'PAYMENT_METHOD_TYPE_UNSPECIFIED',
platform: 'PURCHASE_PLATFORM_UNSPECIFIED',
browser: '<string>',
deviceId: '<string>',
source: 'PURCHASE_SOURCE_UNSPECIFIED',
ipAddress: '<string>',
region: '<string>',
userEmail: '<string>',
emailMarketingOptIn: true,
bonusItems: [{id: '<string>', quantity: 123}],
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/confirm', 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/confirm",
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,
'tax' => 123,
'taxInclusive' => true,
'total' => 123,
'timeMillis' => '<string>',
'items' => [
[
'guid' => '<string>',
'productId' => '<string>',
'quantity' => 123,
'cents' => 123,
'purchasePackId' => '<string>',
'metadata' => [
]
]
],
'checkoutLinkId' => '<string>',
'orderId' => '<string>',
'shopId' => '<string>',
'environment' => 'PAYMENT_ENVIRONMENT_UNSPECIFIED',
'paymentMethodType' => 'PAYMENT_METHOD_TYPE_UNSPECIFIED',
'platform' => 'PURCHASE_PLATFORM_UNSPECIFIED',
'browser' => '<string>',
'deviceId' => '<string>',
'source' => 'PURCHASE_SOURCE_UNSPECIFIED',
'ipAddress' => '<string>',
'region' => '<string>',
'userEmail' => '<string>',
'emailMarketingOptIn' => true,
'bonusItems' => [
[
'id' => '<string>',
'quantity' => 123
]
],
'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/confirm"
payload := strings.NewReader("{\n \"playerId\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"currency\": \"<string>\",\n \"decimalPlaces\": 123,\n \"tax\": 123,\n \"taxInclusive\": true,\n \"total\": 123,\n \"timeMillis\": \"<string>\",\n \"items\": [\n {\n \"guid\": \"<string>\",\n \"productId\": \"<string>\",\n \"quantity\": 123,\n \"cents\": 123,\n \"purchasePackId\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"checkoutLinkId\": \"<string>\",\n \"orderId\": \"<string>\",\n \"shopId\": \"<string>\",\n \"environment\": \"PAYMENT_ENVIRONMENT_UNSPECIFIED\",\n \"paymentMethodType\": \"PAYMENT_METHOD_TYPE_UNSPECIFIED\",\n \"platform\": \"PURCHASE_PLATFORM_UNSPECIFIED\",\n \"browser\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"source\": \"PURCHASE_SOURCE_UNSPECIFIED\",\n \"ipAddress\": \"<string>\",\n \"region\": \"<string>\",\n \"userEmail\": \"<string>\",\n \"emailMarketingOptIn\": true,\n \"bonusItems\": [\n {\n \"id\": \"<string>\",\n \"quantity\": 123\n }\n ],\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/confirm")
.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 \"tax\": 123,\n \"taxInclusive\": true,\n \"total\": 123,\n \"timeMillis\": \"<string>\",\n \"items\": [\n {\n \"guid\": \"<string>\",\n \"productId\": \"<string>\",\n \"quantity\": 123,\n \"cents\": 123,\n \"purchasePackId\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"checkoutLinkId\": \"<string>\",\n \"orderId\": \"<string>\",\n \"shopId\": \"<string>\",\n \"environment\": \"PAYMENT_ENVIRONMENT_UNSPECIFIED\",\n \"paymentMethodType\": \"PAYMENT_METHOD_TYPE_UNSPECIFIED\",\n \"platform\": \"PURCHASE_PLATFORM_UNSPECIFIED\",\n \"browser\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"source\": \"PURCHASE_SOURCE_UNSPECIFIED\",\n \"ipAddress\": \"<string>\",\n \"region\": \"<string>\",\n \"userEmail\": \"<string>\",\n \"emailMarketingOptIn\": true,\n \"bonusItems\": [\n {\n \"id\": \"<string>\",\n \"quantity\": 123\n }\n ],\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/confirm")
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 \"tax\": 123,\n \"taxInclusive\": true,\n \"total\": 123,\n \"timeMillis\": \"<string>\",\n \"items\": [\n {\n \"guid\": \"<string>\",\n \"productId\": \"<string>\",\n \"quantity\": 123,\n \"cents\": 123,\n \"purchasePackId\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"checkoutLinkId\": \"<string>\",\n \"orderId\": \"<string>\",\n \"shopId\": \"<string>\",\n \"environment\": \"PAYMENT_ENVIRONMENT_UNSPECIFIED\",\n \"paymentMethodType\": \"PAYMENT_METHOD_TYPE_UNSPECIFIED\",\n \"platform\": \"PURCHASE_PLATFORM_UNSPECIFIED\",\n \"browser\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"source\": \"PURCHASE_SOURCE_UNSPECIFIED\",\n \"ipAddress\": \"<string>\",\n \"region\": \"<string>\",\n \"userEmail\": \"<string>\",\n \"emailMarketingOptIn\": true,\n \"bonusItems\": [\n {\n \"id\": \"<string>\",\n \"quantity\": 123\n }\n ],\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{
"results": [
{
"guid": "<string>",
"productId": "<string>"
}
],
"decline": {
"status": "PURCHASE_CONFIRMATION_STATUS_UNSPECIFIED",
"guid": "<string>",
"productId": "<string>",
"message": "<string>"
}
}{
"results": [
{
"guid": "<string>",
"productId": "<string>"
}
],
"decline": {
"status": "PURCHASE_CONFIRMATION_STATUS_UNSPECIFIED",
"guid": "<string>",
"productId": "<string>",
"message": "<string>"
}
}{
"results": [
{
"guid": "<string>",
"productId": "<string>"
}
],
"decline": {
"status": "PURCHASE_CONFIRMATION_STATUS_UNSPECIFIED",
"guid": "<string>",
"productId": "<string>",
"message": "<string>"
}
}{
"results": [
{
"guid": "<string>",
"productId": "<string>"
}
],
"decline": {
"status": "PURCHASE_CONFIRMATION_STATUS_UNSPECIFIED",
"guid": "<string>",
"productId": "<string>",
"message": "<string>"
}
}{
"results": [
{
"guid": "<string>",
"productId": "<string>"
}
],
"decline": {
"status": "PURCHASE_CONFIRMATION_STATUS_UNSPECIFIED",
"guid": "<string>",
"productId": "<string>",
"message": "<string>"
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Confirm payment completion
Step 2A: Confirms and completes a pending purchase that was previously registered. IMPORTANT: Expects HTTP error status (3xx, 4xx, 5xx) codes for failed purchases. A declined purchase should also carry a decline in the response body. Where the checkout supports it, Stash uses the decline’s status to pick the message shown to the player; otherwise the player sees a generic failure.
curl --request POST \
--url https://api.example.com/api/v1/purchase/confirm \
--header 'Content-Type: application/json' \
--header 'x-stash-hmac-signature: <api-key>' \
--data '
{
"playerId": "<string>",
"transactionId": "<string>",
"currency": "<string>",
"decimalPlaces": 123,
"tax": 123,
"taxInclusive": true,
"total": 123,
"timeMillis": "<string>",
"items": [
{
"guid": "<string>",
"productId": "<string>",
"quantity": 123,
"cents": 123,
"purchasePackId": "<string>",
"metadata": {}
}
],
"checkoutLinkId": "<string>",
"orderId": "<string>",
"shopId": "<string>",
"environment": "PAYMENT_ENVIRONMENT_UNSPECIFIED",
"paymentMethodType": "PAYMENT_METHOD_TYPE_UNSPECIFIED",
"platform": "PURCHASE_PLATFORM_UNSPECIFIED",
"browser": "<string>",
"deviceId": "<string>",
"source": "PURCHASE_SOURCE_UNSPECIFIED",
"ipAddress": "<string>",
"region": "<string>",
"userEmail": "<string>",
"emailMarketingOptIn": true,
"bonusItems": [
{
"id": "<string>",
"quantity": 123
}
],
"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/confirm"
payload = {
"playerId": "<string>",
"transactionId": "<string>",
"currency": "<string>",
"decimalPlaces": 123,
"tax": 123,
"taxInclusive": True,
"total": 123,
"timeMillis": "<string>",
"items": [
{
"guid": "<string>",
"productId": "<string>",
"quantity": 123,
"cents": 123,
"purchasePackId": "<string>",
"metadata": {}
}
],
"checkoutLinkId": "<string>",
"orderId": "<string>",
"shopId": "<string>",
"environment": "PAYMENT_ENVIRONMENT_UNSPECIFIED",
"paymentMethodType": "PAYMENT_METHOD_TYPE_UNSPECIFIED",
"platform": "PURCHASE_PLATFORM_UNSPECIFIED",
"browser": "<string>",
"deviceId": "<string>",
"source": "PURCHASE_SOURCE_UNSPECIFIED",
"ipAddress": "<string>",
"region": "<string>",
"userEmail": "<string>",
"emailMarketingOptIn": True,
"bonusItems": [
{
"id": "<string>",
"quantity": 123
}
],
"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,
tax: 123,
taxInclusive: true,
total: 123,
timeMillis: '<string>',
items: [
{
guid: '<string>',
productId: '<string>',
quantity: 123,
cents: 123,
purchasePackId: '<string>',
metadata: {}
}
],
checkoutLinkId: '<string>',
orderId: '<string>',
shopId: '<string>',
environment: 'PAYMENT_ENVIRONMENT_UNSPECIFIED',
paymentMethodType: 'PAYMENT_METHOD_TYPE_UNSPECIFIED',
platform: 'PURCHASE_PLATFORM_UNSPECIFIED',
browser: '<string>',
deviceId: '<string>',
source: 'PURCHASE_SOURCE_UNSPECIFIED',
ipAddress: '<string>',
region: '<string>',
userEmail: '<string>',
emailMarketingOptIn: true,
bonusItems: [{id: '<string>', quantity: 123}],
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/confirm', 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/confirm",
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,
'tax' => 123,
'taxInclusive' => true,
'total' => 123,
'timeMillis' => '<string>',
'items' => [
[
'guid' => '<string>',
'productId' => '<string>',
'quantity' => 123,
'cents' => 123,
'purchasePackId' => '<string>',
'metadata' => [
]
]
],
'checkoutLinkId' => '<string>',
'orderId' => '<string>',
'shopId' => '<string>',
'environment' => 'PAYMENT_ENVIRONMENT_UNSPECIFIED',
'paymentMethodType' => 'PAYMENT_METHOD_TYPE_UNSPECIFIED',
'platform' => 'PURCHASE_PLATFORM_UNSPECIFIED',
'browser' => '<string>',
'deviceId' => '<string>',
'source' => 'PURCHASE_SOURCE_UNSPECIFIED',
'ipAddress' => '<string>',
'region' => '<string>',
'userEmail' => '<string>',
'emailMarketingOptIn' => true,
'bonusItems' => [
[
'id' => '<string>',
'quantity' => 123
]
],
'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/confirm"
payload := strings.NewReader("{\n \"playerId\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"currency\": \"<string>\",\n \"decimalPlaces\": 123,\n \"tax\": 123,\n \"taxInclusive\": true,\n \"total\": 123,\n \"timeMillis\": \"<string>\",\n \"items\": [\n {\n \"guid\": \"<string>\",\n \"productId\": \"<string>\",\n \"quantity\": 123,\n \"cents\": 123,\n \"purchasePackId\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"checkoutLinkId\": \"<string>\",\n \"orderId\": \"<string>\",\n \"shopId\": \"<string>\",\n \"environment\": \"PAYMENT_ENVIRONMENT_UNSPECIFIED\",\n \"paymentMethodType\": \"PAYMENT_METHOD_TYPE_UNSPECIFIED\",\n \"platform\": \"PURCHASE_PLATFORM_UNSPECIFIED\",\n \"browser\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"source\": \"PURCHASE_SOURCE_UNSPECIFIED\",\n \"ipAddress\": \"<string>\",\n \"region\": \"<string>\",\n \"userEmail\": \"<string>\",\n \"emailMarketingOptIn\": true,\n \"bonusItems\": [\n {\n \"id\": \"<string>\",\n \"quantity\": 123\n }\n ],\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/confirm")
.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 \"tax\": 123,\n \"taxInclusive\": true,\n \"total\": 123,\n \"timeMillis\": \"<string>\",\n \"items\": [\n {\n \"guid\": \"<string>\",\n \"productId\": \"<string>\",\n \"quantity\": 123,\n \"cents\": 123,\n \"purchasePackId\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"checkoutLinkId\": \"<string>\",\n \"orderId\": \"<string>\",\n \"shopId\": \"<string>\",\n \"environment\": \"PAYMENT_ENVIRONMENT_UNSPECIFIED\",\n \"paymentMethodType\": \"PAYMENT_METHOD_TYPE_UNSPECIFIED\",\n \"platform\": \"PURCHASE_PLATFORM_UNSPECIFIED\",\n \"browser\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"source\": \"PURCHASE_SOURCE_UNSPECIFIED\",\n \"ipAddress\": \"<string>\",\n \"region\": \"<string>\",\n \"userEmail\": \"<string>\",\n \"emailMarketingOptIn\": true,\n \"bonusItems\": [\n {\n \"id\": \"<string>\",\n \"quantity\": 123\n }\n ],\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/confirm")
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 \"tax\": 123,\n \"taxInclusive\": true,\n \"total\": 123,\n \"timeMillis\": \"<string>\",\n \"items\": [\n {\n \"guid\": \"<string>\",\n \"productId\": \"<string>\",\n \"quantity\": 123,\n \"cents\": 123,\n \"purchasePackId\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"checkoutLinkId\": \"<string>\",\n \"orderId\": \"<string>\",\n \"shopId\": \"<string>\",\n \"environment\": \"PAYMENT_ENVIRONMENT_UNSPECIFIED\",\n \"paymentMethodType\": \"PAYMENT_METHOD_TYPE_UNSPECIFIED\",\n \"platform\": \"PURCHASE_PLATFORM_UNSPECIFIED\",\n \"browser\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"source\": \"PURCHASE_SOURCE_UNSPECIFIED\",\n \"ipAddress\": \"<string>\",\n \"region\": \"<string>\",\n \"userEmail\": \"<string>\",\n \"emailMarketingOptIn\": true,\n \"bonusItems\": [\n {\n \"id\": \"<string>\",\n \"quantity\": 123\n }\n ],\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{
"results": [
{
"guid": "<string>",
"productId": "<string>"
}
],
"decline": {
"status": "PURCHASE_CONFIRMATION_STATUS_UNSPECIFIED",
"guid": "<string>",
"productId": "<string>",
"message": "<string>"
}
}{
"results": [
{
"guid": "<string>",
"productId": "<string>"
}
],
"decline": {
"status": "PURCHASE_CONFIRMATION_STATUS_UNSPECIFIED",
"guid": "<string>",
"productId": "<string>",
"message": "<string>"
}
}{
"results": [
{
"guid": "<string>",
"productId": "<string>"
}
],
"decline": {
"status": "PURCHASE_CONFIRMATION_STATUS_UNSPECIFIED",
"guid": "<string>",
"productId": "<string>",
"message": "<string>"
}
}{
"results": [
{
"guid": "<string>",
"productId": "<string>"
}
],
"decline": {
"status": "PURCHASE_CONFIRMATION_STATUS_UNSPECIFIED",
"guid": "<string>",
"productId": "<string>",
"message": "<string>"
}
}{
"results": [
{
"guid": "<string>",
"productId": "<string>"
}
],
"decline": {
"status": "PURCHASE_CONFIRMATION_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 confirm and complete a pending purchase that was previously registered.
Request to confirm and complete a pending purchase that was previously registered.
Number of decimal places in this request's tax, total and line-item 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).
Tax as integer minor units for this ISO 4217 currency (e.g. 99 for $0.99 in USD; can be 0), scaled by this request's decimalPlaces under the minor-unit standard configured for your shop, the same standard Stash reads your catalog prices with (see cents in GetCatalog). Always sent, including the literal 0 when the purchase has no tax.
Whether tax is already included in the item prices. When true, tax is the share of total that is tax. When false, tax is added on top. False when tax is 0. For a purchase without a cash coupon, you can check before granting that total, minus tax when taxInclusive is false, equals the sum of cents × quantity. Each of cents, tax and total is rounded down on its own to the currency's minor units in CLDR version 32 (the CLDR_32 standard) before it is scaled to decimalPlaces, and for a few currencies (such as COP, which has 0 decimals there) those have fewer decimals than ISO 4217 or later CLDR versions list. So when item prices are finer than those units, total (minus tax when taxInclusive is false) can exceed the sum by less than one such unit per item purchased, plus one more when tax is added on top; allow that difference. A cash coupon lowers total by its discount, and this request does not carry the discount yet, so these fields alone cannot validate a purchase with a cash coupon. Always sent, including false.
Amount charged, as integer minor units for this ISO 4217 currency (e.g. 1098 for $10.98 in USD), scaled by this request's decimalPlaces under the minor-unit standard configured for your shop, the same standard Stash reads your catalog prices with (see cents in GetCatalog). Includes tax: added on top of the item prices when taxInclusive is false, already inside them when true.
Stash's order ID for this purchase: the same value as orderId in the PURCHASE_SUCCEEDED webhook for it, so you can record it at confirmation without waiting for the webhook. Each payment attempt can have its own order ID: if the player pays again after a failed attempt, the new confirmation can carry the same transaction_id with a different order_id, and the webhook carries the order_id of the attempt that was paid. On a web shop cart purchase it equals transaction_id. Sent only for a shop Stash has turned it on for: ask Stash to turn it on for yours. A confirmation without it is still valid; take the order ID from the webhook then.
Represents the payment method used for the purchase
PAYMENT_METHOD_TYPE_UNSPECIFIED, PAYMENT_METHOD_TYPE_CARD, PAYMENT_METHOD_TYPE_APPLE_PAY, PAYMENT_METHOD_TYPE_GOOGLE_PAY, PAYMENT_METHOD_TYPE_PAYPAL, PAYMENT_METHOD_TYPE_KLARNA, PAYMENT_METHOD_TYPE_CASH_APP, PAYMENT_METHOD_TYPE_AMAZON_PAY Response
A successful response.
Expected response format for the ConfirmPayment endpoint from the game backend. Return exactly one of results or decline: results present and decline absent indicates success; decline present indicates the purchase was not fulfilled and takes precedence over anything in results. Return a decline together with an HTTP 4xx status.