PurchaseIntent
extends DomainValue
in package
A shareable purchase intent that captures product, price, quantity, variants, and usage.
This immutable value hydrates decoded API snake_case data into typed camelCase properties.
Use fromArray() for wire data; toArray(), array access, and JSON serialization expose the API
wire representation. Nullable properties correspond to optional API fields.
Tags
Table of Contents
Properties
- $allowVariants : bool
- Whether the intent was configured with a variant set.
- $createdAt : DateTimeImmutable
- Creation timestamp.
- $expiresAt : DateTimeImmutable|null
- Timestamp at or after which the Buy link is expired.
- $id : string
- Unique purchase intent identifier with sale_ prefix. Append it to https://pages.inttegro.com/buy/ to build the hosted Buy link.
- $inactiveAt : DateTimeImmutable|null
- When the Buy link was explicitly canceled.
- $merchant : Merchant|null
- Merchant identity captured for the hosted checkout. Individual fields are omitted when unavailable.
- $presentation : Presentation|null
- Merchant-authored Buy page presentation settings. Wire field: `presentation`.
- $price : Price|null
- Price value for this purchase intent.
- $product : Product|null
- Product value for this purchase intent.
- $quantity : Quantity
- Quantity bounds enforced by the hosted checkout. max is omitted when the offer has no upper bound.
- $status : Status
- Effective lifecycle state derived from expiry, cancellation, and single-use order creation.
- $updatedAt : DateTimeImmutable|null
- Last mutation timestamp.
- $usage : Usage
- Exactly one of multi_use or single_use is returned as true. Order is present after a single-use intent is consumed.
- $variantSet : VariantSet|null
- Variant Set value for this purchase intent.
Methods
- __construct() : mixed
- Hydrates a PurchaseIntent from decoded Inttegro API data.
- fromArray() : static
- Creates a PurchaseIntent from its decoded API wire representation.
- isActive() : bool
- Reports whether the purchase intent is active.
- isSingleUse() : bool
- Reports whether the purchase intent can be consumed only once.
- jsonSerialize() : array<string, mixed>
- Returns the same API wire object as `toArray()` for `json_encode()`.
- offsetExists() : bool
- Reports whether a non-null property exists for a PHP or API field name.
- offsetGet() : mixed
- Reads a typed property through PHP `ArrayAccess`.
- offsetSet() : void
- Rejects mutation because domain values are immutable.
- offsetUnset() : void
- Rejects unsetting because domain values are immutable.
- toArray() : array<string, mixed>
- Converts typed properties back to the API's wire representation.
- usedOrderId() : string|null
- Returns the consuming order ID for a used single-use purchase intent, or null when none exists.
Properties
$allowVariants read-only
Whether the intent was configured with a variant set.
public
bool
$allowVariants
Required response field. PHP type: bool; wire field: allow_variants (boolean).
$createdAt read-only
Creation timestamp.
public
DateTimeImmutable
$createdAt
Required response field. PHP type: DateTimeImmutable; wire field: created_at (ISO-8601 string with UTC offset).
The SDK parses the offset-bearing timestamp into an immutable PHP date-time value.
$expiresAt read-only
Timestamp at or after which the Buy link is expired.
public
DateTimeImmutable|null
$expiresAt
Optional response field. PHP type: DateTimeImmutable|null; wire field: expires_at
(ISO-8601 string with UTC offset).
The SDK parses the offset-bearing timestamp into an immutable PHP date-time value.
$id read-only
Unique purchase intent identifier with sale_ prefix. Append it to https://pages.inttegro.com/buy/ to build the hosted Buy link.
public
string
$id
Required response field. PHP type: string; wire field: id (string).
$inactiveAt read-only
When the Buy link was explicitly canceled.
public
DateTimeImmutable|null
$inactiveAt
Optional response field. PHP type: DateTimeImmutable|null; wire field: inactive_at
(ISO-8601 string with UTC offset).
The SDK parses the offset-bearing timestamp into an immutable PHP date-time value.
$merchant read-only
Merchant identity captured for the hosted checkout. Individual fields are omitted when unavailable.
public
Merchant|null
$merchant
Optional response field. PHP type: \Inttegro\PurchaseIntent\Merchant|null; wire field:
merchant (object).
$presentation read-only
Merchant-authored Buy page presentation settings. Wire field: `presentation`.
public
Presentation|null
$presentation
$price read-only
Price value for this purchase intent.
public
Price|null
$price
Optional response field. PHP type: \Inttegro\PurchaseIntent\Price|null; wire field: price
(object).
$product read-only
Product value for this purchase intent.
public
Product|null
$product
Optional response field. PHP type: \Inttegro\PurchaseIntent\Product|null; wire field:
product (object).
$quantity read-only
Quantity bounds enforced by the hosted checkout. max is omitted when the offer has no upper bound.
public
Quantity
$quantity
Required response field. PHP type: \Inttegro\PurchaseIntent\Quantity; wire field:
quantity (object).
$status read-only
Effective lifecycle state derived from expiry, cancellation, and single-use order creation.
public
Status
$status
Required response field. PHP type: \Inttegro\PurchaseIntent\Status; wire field: status
(string).
Compare against Status cases by using their ->value strings.
$updatedAt read-only
Last mutation timestamp.
public
DateTimeImmutable|null
$updatedAt
Optional response field. PHP type: DateTimeImmutable|null; wire field: updated_at
(ISO-8601 string with UTC offset).
The SDK parses the offset-bearing timestamp into an immutable PHP date-time value.
$usage read-only
Exactly one of multi_use or single_use is returned as true. Order is present after a single-use intent is consumed.
public
Usage
$usage
Required response field. PHP type: \Inttegro\PurchaseIntent\Usage; wire field: usage
(object).
$variantSet read-only
Variant Set value for this purchase intent.
public
VariantSet|null
$variantSet
Optional response field. PHP type: \Inttegro\PurchaseIntent\VariantSet|null; wire field:
variant_set (object).
Methods
__construct()
Hydrates a PurchaseIntent from decoded Inttegro API data.
public
__construct(array<string, mixed> $data) : mixed
Parameters
- $data : array<string, mixed>
-
Wire object keyed by
snake_caseAPI field names.
fromArray()
Creates a PurchaseIntent from its decoded API wire representation.
public
static fromArray(array<string, mixed> $data) : static
Parameters
- $data : array<string, mixed>
-
Wire object keyed by
snake_caseAPI field names.
Return values
static —A typed, immutable PurchaseIntent value.
isActive()
Reports whether the purchase intent is active.
public
isActive() : bool
Return values
boolisSingleUse()
Reports whether the purchase intent can be consumed only once.
public
isSingleUse() : bool
Return values
booljsonSerialize()
Returns the same API wire object as `toArray()` for `json_encode()`.
public
jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>offsetExists()
Reports whether a non-null property exists for a PHP or API field name.
public
offsetExists(mixed $offset) : bool
Both paymentId and payment_id address the same typed property.
Parameters
- $offset : mixed
-
PHP
camelCaseor wiresnake_casefield name.
Return values
booloffsetGet()
Reads a typed property through PHP `ArrayAccess`.
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
-
PHP
camelCaseor wiresnake_casefield name.
Return values
mixed —The PHP-native property value.
offsetSet()
Rejects mutation because domain values are immutable.
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
-
Ignored field name.
- $value : mixed
-
Ignored replacement value.
Tags
offsetUnset()
Rejects unsetting because domain values are immutable.
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
-
Ignored field name.
Tags
toArray()
Converts typed properties back to the API's wire representation.
public
toArray() : array<string, mixed>
Property names become snake_case. Nested values, arrays, backed enums, and timestamps are
normalized recursively so the result is safe to pass to json_encode().
Return values
array<string, mixed> —The recursively normalized API object.
usedOrderId()
Returns the consuming order ID for a used single-use purchase intent, or null when none exists.
public
usedOrderId() : string|null