PaymentCreateStruct
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
Methods¶
                 __construct()
            ¶
__construct()
            ¶
    
        Construct object optionally with a set of properties.
|  |  | 
Readonly properties values must be set using $properties as they aren't writable anymore
after object has been created.
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| $method | PaymentMethodInterface | - | - | 
| $order | OrderInterface | - | - | 
| $amount | Money|null | null | - | 
                 getAmount()
            ¶
getAmount()
            ¶
    
        |  |  | 
Return values
Money
                 getContext()
            ¶
getContext()
            ¶
    
        Returns the payment context.
|  |  | 
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
                 getIdentifier()
            ¶
getIdentifier()
            ¶
    
        Returns the payment identifier. If not set, the identifier will be generated automatically.
|  |  | 
Identifier is a unique string that identifies the payment.
Return values
string|null
                 getMethod()
            ¶
getMethod()
            ¶
    
        |  |  | 
Return values
                 getOrder()
            ¶
getOrder()
            ¶
    
        Returns the order associated with the payment.
|  |  | 
Return values
                 getOwner()
            ¶
getOwner()
            ¶
    
        Returns the user who owns the payment. If not set, the owner will be set automatically to the current user reference.
|  |  | 
Return values
UserReference|null
                 setAmount()
            ¶
setAmount()
            ¶
    
        |  |  | 
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| $amount | Money | - | - | 
                 setContext()
            ¶
setContext()
            ¶
    
        Sets the payment context.
|  |  | 
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 | - | - | 
                 setIdentifier()
            ¶
setIdentifier()
            ¶
    
        Sets the payment identifier. If not set, the identifier will be generated automatically.
|  |  | 
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 | - | - | 
                 setMethod()
            ¶
setMethod()
            ¶
    
        |  |  | 
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| $method | PaymentMethodInterface | - | - | 
                 setOrder()
            ¶
setOrder()
            ¶
    
        Sets the order associated with the payment.
|  |  | 
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| $order | OrderInterface | - | - | 
                 setOwner()
            ¶
setOwner()
            ¶
    
        Sets the user who owns the payment. If not set, the owner will be set automatically to the current user reference.
|  |  | 
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| $owner | UserReference|null | - | - | 
                 getProperties()
            ¶
getProperties()
            ¶
    
        Returns list of available properties' names.
|  |  | 
Override to add dynamic properties.
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| $dynamicProperties | array<int, string> | [] | Additional dynamic properties exposed on the object | 
Return values
array<int, string>