# `GameServer.Payments.Purchase`
[🔗](https://github.com/appsinacup/game_server/blob/v1.0.26/lib/game_server/payments/purchase.ex#L1)

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

# `t`

```elixir
@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()
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
