Authorize purchase specifications
Stash recommends that you create an endpoint for authorizing purchases when using either Stash Webshop or Stash Pay. For every transaction, Stash verifies the player has enough funds to cover the purchase and then calls this endpoint. This tells you it’s safe to grant the player their items, and after the endpoint returns a successful (200
) response, Stash charges the player.
Authentication
It’s your responsibility to secure this endpoint and provide Stash with an API key for authentication. Stash passes the API key in a header when it calls your endpoint.
curl -X 'POST' \
'https://custom.gamestudio.com/{custom_authorize_purchase_path}/{player_id} \
-H '{x-custom-api-key}: abcdefc' \
-H 'Content-Type: application/json' \
-d '{
"transactionId": "txId",
"items": [{
"id": "sword_123",
"quantity": 1
},
{
"id": "shield_1234",
"quantity": 1
}]
}'
Response requirements
Your endpoint must return a 200
response to Stash. All other responses result in a failed transaction and the player isn’t charged.