About PostFinance Checkout Payment Gateway for Commerce
"PostFinance Checkout is the most practical all-in-one payment solution for Swiss online shops – a contractual partner, a plug-in and five payment options for your customers: PostFinance Card, PostFinance e-finance, TWINT, Visa and Mastercard." https://www.postfinance.ch/en/business/products/e-commerce/postfinance-checkout-all-in-one.html
August 25, 2023
2.6 - Current
Setup the Module
Once installed, navigate to Commerce in the MODX manager. Select the Configuration tab and then click on Modules. Find Commerce_PFCheckout in the module list and click on it to make a window pop up where you can enable the module for Test Mode, Live Mode, or both.
Now the module is enabled, you can click on the Payment Methods tab on the left. Then click Add a Payment Method. Select PostFinance Checkout from the Gateway dropdown box and then give it a name e.g. PostFinance Checkout. Next, click on the availability tab and enable it for test or live modes and then click save.
After saving, you'll see an extra PostFinance Checkout tab appears at the top of the window. Here you can enter your PostFinance Checkout API credentials: Space id, User id and the Secret key
Congratulations! PostFinance Checkout should now appear as a payment method a customer can use during checkout.
Customize the Markup
On the payment page of the checkout process in Commerce, the PostFinance Checkout payment method is displayed according to a default twig template located in your MODX install at: core/components/commerce_pfcheckout/templates/frontend/gateways/postfinancegateway.twig
There is a system setting in the commerce_pfcheckout namespace called commerce_pfcheckout.payment_template. The default value is frontend/gateways/postfinancegateway.twig
If you would like to customise the default template, don't edit the file directly as it will be overwritten in future upgrades. Instead, create a new file in the same location with a different name e.g. mycustomtemplate.twig and update the system setting's value.
For example: frontend/gateways/mycustomtemplate.twig. The module will then use your custom template automatically. Setup in the PostFinance Checkout Portal
Besides the template, most configuration takes place inside PostFinance Checkout's merchant portal. You need to setup your which payment methods you want to accept, and you can customise the look of the payment page the customer is redirected to.
You will also need to get your three authentication details here:
- Space id
- User id
- Secret Key
New in 1.0.4-pl
Use Commerce EventDispatcher wrapper [cfe21c5]