# Data objects

Service methods return these readonly data objects. Resources extend [`Resource`](#resource), so each also has its `id`, `type` and raw `attributes`, and its methods. An enum-typed property is `null` for a value the package does not know; read the raw value with `attribute('dot.key')`.

Types are named by their short name. Data objects are in `Luigel\Paymongo\Data` (shared shapes like `Billing` in `Luigel\Paymongo\Data\Shared`), enums in `Luigel\Paymongo\Enums`.

## Resource

`Luigel\Paymongo\Data\Resource`

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `type` | `string` |  |
| `attributes` | `array<string, mixed>` |  |

Methods:

- `attribute(string $key, mixed $default = null): mixed`: Read a raw attribute using dot notation, e.g. `attribute('billing.address.city')`.
- `toArray(): array`
- `createdAt(): ?CarbonImmutable`
- `updatedAt(): ?CarbonImmutable`

## CheckoutSession

`Luigel\Paymongo\Data\CheckoutSession` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `lineItems` | [`list<LineItem>`](#lineitem) |  |
| `paymentIntent` | [`?PaymentIntent`](#paymentintent) | The payment intent PayMongo creates for the session. |
| `payments` | [`list<Payment>`](#payment) |  |
| `billing` | [`?Billing`](#billing) |  |
| `checkoutUrl` | `?string` |  |
| `clientKey` | `?string` |  |
| `referenceNumber` | `?string` |  |
| `status` | `?CheckoutSessionStatus` |  |
| `paymentMethodTypes` | `list<string>` |  |
| `sendEmailReceipt` | `bool` |  |
| `showDescription` | `bool` |  |
| `showLineItems` | `bool` |  |
| `description` | `?string` |  |
| `successUrl` | `?string` |  |
| `cancelUrl` | `?string` |  |
| `metadata` | `array<string, mixed>\|null` |  |

## Customer

`Luigel\Paymongo\Data\Customer` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `firstName` | `?string` |  |
| `lastName` | `?string` |  |
| `email` | `?string` |  |
| `phone` | `?string` |  |
| `defaultDevice` | `?DefaultDevice` |  |
| `defaultPaymentMethodId` | `?string` |  |
| `livemode` | `bool` |  |

## CustomerPaymentMethod

`Luigel\Paymongo\Data\CustomerPaymentMethod` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `paymentMethodId` | `?string` |  |
| `paymentMethodType` | `?string` |  |
| `sessionType` | `?string` |  |
| `details` | `array<string, mixed>\|null` |  |
| `livemode` | `bool` |  |

## Dispute

`Luigel\Paymongo\Data\Dispute` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `amount` | `?int` |  |
| `currency` | `?Currency` |  |
| `status` | `?DisputeStatus` |  |
| `reason` | `?string` |  |

Methods:

- `money(): ?Money`

## Link

`Luigel\Paymongo\Data\Link` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `amount` | `?int` |  |
| `archived` | `bool` |  |
| `currency` | `?Currency` |  |
| `description` | `?string` |  |
| `livemode` | `bool` |  |
| `fee` | `?int` |  |
| `checkoutUrl` | `?string` |  |
| `referenceNumber` | `?string` |  |
| `remarks` | `?string` |  |
| `status` | `?LinkStatus` |  |
| `payments` | [`list<Payment>`](#payment) |  |

Methods:

- `money(): ?Money`

## Payment

`Luigel\Paymongo\Data\Payment` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `amount` | `?int` |  |
| `currency` | `?Currency` |  |
| `status` | `?PaymentStatus` |  |
| `description` | `?string` |  |
| `statementDescriptor` | `?string` |  |
| `fee` | `?int` |  |
| `netAmount` | `?int` |  |
| `livemode` | `bool` |  |
| `billing` | [`?Billing`](#billing) |  |
| `source` | `array<string, mixed>\|null` | The `{id, type}` of the charged source. |
| `externalReferenceNumber` | `?string` |  |
| `paymentIntentId` | `?string` |  |
| `metadata` | `array<string, mixed>\|null` |  |

Methods:

- `money(): ?Money`
- `paidAt(): ?CarbonImmutable`

## PaymentIntent

`Luigel\Paymongo\Data\PaymentIntent` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `amount` | `?int` |  |
| `currency` | `?Currency` |  |
| `description` | `?string` |  |
| `statementDescriptor` | `?string` |  |
| `status` | `?PaymentIntentStatus` |  |
| `clientKey` | `?string` |  |
| `captureType` | `?CaptureType` |  |
| `livemode` | `bool` |  |
| `paymentMethodAllowed` | `list<string>` |  |
| `paymentMethodOptions` | `array<string, mixed>\|null` |  |
| `payments` | [`list<Payment>`](#payment) |  |
| `nextAction` | [`?NextAction`](#nextaction) |  |
| `lastPaymentError` | `array<string, mixed>\|null` |  |
| `setupFutureUsage` | `array<string, mixed>\|null` |  |
| `metadata` | `array<string, mixed>\|null` |  |

Methods:

- `money(): ?Money`

## PaymentMethod

`Luigel\Paymongo\Data\PaymentMethod` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `methodType` | `?PaymentMethodType` | The `type` attribute (card, gcash, ...); named methodType because $type holds the resource type. |
| `livemode` | `bool` |  |
| `billing` | [`?Billing`](#billing) |  |
| `details` | `array<string, mixed>\|null` |  |
| `metadata` | `array<string, mixed>\|null` |  |

## Payout

`Luigel\Paymongo\Data\Payout` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `amount` | `?int` |  |
| `netAmount` | `?int` |  |
| `fee` | `?int` |  |
| `taxAmount` | `?int` |  |
| `refundAmount` | `?int` |  |
| `disputeAmount` | `?int` |  |
| `adjustmentAmount` | `?int` |  |
| `currency` | `?Currency` |  |
| `status` | `?PayoutStatus` |  |
| `bankAccountName` | `?string` |  |
| `bankAccountNumber` | `?string` |  |
| `bankName` | `?string` |  |
| `livemode` | `bool` |  |

Methods:

- `money(): ?Money`: The net amount actually deposited, falling back to the gross amount.

## PayoutSchedule

`Luigel\Paymongo\Data\PayoutSchedule` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `scheduleType` | `?string` |  |
| `options` | `list<string>` |  |
| `lineup` | `array<array-key, mixed>` |  |

## PayoutTransaction

`Luigel\Paymongo\Data\PayoutTransaction` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `amount` | `?int` |  |
| `currency` | `?Currency` |  |
| `netAmount` | `?int` |  |
| `fee` | `?int` |  |

Methods:

- `transactionType(): ?string`: The transaction kind (`payment`, `refund`, `dispute`, `adjustment`, `split_payment`, `split_refund`), read from the resource type.
- `money(): ?Money`

## Plan

`Luigel\Paymongo\Data\Plan` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `amount` | `?int` |  |
| `currency` | `?Currency` |  |
| `description` | `?string` |  |
| `interval` | `?PlanInterval` |  |
| `intervalCount` | `?int` |  |
| `name` | `?string` |  |
| `planType` | `?string` |  |
| `cycleCount` | `?int` |  |
| `livemode` | `bool` |  |

Methods:

- `money(): ?Money`

## Refund

`Luigel\Paymongo\Data\Refund` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `amount` | `?int` |  |
| `currency` | `?Currency` |  |
| `livemode` | `bool` |  |
| `notes` | `?string` |  |
| `paymentId` | `?string` |  |
| `reason` | `?RefundReason` |  |
| `status` | `?RefundStatus` |  |
| `metadata` | `array<string, mixed>\|null` |  |

Methods:

- `money(): ?Money`
- `refundedAt(): ?CarbonImmutable`

## Source

`Luigel\Paymongo\Data\Source` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `amount` | `?int` |  |
| `currency` | `?Currency` |  |
| `sourceType` | `?PaymentMethodType` | The `type` attribute (gcash, grab_pay); named sourceType because $type holds the resource type. |
| `status` | `?string` |  |
| `description` | `?string` |  |
| `statementDescriptor` | `?string` |  |
| `livemode` | `bool` |  |
| `billing` | [`?Billing`](#billing) |  |
| `redirect` | [`?Redirect`](#redirect) |  |

Methods:

- `money(): ?Money`

## StaticQr

`Luigel\Paymongo\Data\StaticQr` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `mobileNumber` | `?string` |  |
| `qrImage` | `?string` |  |
| `name` | `?string` |  |

## Subscription

`Luigel\Paymongo\Data\Subscription` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `customerId` | `?string` |  |
| `planId` | `?string` |  |
| `plan` | [`?Plan`](#plan) | The full plan resource nested in the payload. |
| `paymentMethodId` | `?string` |  |
| `status` | `?SubscriptionStatus` |  |
| `anchorDate` | `?CarbonImmutable` |  |
| `nextBillingSchedule` | `?CarbonImmutable` |  |
| `cancelledAt` | `?CarbonImmutable` |  |
| `cancellationReason` | `?CancellationReason` |  |
| `latestInvoice` | `array<string, mixed>\|null` |  |
| `setupIntent` | `array<string, mixed>\|null` |  |
| `livemode` | `bool` |  |

## Webhook

`Luigel\Paymongo\Data\Webhook` extends [`Resource`](#resource)

| Property | Type | Description |
| --- | --- | --- |
| `url` | `?string` |  |
| `status` | `?WebhookStatus` |  |
| `secretKey` | `?string` | The endpoint's signing secret, used to verify inbound events. |
| `livemode` | `bool` |  |
| `events` | `list<string>` |  |

## Address

`Luigel\Paymongo\Data\Shared\Address`

| Property | Type | Description |
| --- | --- | --- |
| `line1` | `?string` |  |
| `line2` | `?string` |  |
| `city` | `?string` |  |
| `state` | `?string` |  |
| `postalCode` | `?string` |  |
| `country` | `?string` |  |

## ApiError

`Luigel\Paymongo\Data\ApiError`

| Property | Type | Description |
| --- | --- | --- |
| `code` | `?string` |  |
| `detail` | `?string` |  |
| `pointer` | `?string` |  |
| `attribute` | `?string` |  |

## Billing

`Luigel\Paymongo\Data\Shared\Billing`

| Property | Type | Description |
| --- | --- | --- |
| `name` | `?string` |  |
| `email` | `?string` |  |
| `phone` | `?string` |  |
| `address` | [`?Address`](#address) |  |

## LineItem

`Luigel\Paymongo\Data\LineItem`

| Property | Type | Description |
| --- | --- | --- |
| `amount` | `?int` |  |
| `currency` | `?Currency` |  |
| `description` | `?string` |  |
| `images` | `list<string>` |  |
| `name` | `?string` |  |
| `quantity` | `?int` |  |

Methods:

- `money(): ?Money`: The per-unit amount as a money value.

## MpmQr

`Luigel\Paymongo\Data\MpmQr`

| Property | Type | Description |
| --- | --- | --- |
| `id` | `?string` |  |
| `status` | `?QrStatus` |  |
| `type` | `?QrType` |  |
| `mode` | `?QrMode` |  |
| `nation` | `?string` |  |
| `qrString` | `?string` |  |
| `qrImage` | `?string` |  |
| `transactionAmount` | `?int` |  |
| `transactionCurrency` | `?string` |  |
| `merchantName` | `?string` |  |
| `merchantCity` | `?string` |  |
| `expiresAt` | `?CarbonImmutable` |  |
| `createdAt` | `?CarbonImmutable` |  |
| `updatedAt` | `?CarbonImmutable` |  |
| `raw` | `array<string, mixed>` | The full flat `data` object. |

Methods:

- `money(): ?Money`: The transaction amount of a dynamic QR, as money.
- `attribute(string $key, mixed $default = null): mixed`: Read a raw field using dot notation, e.g. `attribute('metadata.order_id')`.

## NextAction

`Luigel\Paymongo\Data\Shared\NextAction`

| Property | Type | Description |
| --- | --- | --- |
| `type` | `?string` |  |
| `url` | `?string` |  |
| `returnUrl` | `?string` |  |

## PaymentLink

`Luigel\Paymongo\Data\PaymentLink`

| Property | Type | Description |
| --- | --- | --- |
| `id` | `?string` |  |
| `amount` | `?int` |  |
| `currency` | `?string` |  |
| `description` | `?string` |  |
| `remarks` | `?string` |  |
| `status` | `?PaymentLinkStatus` |  |
| `livemode` | `?bool` |  |
| `url` | `?string` |  |
| `referenceNumber` | `?string` |  |
| `metadata` | `array<string, mixed>\|null` |  |
| `restrictions` | `array<string, mixed>\|null` |  |
| `createdAt` | `?CarbonImmutable` |  |
| `updatedAt` | `?CarbonImmutable` |  |
| `raw` | `array<string, mixed>` | The full flat `data` object. |

Methods:

- `money(): ?Money`
- `attribute(string $key, mixed $default = null): mixed`: Read a raw field using dot notation, e.g. `attribute('restrictions.completed_sessions')`.

## QrExecution

`Luigel\Paymongo\Data\QrExecution`

| Property | Type | Description |
| --- | --- | --- |
| `id` | `?string` |  |
| `status` | `?string` |  |
| `referenceNumber` | `?string` |  |
| `amount` | `?int` |  |
| `raw` | `array<string, mixed>` | The full flat `data` object. |

Methods:

- `money(): ?Money`
- `attribute(string $key, mixed $default = null): mixed`: Read a raw field using dot notation, e.g. `attribute('metadata.order_id')`.

## Redirect

`Luigel\Paymongo\Data\Shared\Redirect`

| Property | Type | Description |
| --- | --- | --- |
| `success` | `?string` |  |
| `failed` | `?string` |  |
| `checkoutUrl` | `?string` |  |
