Getting payment method(visa, paypal, apple pay, etc) from Additional Scripts/confirmation page

6 0 0

Hello, I am trying to get some data via the additional scripts for the confirmation page to send to adobe tracking. 

I have been successful getting a bunch of stuff from the checkout object, but I would like to know the best way to get the payment method(credit card, pay pal, google pay, apple pay, shop pay)


When testing with a visa, I can get the below data using payment_details:

{"credit_card_number"=>"•••• •••• •••• 8888", "credit_card_company"=>"Visa", "credit_card_last_four_digits"=>"8888"}


I have read that if pay pal was used, there would not be a payment_details field, but instead gateway_name or payment_gateway_names.

Does this mean I would need to make some js checking if theres no transaction.payment_details, then get gateway_name?

How can I get the proper value for all the other methods, will any credit card usage appear in payment_details, and all the others in gateway_name?

Thank you for your help


- Jordan