Examples

Callbacks

Post Shopping Cart Checkout Callback

Here is an example of creating a callback for a payment gateway to create a payment. The conditions need to be met.

 $callbackId = $retailysService->postShoppingCartCheckoutCallback($token, [
                    'position' => 'payment',
                    'path' => 'create-payment',
                    'method' => 'POST',
                    'redirect' => true,
                    'parameters' => [
                        [
                            'name' => 'orderId',
                            'variable' => '%orderId%',
                        ],
                        [
                            'name' => 'channelId',
                            'variable' => '%channelId%',
                        ],
                    ],
                    'condition' => '%channelId% == '.$existingChannel->getChannelId().' and %paymentProvider% == 9',
                ]);

Endpoint /System/Layouts/Eshop/ShoppingCart/Checkout/Callbacks to an API where you can easily try it out.

View rendering

Here is an example of how to render a view into which variables are inserted so that we can use them in the template. The snippet is here returned in JSON.

Snippets

Static Snippet

Post Layout

Create a static snippet in eshop layout

Endpoint /System/Layouts/Eshop/Layout/StaticSnippets to an API where you can easily try it out.

Put Layout

Update a static snippet in eshop layout

Endpoint /System/Layouts/Eshop/Layout/StaticSnippets to an API where you can easily try it out.

Dynamic Snippet

Post dynamic snippet into shopping cart on thank you page

Endpoint /System/Layouts/Eshop/ShoppingCart/Thankyou/DynamicSnippets to an API where you can easily try it out.

Last updated

Was this helpful?