Skip to main content
Solved

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

  • September 16, 2021
  • 5 replies
  • 1109 views

Forum|alt.badge.img+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

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!

David

View original
Did this topic or the replies in the thread help you find an answer to your question?

5 replies

David To
Klaviyo Employee
Forum|alt.badge.img+60
  • Klaviyo Employee
  • 2456 replies
  • Answer
  • September 16, 2021

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!

David


julie.accardo
Klaviyo Employee
Forum|alt.badge.img+36
  • Klaviyo Employee
  • 185 replies
  • September 18, 2021

Hi @jdbrngr,

In addition to @david.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!

Julie


Forum|alt.badge.img+2
  • Author
  • Contributor III
  • 6 replies
  • September 19, 2021

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


Forum|alt.badge.img+2
  • Author
  • Contributor III
  • 6 replies
  • September 20, 2021

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!


David To
Klaviyo Employee
Forum|alt.badge.img+60
  • Klaviyo Employee
  • 2456 replies
  • September 20, 2021

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!

David