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.
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.
In: header
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.
The user making the purchase
Unique transaction identifier for this purchase session
Optional checkout link identifier if purchase was made through a checkout link
The originating Stash shop identifier (mirrors the shopId sent in webhooks)
Payment environment for the request
"PAYMENT_ENVIRONMENT_UNSPECIFIED""PAYMENT_ENVIRONMENT_UNSPECIFIED" | "PAYMENT_ENVIRONMENT_TEST" | "PAYMENT_ENVIRONMENT_PRODUCTION"Currency code (ISO-4217 code, e.g., 'USD', 'EUR')
CLDR fraction-digit count for this ISO 4217 currency, from public CLDR supplemental data for this currency code. Always sent, including the literal 0 for zero-decimal currencies (e.g. JPY, KRW).
int64List of items to register for purchase
Platform making the purchase
"PURCHASE_PLATFORM_UNSPECIFIED""PURCHASE_PLATFORM_UNSPECIFIED" | "PURCHASE_PLATFORM_IOS" | "PURCHASE_PLATFORM_ANDROID" | "PURCHASE_PLATFORM_WEBSTORE"Browser information for web purchases (e.g., 'Chrome/91.0', 'Firefox/89.0', 'Safari/14.1', 'any')
Device identifier for tracking and fraud prevention (can be generated client-side)
Source of the purchase for analytics
"PURCHASE_SOURCE_UNSPECIFIED""PURCHASE_SOURCE_UNSPECIFIED" | "PURCHASE_SOURCE_CART" | "PURCHASE_SOURCE_DIRECT"Customer IP address for fraud prevention and compliance
Region/country code using ISO-3166-1 alpha-2 code (e.g., 'US', 'CA', 'GB')
Response Body
curl -X POST "https://loading/api/v1/purchase/register" \ -H "Content-Type: application/json" \ -d '{ "playerId": "string", "transactionId": "string", "currency": "string", "decimalPlaces": 0, "registrations": [ { "guid": "string", "productId": "string", "cents": 0, "quantity": 0 } ] }'{
"statuses": [
{
"guid": "string",
"productId": "string",
"status": "PURCHASE_REGISTRATION_STATUS_UNSPECIFIED",
"message": "string"
}
]
}{
"code": 0,
"message": "string",
"details": [
{
"@type": "string",
"property1": null,
"property2": null
}
]
}How is this guide?