How can I customize Stripe Template in Sylius?

248 Views Asked by At

I need to customize the Stripe Checkout template in Sylius 1.4.

Things I tried so far but did not work:

1- I added this config to config.yaml: sylius_payum: template: layout: '@SyliusShop/payumlayout.html.twig' obtain_credit_card: '@SyliusShop/obtainCheckoutToken.html.twig'

2- I tried to override @SyliusPayum/Action/obtainCheckoutToken.html.twig. Interestingly editing this file itself does not change the template!.

The only way that the template changes is to edit @Payum/Stripe/Action/obtainCheckoutToken.html.twig.

How I can override this file in Sylius?

1

There are 1 best solutions below

0
Farshad Javadi On BEST ANSWER

So it turn out to be easy:

To override the file I needed to alter the config field of stripe_checkout record at sylius_gateway_config table of Sylius database as below.

UPDATE sylius_gateway_config SET config='{"publishable_key":"TEST_KEY","secret_key":"SECRET_KEY","payum.template.obtain_token":"SyliusPayumBundle::obtainCheckoutToken.html.twig","payum.template.layout":"SyliusPayumBundle::layout.html.twig"}' WHERE id=2

in my case the record id was 2.

SyliusPayumBundle::obtainCheckoutToken.html.twig and SyliusPayumBundle::layout.html.twig are the new overriding files.

The question is why the keys are not encrypted in the database and I think its not a good practice to have the override config at the database level.