Copied!

PaymentCreateStruct

PaymentCreateStruct.php : 32
Extends ValueObject

Structure containing data used to create a payment.

The following example creates a payment for an order with a total gross amount of 100 EUR:

$createStruct = new PaymentCreateStruct($paymentMethod, $order, Money::EUR(10000));
$createStruct->setContext(new ArrayMap(['channel' => 'shop']));

$payment = $paymentService->createPayment($createStruct);
Tags
See
PaymentServiceInterface::createPayment()

Methods

public__construct()

PaymentCreateStruct.php : 47

Construct object optionally with a set of properties.

public __construct(PaymentMethodInterface $method, OrderInterface $order[, Money|null $amount = null ])

Readonly properties values must be set using $properties as they are not writable anymore after object has been created.

Parameters

Name Type Default value Description
$method PaymentMethodInterface - -
$order OrderInterface - -
$amount Money|null null -

publicgetAmount()

PaymentCreateStruct.php : 103
public getAmount() : Money

Return values

Money

publicgetContext()

PaymentCreateStruct.php : 136

Returns the payment context.

public getContext() : MapInterface<string, mixed>|null

The context is a set of key-value pairs that can be used to store additional information about the payment.

Return values

MapInterface<string, mixed>|null

publicgetIdentifier()

PaymentCreateStruct.php : 61

Returns the payment identifier. If not set, the identifier will be generated automatically.

public getIdentifier() : string|null

Identifier is a unique string that identifies the payment.

Return values

string|null

publicgetMethod()

PaymentCreateStruct.php : 77
public getMethod() : PaymentMethodInterface

Return values

PaymentMethodInterface

publicgetOrder()

PaymentCreateStruct.php : 90

Returns the order associated with the payment.

public getOrder() : OrderInterface

Return values

OrderInterface

publicgetOwner()

PaymentCreateStruct.php : 116

Returns the user who owns the payment. If not set, the owner will be set automatically to the current user reference.

public getOwner() : UserReference|null

Return values

UserReference|null

publicsetAmount()

PaymentCreateStruct.php : 108
public setAmount(Money $amount) : void

Parameters

Name Type Default value Description
$amount Money - -

publicsetContext()

PaymentCreateStruct.php : 148

Sets the payment context.

public setContext(MapInterface<string, mixed>|null $context) : void

The context is a set of key-value pairs that can be used to store additional information about the payment.

Parameters

Name Type Default value Description
$context MapInterface<string, mixed>|null - -

publicsetIdentifier()

PaymentCreateStruct.php : 72

Sets the payment identifier. If not set, the identifier will be generated automatically.

public setIdentifier(string|null $identifier) : void

Identifier must be unique and contain only alphanumeric characters, hyphen, dashes, and underscores. Maximum allowed identifier length is 64 characters.

Parameters

Name Type Default value Description
$identifier string|null - -

publicsetMethod()

PaymentCreateStruct.php : 82
public setMethod(PaymentMethodInterface $method) : void

Parameters

Name Type Default value Description
$method PaymentMethodInterface - -

publicsetOrder()

PaymentCreateStruct.php : 98

Sets the order associated with the payment.

public setOrder(OrderInterface $order) : void

Parameters

Name Type Default value Description
$order OrderInterface - -

publicsetOwner()

PaymentCreateStruct.php : 124

Sets the user who owns the payment. If not set, the owner will be set automatically to the current user reference.

public setOwner(UserReference|null $owner) : void

Parameters

Name Type Default value Description
$owner UserReference|null - -

protectedgetProperties()

ValueObject.php : 50

Function where list of properties are returned.

protected getProperties([array<string|int, mixed> $dynamicProperties = [] ]) : array<string|int, mixed>

Used by attributes(), override to add dynamic properties

Parameters

Name Type Default value Description
$dynamicProperties array<string|int, mixed> []

Additional dynamic properties exposed on the object

Return values

array<string|int, mixed>