Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
}
}
},
"sdkVersion": "45.0.0.20260122"
"sdkVersion": "44.1.0.20260520"
}
10 changes: 10 additions & 0 deletions .fern/replay.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ phpstan.neon
src/Exceptions/SquareApiException.php
src/Legacy
src/Utils/WebhooksHelper.php
tests/Integration
tests/Integration
.fern/replay.lock
.fern/replay.yml
.gitattributes
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.fern/replay.lock linguist-generated=true
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "square/square",
"version": "45.0.0.20260122",
"version": "44.1.0.20260520",
"description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.",
"keywords": [
"square",
Expand Down
26 changes: 26 additions & 0 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -10967,6 +10967,19 @@ For more information, see [Permissions](https://developer.squareup.com/docs/paym
<dl>
<dd>

**$appFeeAllocations:** `?array`

Details pertaining to recipients of the application fee. The sum of the amounts in the
app_fee_allocations must equal the app_fee_money amount, if present. If populated, an
allocation must be present for every party that expects to receive a portion of the application
fee, including the application developer.

</dd>
</dl>

<dl>
<dd>

**$delayDuration:** `?string`

The duration of time after the payment's creation when Square automatically
Expand Down Expand Up @@ -12172,6 +12185,19 @@ For more information, see [Permissions](https://developer.squareup.com/docs/paym
<dl>
<dd>

**$appFeeAllocations:** `?array`

Details pertaining to contributors to the refund of the application fee.
The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if
present. If populated, an allocation must be present for every party that expects to contribute
a portion of the refunded application fee, including the application developer.

</dd>
</dl>

<dl>
<dd>

**$paymentId:** `?string`

The unique ID of the payment being refunded.
Expand Down
32 changes: 32 additions & 0 deletions src/Payments/Requests/CreatePaymentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Square\Core\Json\JsonSerializableType;
use Square\Core\Json\JsonProperty;
use Square\Types\Money;
use Square\Core\Types\ArrayType;
use Square\Types\Address;
use Square\Types\CashPaymentDetails;
use Square\Types\ExternalPaymentDetails;
Expand Down Expand Up @@ -98,6 +99,17 @@ class CreatePaymentRequest extends JsonSerializableType
#[JsonProperty('app_fee_money')]
private ?Money $appFeeMoney;

/**
* Details pertaining to recipients of the application fee. The sum of the amounts in the
* app_fee_allocations must equal the app_fee_money amount, if present. If populated, an
* allocation must be present for every party that expects to receive a portion of the application
* fee, including the application developer.
*
* @var ?array<mixed> $appFeeAllocations
*/
#[JsonProperty('app_fee_allocations'), ArrayType(['mixed'])]
private ?array $appFeeAllocations;

/**
* The duration of time after the payment's creation when Square automatically
* either completes or cancels the payment depending on the `delay_action` field value.
Expand Down Expand Up @@ -303,6 +315,7 @@ class CreatePaymentRequest extends JsonSerializableType
* amountMoney?: ?Money,
* tipMoney?: ?Money,
* appFeeMoney?: ?Money,
* appFeeAllocations?: ?array<mixed>,
* delayDuration?: ?string,
* delayAction?: ?string,
* autocomplete?: ?bool,
Expand Down Expand Up @@ -333,6 +346,7 @@ public function __construct(
$this->amountMoney = $values['amountMoney'] ?? null;
$this->tipMoney = $values['tipMoney'] ?? null;
$this->appFeeMoney = $values['appFeeMoney'] ?? null;
$this->appFeeAllocations = $values['appFeeAllocations'] ?? null;
$this->delayDuration = $values['delayDuration'] ?? null;
$this->delayAction = $values['delayAction'] ?? null;
$this->autocomplete = $values['autocomplete'] ?? null;
Expand Down Expand Up @@ -445,6 +459,24 @@ public function setAppFeeMoney(?Money $value = null): self
return $this;
}

/**
* @return ?array<mixed>
*/
public function getAppFeeAllocations(): ?array
{
return $this->appFeeAllocations;
}

/**
* @param ?array<mixed> $value
*/
public function setAppFeeAllocations(?array $value = null): self
{
$this->appFeeAllocations = $value;
$this->_setField('appFeeAllocations');
return $this;
}

/**
* @return ?string
*/
Expand Down
32 changes: 32 additions & 0 deletions src/Refunds/Requests/RefundPaymentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Square\Core\Json\JsonSerializableType;
use Square\Core\Json\JsonProperty;
use Square\Types\Money;
use Square\Core\Types\ArrayType;
use Square\Types\DestinationDetailsCashRefundDetails;
use Square\Types\DestinationDetailsExternalRefundDetails;

Expand Down Expand Up @@ -61,6 +62,17 @@ class RefundPaymentRequest extends JsonSerializableType
#[JsonProperty('app_fee_money')]
private ?Money $appFeeMoney;

/**
* Details pertaining to contributors to the refund of the application fee.
* The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if
* present. If populated, an allocation must be present for every party that expects to contribute
* a portion of the refunded application fee, including the application developer.
*
* @var ?array<mixed> $appFeeAllocations
*/
#[JsonProperty('app_fee_allocations'), ArrayType(['mixed'])]
private ?array $appFeeAllocations;

/**
* The unique ID of the payment being refunded.
* Required when unlinked=false, otherwise must not be set.
Expand Down Expand Up @@ -157,6 +169,7 @@ class RefundPaymentRequest extends JsonSerializableType
* idempotencyKey: string,
* amountMoney: Money,
* appFeeMoney?: ?Money,
* appFeeAllocations?: ?array<mixed>,
* paymentId?: ?string,
* destinationId?: ?string,
* unlinked?: ?bool,
Expand All @@ -175,6 +188,7 @@ public function __construct(
$this->idempotencyKey = $values['idempotencyKey'];
$this->amountMoney = $values['amountMoney'];
$this->appFeeMoney = $values['appFeeMoney'] ?? null;
$this->appFeeAllocations = $values['appFeeAllocations'] ?? null;
$this->paymentId = $values['paymentId'] ?? null;
$this->destinationId = $values['destinationId'] ?? null;
$this->unlinked = $values['unlinked'] ?? null;
Expand Down Expand Up @@ -241,6 +255,24 @@ public function setAppFeeMoney(?Money $value = null): self
return $this;
}

/**
* @return ?array<mixed>
*/
public function getAppFeeAllocations(): ?array
{
return $this->appFeeAllocations;
}

/**
* @param ?array<mixed> $value
*/
public function setAppFeeAllocations(?array $value = null): self
{
$this->appFeeAllocations = $value;
$this->_setField('appFeeAllocations');
return $this;
}

/**
* @return ?string
*/
Expand Down
6 changes: 3 additions & 3 deletions src/SquareClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ public function __construct(
$token ??= $this->getFromEnvOrThrow('SQUARE_TOKEN', 'Please pass in token or set the environment variable SQUARE_TOKEN.');
$defaultHeaders = [
'Authorization' => "Bearer $token",
'Square-Version' => '2026-01-22',
'Square-Version' => '2026-05-20',
'X-Fern-Language' => 'PHP',
'X-Fern-SDK-Name' => 'Square',
'X-Fern-SDK-Version' => '45.0.0.20260122',
'User-Agent' => 'square/square/45.0.0.20260122',
'X-Fern-SDK-Version' => '44.1.0.20260520',
'User-Agent' => 'square/square/44.1.0.20260520',
];
if ($version != null) {
$defaultHeaders['Square-Version'] = $version;
Expand Down
60 changes: 60 additions & 0 deletions src/Types/CardPaymentDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,26 @@ class CardPaymentDetails extends JsonSerializableType
#[JsonProperty('errors'), ArrayType([Error::class])]
private ?array $errors;

/**
* @var ?CardSurchargeDetails $appliedCardSurchargeDetails Additional information about a card_surcharge on the payment.
*/
#[JsonProperty('applied_card_surcharge_details')]
private ?CardSurchargeDetails $appliedCardSurchargeDetails;

/**
* The type of digital wallet used for this card payment, if applicable.
* Currently only populated for in-person Apple Pay payments. Detection has no false
* positives but may have false negatives (some Apple Pay payments may not be detected).
*
* For payments with `source_type` of `WALLET`, see `DigitalWalletDetails` instead.
*
* Values: `APPLE_PAY`
*
* @var ?string $walletType
*/
#[JsonProperty('wallet_type')]
private ?string $walletType;

/**
* @param array{
* status?: ?string,
Expand All @@ -158,6 +178,8 @@ class CardPaymentDetails extends JsonSerializableType
* cardPaymentTimeline?: ?CardPaymentTimeline,
* refundRequiresCardPresence?: ?bool,
* errors?: ?array<Error>,
* appliedCardSurchargeDetails?: ?CardSurchargeDetails,
* walletType?: ?string,
* } $values
*/
public function __construct(
Expand All @@ -179,6 +201,8 @@ public function __construct(
$this->cardPaymentTimeline = $values['cardPaymentTimeline'] ?? null;
$this->refundRequiresCardPresence = $values['refundRequiresCardPresence'] ?? null;
$this->errors = $values['errors'] ?? null;
$this->appliedCardSurchargeDetails = $values['appliedCardSurchargeDetails'] ?? null;
$this->walletType = $values['walletType'] ?? null;
}

/**
Expand Down Expand Up @@ -469,6 +493,42 @@ public function setErrors(?array $value = null): self
return $this;
}

/**
* @return ?CardSurchargeDetails
*/
public function getAppliedCardSurchargeDetails(): ?CardSurchargeDetails
{
return $this->appliedCardSurchargeDetails;
}

/**
* @param ?CardSurchargeDetails $value
*/
public function setAppliedCardSurchargeDetails(?CardSurchargeDetails $value = null): self
{
$this->appliedCardSurchargeDetails = $value;
$this->_setField('appliedCardSurchargeDetails');
return $this;
}

/**
* @return ?string
*/
public function getWalletType(): ?string
{
return $this->walletType;
}

/**
* @param ?string $value
*/
public function setWalletType(?string $value = null): self
{
$this->walletType = $value;
$this->_setField('walletType');
return $this;
}

/**
* @return string
*/
Expand Down
68 changes: 68 additions & 0 deletions src/Types/CardSurchargeDetails.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

namespace Square\Types;

use Square\Core\Json\JsonSerializableType;
use Square\Core\Json\JsonProperty;

/**
* Details related to an attempt to apply a card surcharge to this payment. When surcharge
* eligibility is not known in advance, such as when the card type (debit or credit) is required
* to make the eligibility determination, proposed_card_surcharge_money and
* proposed_additional_amount_money will match the values in the request, while card_surcharge_money
* and additional_amount_money are present only when the payment has a surcharge applied.
*/
class CardSurchargeDetails extends JsonSerializableType
{
/**
* A specific surcharge levied by the merchant, if a card payment is used, instead of cash or
* some other payment type. Should only include the base surcharge amount. Any additional fees related
* to the surcharge (e.g. taxes on the surcharge) should only be included in the additional_amount_money.
* This amount is specified in the smallest denomination of the applicable currency (for example,
* US dollar amounts are specified in cents). For more information, see
* [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
* The currency code must match the currency associated with the business that is accepting the
* payment.
*
* @var ?Money $cardSurchargeMoney
*/
#[JsonProperty('card_surcharge_money')]
private ?Money $cardSurchargeMoney;

/**
* @param array{
* cardSurchargeMoney?: ?Money,
* } $values
*/
public function __construct(
array $values = [],
) {
$this->cardSurchargeMoney = $values['cardSurchargeMoney'] ?? null;
}

/**
* @return ?Money
*/
public function getCardSurchargeMoney(): ?Money
{
return $this->cardSurchargeMoney;
}

/**
* @param ?Money $value
*/
public function setCardSurchargeMoney(?Money $value = null): self
{
$this->cardSurchargeMoney = $value;
$this->_setField('cardSurchargeMoney');
return $this;
}

/**
* @return string
*/
public function __toString(): string
{
return $this->toJson();
}
}
Loading
Loading