How to dynamically display payment methods in an email that is not via credit card

  • 16 September 2021
  • 5 replies

Badge +2

I use this variable for payment method: {{ event.extra.payment_details.credit_card_company }}. It works when customer uses credit card but for Paypal it doesn’t show anything. What can I do to accommodate non-credit card payments? 


Best answer by David To 16 September 2021, 20:33

View original

5 replies

Userlevel 5
Badge +34

Hi @jdbrngr,

In addition to’s recommendations, if you find that PayPal is not an event variable that passes with the flow’s triggering event then another option if you only accept credit card or PayPal payments would be to create if/else logic (this would require a developer or tech savvy user) so that if the order is a credit card order, you can display the credit card information but if it doesn’t include credit card in the payment then default to “PayPal.”

Have a nice weekend!


Badge +2

Thanks guys for your inputs! Seems like if/else logic is the way to go.

Badge +2

Additional question: what’s the correct syntax for if-else for this variable? 

Wanted the logic to be:

  • If payment is shopify_payments, then show credit card company and last 4 digits
  • Else, if payment is paypal, show “paid via paypal”

Thank you!

Userlevel 7
Badge +60

Hey @jdbrngr,

When formulating an if-else statement using event variables, you should still be able to use that exact same syntax provided in the Klaviyo preview tool. In addition to offering a great overview of creating if-else statements from dynamic event data, @retention also offers a wonderful alternative solution of leveraging the Show/Hide function with event data in their response to a similar Community post below:

Since every template and set up is different, you may also want to consult with a developer or email design expert to further assist you in creating an if-else statement that achieves your goal. If you need, you can find a number of amazing Klaviyo Partner agencies from our Agency Partner Directory

Have a great day!


Userlevel 7
Badge +60

Hello @jdbrngr,

Great question!

I would first suggest reviewing how your event is structured to passing these various form of payment methods to Klaviyo. Doing so would allow you to see the metadata that is shared and also provide you with the appropriate syntax required to pull in a different set of tags which may return your desired result of highlighting the payment method as PayPal.You can find guidance on how to find your desired variable tags along with how to utilize these event data in your email from the About Using Event Variables to Personalize Flows Help Center article with a helpful video under the How to Find Event Variables subsection. 

Since it seems like the variable you are currently using of {{ event.extra.payment_details.credit_card_company }} may be too specific for your use case of wanting to also highlight the payment method of being PayPal, I may suggest reviewing the data above this specific array item and see if the syntax will return your desired result. 

Some other Community posts that may be helpful in reviewing are the ones below which touch upon a similar subject to what you were trying to accomplish:

I hope this helps!