d
Topic
Posts:
3
Last edited January 14, 2015

How do I access transaction object properties in an email receipt? This post is outdated

Hi there,

I'm trying to access a customer's credit card type and partially obscured number (e.g. "VISA XXXX XXXX XXXX 8312") for use in an HTML email receipt, I see that I can use the transactions API to access this information. I added the following to my HTML email receipt template:

{% for transaction in transactions %} Charged To: {{ transaction.payment_details.credit_card_company }} {{ transaction.payment_details.credit_card_number }} {% endfor %}

Unfortunately, nothing shows up. Is this the correct way to use the transaction object in an email HTML receipt? Is it just not working because it's a 'test email'? Any guidance is appreciated. Thanks -

i
Replies
Shawn Rudolph Shopify Employee
Posts:
253
Last edited January 15, 2015
g
1
upvotes

Hi Nick

That could should work fine. Keep in mind the "Preview" is pulling dummy data out so there is no card number or card type that exists with the fake order, so it won't show up in the preview. I used this code block

{% for transaction in transactions %}
{{ transaction.payment_details.credit_card_number }}
{% endfor %}

And placed a test order on my store and got just the credit card number, so you're code should be fine.

Posts:
3
January 15, 2015

Thanks for your help Shawn. I also had a similar issue cycling through the product image thumbnails. (No image shows) - do you think that is also a symptom of the test/dummy data?

Shawn Rudolph Shopify Employee
Posts:
253
January 15, 2015
g
1
upvotes

If it's in the order email test, that would be the problem. Those images got removed at some point. We did have images for the products before.

Posts:
3
January 15, 2015

Thanks for your help -