<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class CheckoutOptions implements \JsonSerializable { private $allowTipping; private $customFields; private $subscriptionPlanId; private $redirectUrl; private $merchantSupportEmail; private $askForShippingAddress; private $acceptedPaymentMethods; public function getAllowTipping(): ?bool { return $this->allowTipping; } public function setAllowTipping(?bool $allowTipping): void { $this->allowTipping = $allowTipping; } public function getCustomFields(): ?array { return $this->customFields; } public function setCustomFields(?array $customFields): void { $this->customFields = $customFields; } public function getSubscriptionPlanId(): ?string { return $this->subscriptionPlanId; } public function setSubscriptionPlanId(?string $subscriptionPlanId): void { $this->subscriptionPlanId = $subscriptionPlanId; } public function getRedirectUrl(): ?string { return $this->redirectUrl; } public function setRedirectUrl(?string $redirectUrl): void { $this->redirectUrl = $redirectUrl; } public function getMerchantSupportEmail(): ?string { return $this->merchantSupportEmail; } public function setMerchantSupportEmail(?string $merchantSupportEmail): void { $this->merchantSupportEmail = $merchantSupportEmail; } public function getAskForShippingAddress(): ?bool { return $this->askForShippingAddress; } public function setAskForShippingAddress(?bool $askForShippingAddress): void { $this->askForShippingAddress = $askForShippingAddress; } public function getAcceptedPaymentMethods(): ?AcceptedPaymentMethods { return $this->acceptedPaymentMethods; } public function setAcceptedPaymentMethods(?AcceptedPaymentMethods $acceptedPaymentMethods): void { $this->acceptedPaymentMethods = $acceptedPaymentMethods; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->allowTipping)) { $json['allow_tipping'] = $this->allowTipping; } if (isset($this->customFields)) { $json['custom_fields'] = $this->customFields; } if (isset($this->subscriptionPlanId)) { $json['subscription_plan_id'] = $this->subscriptionPlanId; } if (isset($this->redirectUrl)) { $json['redirect_url'] = $this->redirectUrl; } if (isset($this->merchantSupportEmail)) { $json['merchant_support_email'] = $this->merchantSupportEmail; } if (isset($this->askForShippingAddress)) { $json['ask_for_shipping_address'] = $this->askForShippingAddress; } if (isset($this->acceptedPaymentMethods)) { $json['accepted_payment_methods'] = $this->acceptedPaymentMethods; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 