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
3 changes: 3 additions & 0 deletions lib/Checkout/Payments/AccommodationAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Checkout\Payments;

/**
* The address details of the accommodation.
*/
class AccommodationAddress
{
/**
Expand Down
25 changes: 23 additions & 2 deletions lib/Checkout/Payments/AccommodationData.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use DateTime;
use Checkout\Common\DateOnly;

/**
* Contains information about the accommodation booked by the customer.
*/
class AccommodationData
{
/**
Expand Down Expand Up @@ -67,13 +70,31 @@

/**
* The list of guests staying at the accommodation.
* @var array of AccommodationGuest
* @var AccommodationGuest[]
*/
public $guests;

/**
* The room details and rates.
* @var array of AccommodationRoom
* [Optional]
*
* @var AccommodationRoom[]
*/
public $room;

/**
* The property's phone information.
* [Optional]
*
* @var AccommodationPhone[]
*/
public $property_phone;

Check warning on line 91 in lib/Checkout/Payments/AccommodationData.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$property_phone" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaDnZYq-B6PT0_rdQPQ_&open=AaDnZYq-B6PT0_rdQPQ_&pullRequest=384

/**
* The customer service phone information.
* [Optional]
*
* @var AccommodationPhone[]
*/
public $customer_service_phone;

Check warning on line 99 in lib/Checkout/Payments/AccommodationData.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$customer_service_phone" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaDnZYq-B6PT0_rdQPRA&open=AaDnZYq-B6PT0_rdQPRA&pullRequest=384
}
3 changes: 3 additions & 0 deletions lib/Checkout/Payments/AccommodationGuest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use DateTime;
use Checkout\Common\DateOnly;

/**
* Contains information about a guest staying at the accommodation.
*/
class AccommodationGuest
{
/**
Expand Down
25 changes: 25 additions & 0 deletions lib/Checkout/Payments/AccommodationPhone.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Checkout\Payments;

/**
* Phone contact information for an accommodation property.
*/
class AccommodationPhone
{
/**
* The phone country code.
* [Optional]
*
* @var string
*/
public $country_code;

Check warning on line 16 in lib/Checkout/Payments/AccommodationPhone.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$country_code" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaDnZYuqB6PT0_rdQPRB&open=AaDnZYuqB6PT0_rdQPRB&pullRequest=384

/**
* The phone number.
* [Optional]
*
* @var string
*/
public $number;
}
3 changes: 3 additions & 0 deletions lib/Checkout/Payments/AccommodationRoom.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Checkout\Payments;

/**
* Contains information about a room booked by the customer.
*/
class AccommodationRoom
{
/**
Expand Down
34 changes: 32 additions & 2 deletions lib/Checkout/Payments/AirlineData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,50 @@

namespace Checkout\Payments;

/**
* Contains information about the airline ticket and flights booked by the customer.
*/
class AirlineData
{
/**
* Contains information about the airline ticket.
* [Optional]
*
* @var Ticket
*/
public $ticket;

/**
* @var array of Passenger
* Contains information about the passenger(s) on the flight.
* [Optional]
*
* Assign a single Passenger for one passenger, not a one-element array. Verified against the
* sandbox on 2026-09-25 with a complete airline_data block:
*
* surface passenger: object passenger: array
* POST /payments 201 201
* POST /hosted-payments accepted 422 processing_airline_data_0_passenger_invalid
* POST /payment-links accepted 422 processing_airline_data_0_passenger_invalid
* POST /payment-contexts 201 422 passenger_required
*
* A single object is accepted on every request surface; an array only on POST /payments.
* The specification declares the opposite, and ProcessingSettings is shared by POST /payments,
* hosted payments and payment links, so an array is not a safe default. An empty array and a
* null are both rejected, so leave the property unset when there are no passengers: the
* serializer omits nulls.
*
* Several passengers can only be expressed as an array, which only POST /payments accepts.
* That is an API limitation, not an SDK choice. Recorded in the plan under P1.
*
* @var Passenger|Passenger[]
*/
public $passenger;

/**
* @var array of FlightLegDetails
* Contains information about the flight leg(s) booked by the customer.
* [Optional]
*
* @var FlightLegDetails[]
*/
public $flight_leg_details;
}
36 changes: 31 additions & 5 deletions lib/Checkout/Payments/Contexts/PaymentContextsAirlineData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,46 @@

namespace Checkout\Payments\Contexts;

/**
* Contains information about the airline ticket and flights booked by the customer.
*/
class PaymentContextsAirlineData
{
/**
* @var array of Checkout\Payments\Contexts\PaymentContextsTicket
* Contains information about the airline ticket.
* [Optional]
*
* The specification declares this as a single object. It was previously named $tickets and
* documented as an array, so the SDK sent an array under the key "tickets", which the API
* does not define: the value never reached the gateway.
*
* @var PaymentContextsTicket
*/
public $tickets;
public $ticket;

/**
* @var array of Checkout\Payments\Contexts\PaymentContextsPassenger
* Contains information about the passenger(s) on the flight.
* [Optional]
*
* It was previously named $passengers, so the SDK sent the key "passengers", which the API
* does not define: the value never reached the gateway.
*
* Assign a single PaymentContextsPassenger, not an array. Verified against the sandbox on
* 2026-09-25: POST /payment-contexts rejects the array form with 422 passenger_required and
* accepts a single object. A single object is accepted on every request surface, while an
* array is accepted only on POST /payments. This is the opposite of what the specification
* declares, and is recorded in the plan under P1. An array of two or more is the only way to
* express several passengers, and only POST /payments accepts it.
*
* @var PaymentContextsPassenger|PaymentContextsPassenger[]
*/
public $passengers;
public $passenger;

/**
* @var array of Checkout\Payments\Contexts\PaymentContextsFlightLegDetails
* Contains information about the flight leg(s) booked by the customer.
* [Optional]
*
* @var PaymentContextsFlightLegDetails[]
*/
public $flight_leg_details;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use Checkout\Common\DateOnly;

/**
* Contains information about a flight leg booked by the customer.
*/
class PaymentContextsFlightLegDetails
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

namespace Checkout\Payments\Contexts;

/**
* A key-and-value pair with merchant-specific data for the transaction.
*
* @deprecated Duplicates Checkout\Payments\PartnerCustomerRiskData, which maps the same
* specification shape and is what PaymentContextsProcessing now uses. Maintaining two identical
* classes for one schema invited drift. Retained for backwards compatibility and will be removed
* in a future version.
*/
class PaymentContextsPartnerCustomerRiskData
{
/**
Expand Down
3 changes: 3 additions & 0 deletions lib/Checkout/Payments/Contexts/PaymentContextsPassenger.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use Checkout\Common\Address;
use Checkout\Common\DateOnly;

/**
* Contains information about a passenger on the flight.
*/
class PaymentContextsPassenger
{
/**
Expand Down
98 changes: 93 additions & 5 deletions lib/Checkout/Payments/Contexts/PaymentContextsProcessing.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,138 @@

namespace Checkout\Payments\Contexts;

use Checkout\Payments\AccommodationData;
use Checkout\Payments\BillingPlan;
use Checkout\Payments\PartnerCustomerRiskData;

/**
* Settings that control how the payment context is processed.
*/
class PaymentContextsProcessing
{
/**
* @var string value of BillingPlan
* The plan details for a recurring payment with PayPal.
* Required when payment_type is recurring.
* [Optional]
*
* Previously named $billing_plan, so the SDK sent the key "billing_plan"; the specification
* declares this property as "plan", so the value never reached the gateway.
*
* @var BillingPlan
*/
public $plan;

/**
* The discount amount the merchant applied to the transaction.
* [Optional]
* minimum 0
*
* @var float
*/
public $billing_plan;
public $discount_amount;

Check warning on line 33 in lib/Checkout/Payments/Contexts/PaymentContextsProcessing.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$discount_amount" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaDnZYzIB6PT0_rdQPRE&open=AaDnZYzIB6PT0_rdQPRE&pullRequest=384

/**
* @var int
* The total freight or shipping and handling charges for the transaction.
* [Optional]
*
* @var float
*/
public $shipping_amount;

/**
* The total tax amount for the transaction, in the minor currency unit.
* [Optional]
*
* @var float
*/
public $tax_amount;

Check warning on line 49 in lib/Checkout/Payments/Contexts/PaymentContextsProcessing.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$tax_amount" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaDnZYzIB6PT0_rdQPRF&open=AaDnZYzIB6PT0_rdQPRF&pullRequest=384

/**
* Invoice ID number.
* [Optional]
*
* @var string
*/
public $invoice_id;

/**
* The label that overrides the business name in the PayPal account on the PayPal pages.
* [Optional]
*
* @var string
*/
public $brand_name;

/**
* The language and region of the customer in ISO 639-2 language code; the value consists of
* language-country.
* [Optional]
*
* @var string
*/
public $locale;

/**
* Shipping preference.
* [Optional]
* One of: no_shipping, set_provided_address, get_from_file
*
* @var string value of ShippingPreference
*/
public $shipping_preference;

/**
* Property required by PayPal to have an appropriate payment flow.
* [Optional]
* One of: pay_now, continue
*
* @var string value of UserAction
*/
public $user_action;

/**
* @var array of PaymentContextsPartnerCustomerRiskData
* Key-and-value pairs with merchant-specific data for the transaction.
* [Optional]
*
* Uses the shared Checkout\Payments\PartnerCustomerRiskData: payment contexts and the
* payments request schemas resolve partner_customer_risk_data to the same specification
* shape, and maintaining two identical classes for it invited drift.
*
* A single object, not a collection. The specification declares it as one object with
* `key` and `value`, even though its description calls it "an array of key-and-value
* pairs". The sandbox accepts both shapes; this follows the declared one, which Java,
* .NET, Go and Ruby also use.
*
* @var PartnerCustomerRiskData
*/
public $partner_customer_risk_data;

/**
* @var array of PaymentContextsAirlineData
* Promo codes. They define which of the configured payment options within a payment category
* (pay_later, pay_over_time, and so on) are shown for this purchase.
* [Optional]
*
* @var string[]
*/
public $custom_payment_method_ids;

Check warning on line 118 in lib/Checkout/Payments/Contexts/PaymentContextsProcessing.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$custom_payment_method_ids" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaDnZYzIB6PT0_rdQPRG&open=AaDnZYzIB6PT0_rdQPRG&pullRequest=384

/**
* Contains information about the airline ticket and flights booked by the customer.
* [Optional]
*
* @var PaymentContextsAirlineData[]
*/
public $airline_data;

/**
* Contains information about the accommodation booked by the customer.
* [Optional]
*
* Uses the shared AccommodationData: payment contexts, POST /payments and the
* GET /payments/{id} response all resolve accommodation_data to the same specification
* schema.
*
* @var AccommodationData[]
*/
public $accommodation_data;

Check warning on line 138 in lib/Checkout/Payments/Contexts/PaymentContextsProcessing.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$accommodation_data" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaDnZYzIB6PT0_rdQPRH&open=AaDnZYzIB6PT0_rdQPRH&pullRequest=384
}
3 changes: 3 additions & 0 deletions lib/Checkout/Payments/Contexts/PaymentContextsTicket.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use Checkout\Common\DateOnly;

/**
* Contains information about the airline ticket.
*/
class PaymentContextsTicket
{
/**
Expand Down
Loading
Loading