GameServer.Payments.Purchase (game_server_sdk v1.0.1087)

Copy Markdown View Source

Purchase struct from GameServer.

This is a stub module for SDK type definitions. The actual struct is provided by GameServer at runtime.

Handed to after_purchase_fulfilled/1 and after_purchase_revoked/1.

Fields

  • id - Purchase ID (UUIDv7 string)
  • user_id - Buyer (UUIDv7 string)
  • product_id - The product bought (UUIDv7 string)
  • provider - "stripe", "google", "apple" or "steam" (string)
  • status - Lifecycle status, e.g. "fulfilled" (string)
  • quantity - Units bought (integer)
  • currency - Real-money currency code (string)
  • amount - Real-money amount in minor units (integer)
  • environment - "production" or "sandbox" (string)
  • metadata - Arbitrary purchase metadata (map)
  • purchased_at - When the provider recorded the purchase

Summary

Types

t()

@type t() :: %GameServer.Payments.Purchase{
  amount: integer() | nil,
  currency: String.t() | nil,
  environment: String.t(),
  id: String.t(),
  inserted_at: DateTime.t(),
  metadata: map(),
  order_id: String.t() | nil,
  product_id: String.t(),
  provider: String.t(),
  provider_transaction_id: String.t() | nil,
  purchased_at: DateTime.t() | nil,
  quantity: integer(),
  status: String.t(),
  updated_at: DateTime.t(),
  user_id: String.t()
}