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 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()
            ¶
    
        | 
                     | 
                
                    
                     | 
            
Return values
Money
                
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()
            ¶
    
        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()
            ¶
    
        | 
                     | 
                
                    
                     | 
            
Return values
                
getOrder()
            ¶
    
        Returns the order associated with the payment.
| 
                     | 
                
                    
                     | 
            
Return values
                
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()
            ¶
    
        | 
                     | 
                
                    
                     | 
            
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| $amount | Money | - | - | 
                
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()
            ¶
    
        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()
            ¶
    
        | 
                     | 
                
                    
                     | 
            
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| $method | PaymentMethodInterface | - | - | 
                
setOrder()
            ¶
    
        Sets the order associated with the payment.
| 
                     | 
                
                    
                     | 
            
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| $order | OrderInterface | - | - | 
                
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()
            ¶
    
        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>
Attributes
- #[Ignore]