> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stash.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.



## OpenAPI

````yaml /egress-openapi.json post /api/v1/purchase/register
openapi: 3.0.0
info:
  title: Stash Web Shop API
  description: >-
    Server-side APIs for Stash web shop integration. This API set includes
    catalog management, purchase processing, and user management endpoints
    designed for server-to-server communication between game backends and Stash
    services.
  version: '1.0'
  contact:
    name: API Support
    url: https://docs.stash.gg/
    email: help@stash.gg
servers: []
security: []
tags:
  - name: Catalog
    description: Product catalog endpoints
  - name: Purchase
    description: Purchase processing endpoints
  - name: Players
    description: Player management endpoints
paths:
  /api/v1/purchase/register:
    post:
      tags:
        - Purchase
      summary: Register payment intent
      description: >-
        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.
      operationId: RegisterPayment
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/server.egress.shop.purchase.v1.RegisterPaymentRequest
        description: >-
          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.
        required: true
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/server.egress.shop.purchase.v1.RegisterPaymentResponse
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/google.rpc.Status'
      security:
        - hmac: []
components:
  schemas:
    server.egress.shop.purchase.v1.RegisterPaymentRequest:
      type: object
      properties:
        playerId:
          type: string
          description: The user making the purchase
        transactionId:
          type: string
          description: Unique transaction identifier for this purchase session
        checkoutLinkId:
          type: string
          description: >-
            Optional checkout link identifier if purchase was made through a
            checkout link
        shopId:
          type: string
          description: >-
            The originating Stash shop identifier (mirrors the shopId sent in
            webhooks)
        environment:
          $ref: '#/components/schemas/server.egress.shop.v1.PaymentEnvironment'
        currency:
          type: string
          description: Currency code (ISO-4217 code, e.g., 'USD', 'EUR')
        decimalPlaces:
          type: integer
          format: int64
          description: >-
            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).
        registrations:
          type: array
          items:
            $ref: >-
              #/components/schemas/server.egress.shop.purchase.v1.RegisterPaymentRequest.PurchaseRegistration
          description: List of items to register for purchase
        platform:
          $ref: '#/components/schemas/server.egress.shop.purchase.v1.PurchasePlatform'
        browser:
          type: string
          description: >-
            Browser information for web purchases (e.g., 'Chrome/91.0',
            'Firefox/89.0', 'Safari/14.1', 'any')
        deviceId:
          type: string
          description: >-
            Device identifier for tracking and fraud prevention (can be
            generated client-side)
        source:
          $ref: '#/components/schemas/server.egress.shop.purchase.v1.PurchaseSource'
        ipAddress:
          type: string
          description: Customer IP address for fraud prevention and compliance
        region:
          type: string
          description: >-
            Region/country code using ISO-3166-1 alpha-2 code (e.g., 'US', 'CA',
            'GB')
        loyalty:
          $ref: '#/components/schemas/server.egress.shop.v1.PlayerLoyaltyState'
      description: >-
        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.
      title: Register Payment Request
      required:
        - decimalPlaces
        - playerId
        - transactionId
        - currency
        - registrations
    server.egress.shop.purchase.v1.RegisterPaymentResponse:
      type: object
      properties:
        statuses:
          type: array
          items:
            $ref: >-
              #/components/schemas/server.egress.shop.purchase.v1.RegisterPaymentResponse.OfferStatus
          description: Status of each registered offer
      description: >-
        Expected response format for the RegisterPayment endpoint from the game
        backend (response body includes status indicating success or failure).
      title: Register Payment Response
      required:
        - statuses
    google.rpc.Status:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/google.protobuf.Any'
    server.egress.shop.v1.PaymentEnvironment:
      type: string
      enum:
        - PAYMENT_ENVIRONMENT_UNSPECIFIED
        - PAYMENT_ENVIRONMENT_TEST
        - PAYMENT_ENVIRONMENT_PRODUCTION
      default: PAYMENT_ENVIRONMENT_UNSPECIFIED
      description: Represents the payment environment for the request
    server.egress.shop.purchase.v1.RegisterPaymentRequest.PurchaseRegistration:
      type: object
      properties:
        guid:
          type: string
          description: >-
            The offer/product GUID being purchased (can be auto-generated UUID
            v5 if not provided in catalog response)
        productId:
          type: string
          description: The offer/product SKU being purchased
        cents:
          type: integer
          format: int64
          description: >-
            Integer minor units for this ISO 4217 currency (e.g. 999 for $9.99
            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).
        quantity:
          type: integer
          format: int64
          description: Quantity being purchased (must be positive, no bigint support)
        purchasePackId:
          type: string
          description: >-
            Identifier of the purchase pack the item was selected from: the
            pack's id in the catalog response the purchase was made from, echoed
            so the purchase can be attributed to the offer as it was displayed
            without a reverse lookup. Required when the selected item came from
            a purchase pack, omitted otherwise; a present but empty value is
            rejected. product_id still identifies which price point was bought.
        metadata:
          type: object
          additionalProperties:
            type: string
          description: Optional key-value pairs for additional item metadata
      description: Represents a single item registration in a purchase
      title: Purchase Registration
      required:
        - guid
        - productId
        - cents
        - quantity
    server.egress.shop.purchase.v1.PurchasePlatform:
      type: string
      enum:
        - PURCHASE_PLATFORM_UNSPECIFIED
        - PURCHASE_PLATFORM_IOS
        - PURCHASE_PLATFORM_ANDROID
        - PURCHASE_PLATFORM_WEBSTORE
      default: PURCHASE_PLATFORM_UNSPECIFIED
      description: Represents the platform of the user making the purchase
      title: '- PURCHASE_PLATFORM_UNSPECIFIED: Default unknown platform'
    server.egress.shop.purchase.v1.PurchaseSource:
      type: string
      enum:
        - PURCHASE_SOURCE_UNSPECIFIED
        - PURCHASE_SOURCE_CART
        - PURCHASE_SOURCE_DIRECT
        - PURCHASE_SOURCE_BUY_NOW
      default: PURCHASE_SOURCE_UNSPECIFIED
      description: Represents the source of the purchase for analytics
      title: |-
        - PURCHASE_SOURCE_UNSPECIFIED: Default unknown source
         - PURCHASE_SOURCE_CART: Purchase initiated from cart in webstore
         - PURCHASE_SOURCE_DIRECT: Purchase initiated from direct StashPay checkout link
         - PURCHASE_SOURCE_BUY_NOW: Purchase initiated from webshop, skipping the Cart and going directly to Checkout
    server.egress.shop.v1.PlayerLoyaltyState:
      type: object
      properties:
        campaignId:
          type: string
          description: >-
            Identifier of the live loyalty campaign (season) this snapshot is
            scoped to.
        totalPoints:
          type: integer
          format: int64
          description: The player's loyalty points balance for this campaign.
        pointsDelta:
          type: integer
          format: int32
          description: >-
            Signed change in the loyalty points balance caused by the associated
            event (for example, a purchase); negative on a refund reversal, zero
            when the balance did not change.
        currentTierId:
          type: string
          description: >-
            The player's current tier, as the partner-facing tier identifier.
            Omitted when no tier matches the balance.
        previousTierId:
          type: string
          description: >-
            The player's prior tier, set only when the associated event changed
            the tier. Omitted when the tier did not change.
        pointsToNextTier:
          type: integer
          format: int64
          description: >-
            Loyalty points still needed to reach the next tier. Omitted when the
            player is already at the top tier.
        pointsToNextMilestone:
          type: integer
          format: int64
          description: >-
            Loyalty points still needed to reach the next unreached milestone.
            Omitted when there is no further milestone.
        nextMilestone:
          $ref: >-
            #/components/schemas/server.egress.shop.v1.PlayerLoyaltyState.Milestone
        pointsMultiplierPermille:
          type: integer
          format: int64
          description: >-
            The effective (applied) points-earning multiplier for the player's
            current loyalty tier, relative to the base (lowest) tier, expressed
            in permille; divide by 1000 (1500 = 1.5x; base tier = 1000). Exact
            per-tier rates are available in the tier configuration.
        unlockedMilestones:
          type: array
          items:
            $ref: >-
              #/components/schemas/server.egress.shop.v1.PlayerLoyaltyState.Milestone
          description: >-
            The loyalty milestones this event's points gain crossed, each
            including every reward it grants, ordered by ascending threshold.
            Omitted when the event crossed no threshold; never present when the
            balance did not increase. May contain more than one entry, and never
            overlaps next_milestone.
      description: >-
        A player's standing in a shop's active loyalty campaign at a point in
        time.
      title: Player Loyalty State
    server.egress.shop.purchase.v1.RegisterPaymentResponse.OfferStatus:
      type: object
      properties:
        guid:
          type: string
          description: >-
            The offer/product GUID that was registered (providing this OR
            product_id is required)
        productId:
          type: string
          description: >-
            The offer/product SKU that was registered (providing this OR guid is
            required)
        status:
          $ref: >-
            #/components/schemas/server.egress.shop.purchase.v1.PurchaseRegistrationStatus
        message:
          type: string
          description: Optional human-readable status message for debugging
      description: Represents the status of a registered offer
      title: Offer Status
      required:
        - status
    google.protobuf.Any:
      type: object
      properties:
        '@type':
          type: string
      additionalProperties: {}
    server.egress.shop.v1.PlayerLoyaltyState.Milestone:
      type: object
      properties:
        milestoneId:
          type: string
          description: >-
            Identifier of the milestone; the same identifier reported as
            milestoneId on the loyalty milestone claimed event and by the
            loyalty read API.
        rewards:
          type: array
          items:
            $ref: >-
              #/components/schemas/server.egress.shop.v1.PlayerLoyaltyState.MilestoneRewardItem
          description: All rewards granted when this milestone is reached.
      description: A loyalty milestone and the rewards it grants.
      title: Milestone
    server.egress.shop.purchase.v1.PurchaseRegistrationStatus:
      type: string
      enum:
        - PURCHASE_REGISTRATION_STATUS_UNSPECIFIED
        - PURCHASE_REGISTRATION_STATUS_SUCCESS_REGISTERED
        - PURCHASE_REGISTRATION_STATUS_FAILED_INVALID_OFFER
        - PURCHASE_REGISTRATION_STATUS_FAILED_INSUFFICIENT_INVENTORY
        - PURCHASE_REGISTRATION_STATUS_FAILED_PURCHASE_LIMIT_EXCEEDED
        - PURCHASE_REGISTRATION_STATUS_FAILED_INVALID_PRICE
        - PURCHASE_REGISTRATION_STATUS_FAILED_PURCHASE_LOCKED
        - PURCHASE_REGISTRATION_STATUS_FAILED_PACK_LIMIT_EXCEEDED
      default: PURCHASE_REGISTRATION_STATUS_UNSPECIFIED
      description: Represents the status of a purchase registration
      title: >-
        - PURCHASE_REGISTRATION_STATUS_UNSPECIFIED: Default unknown registration
        error status
         - PURCHASE_REGISTRATION_STATUS_SUCCESS_REGISTERED: Registration was successful
         - PURCHASE_REGISTRATION_STATUS_FAILED_INVALID_OFFER: Registration failed due to invalid offer
         - PURCHASE_REGISTRATION_STATUS_FAILED_INSUFFICIENT_INVENTORY: Registration failed because a stock shared across players is lower than
        the quantity, for example 0. When only this player's own remaining count
        is

        too low, use PURCHASE_REGISTRATION_STATUS_FAILED_PURCHASE_LIMIT_EXCEEDED
         - PURCHASE_REGISTRATION_STATUS_FAILED_PURCHASE_LIMIT_EXCEEDED: Registration failed because this player cannot buy this many more of the
        item: the item's own remaining count, which the catalog sends as

        max_purchasable, is lower than the quantity, for example 0
         - PURCHASE_REGISTRATION_STATUS_FAILED_INVALID_PRICE: Registration failed due to invalid pricing
         - PURCHASE_REGISTRATION_STATUS_FAILED_PURCHASE_LOCKED: Registration failed due to purchase being locked, e.g. in-app
         - PURCHASE_REGISTRATION_STATUS_FAILED_PACK_LIMIT_EXCEEDED: Registration failed because this player cannot buy this many more from the
        purchase pack this item belongs to: the pack's remaining count,

        max_purchasable on the pack, is lower than the quantity, for example 0,

        which applies to every item of the pack. The pack is the purchase pack

        catalog item whose id was echoed as purchase_pack_id on the
        registration.

        Use PURCHASE_REGISTRATION_STATUS_FAILED_PURCHASE_LIMIT_EXCEEDED when
        only

        the item's own count is too low
    server.egress.shop.v1.PlayerLoyaltyState.MilestoneRewardItem:
      type: object
      properties:
        itemId:
          type: string
          description: >-
            Identifier of the reward: a shop bonus identifier for
            currency/points rewards, or the product's external identifier (SKU)
            for product rewards.
        quantity:
          type: integer
          format: int64
          description: Amount of the reward granted.
        type:
          $ref: '#/components/schemas/server.egress.shop.v1.LoyaltyRewardType'
      description: A single reward granted when a loyalty milestone is reached.
      title: Milestone Reward Item
    server.egress.shop.v1.LoyaltyRewardType:
      type: string
      enum:
        - LOYALTY_REWARD_TYPE_UNSPECIFIED
        - LOYALTY_REWARD_TYPE_IN_GAME_CURRENCY
        - LOYALTY_REWARD_TYPE_LOYALTY_CURRENCY
        - LOYALTY_REWARD_TYPE_LOYALTY_POINTS
        - LOYALTY_REWARD_TYPE_SKU_ITEM
      default: LOYALTY_REWARD_TYPE_UNSPECIFIED
      description: The kind of reward granted at a loyalty milestone.
  securitySchemes:
    hmac:
      type: apiKey
      description: >-
        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.
      name: x-stash-hmac-signature
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.