d
Topic
Posts:
10
Last edited July 09, 2014

[Liquid Deprecation -- 2014/07/14] order.payment_details This post is outdated

Similar to the deprecation of the order.payment liquid variable, we'll be removing support for order.payment_details. Because orders support multiple payments, we recommend replacing any instances of {{ order.payment_details }} or {{ payment_details }} in your templates with the transactions property. Expect payment_details to be available on the initial authorization or sale transaction for each credit card used for a given order.

Edit: This will affect email templates and any other liquid templates, including those at https://<myShopUrl>/admin/settings/payments

Here is an example on how to use the transactions property:

Thank you for your order!

Payment Details:
{% for transaction in transactions %}
  {% if transaction.kind == "authorization" or transaction.kind == "sale" %}
    Amount: {{ transaction.amount | money }}
    {% if transaction.payment_details.credit_card_number %}
    Charged To: {{ transaction.payment_details.credit_card_company }} {{ transaction.payment_details.credit_card_number }}
    {% endif %}
    On: {{ transaction.created_at | date: "%a, %b %d, %y" }}
  {% endif %}
{% endfor %}

For more information, see the documentation for Transactions

i
Replies
Posts:
1
July 09, 2014
g
1
upvotes

Hey,

So if I have:

Credit card type: {{ payment_details.credit_card_company }}
Credit card number: {{ payment_details.credit_card_number }}

What do I change this to ?

Do I just go:

Credit card type: {{ transaction.payment_details.credit_card_company }}
Credit card number: {{ transaction.payment_details.credit_card_number }}

 

Tom Kennedy Member
Posts:
4
July 09, 2014

Is there a simple way to find what I need to change and also what I need to change it to? i.e. can I just cmd+f what I need to delete within my email notifications and then simply paste the replacement code over the top of it?

If so, can you do a visual example as I'm slightly confused as to what exactly I'm supposed to be getting rid of and what I'm supposed to be putting in its place. 

Many Thanks

Boots Highland Shopify Partner doubler.com
Posts:
2
July 09, 2014

Is this for email templates as well?  I use {{ payment_details.credit_card_company }} and {{ payment_details.credit_card_number }} in my templates, and I see it still says to do so on your "Email variable reference" page:

http://docs.shopify.com/manual/settings/notifications/email-variables

Do I need to change these, and if so, what should they be changed to?

Posts:
10
Last edited July 09, 2014
g
3
upvotes

Yes, this will affect email templates. Usually, this kind of information is used in New Order Notification or Order Confirmation emails

Any instance of {{ order.payment_details }} or {{ payment details }} will need to be replaced. Since payment details are now tied to specific transactions (the first sale or authorization), you'll need to iterate over the transactions to grab the payment details. 

For example, this snippet:

Credit card type: {{ payment_details.credit_card_company }}
Credit card number: {{ payment_details.credit_card_number }}

Would be changed to 

{% for transaction in transactions %}
  {% if transaction.kind == "authorization" or transaction.kind == "sale" %}
    {% if transaction.payment_details.credit_card_number %}
    Credit card type: {{ transaction.payment_details.credit_card_company }} 
    Credit card number: {{ transaction.payment_details.credit_card_number }}
    {% endif %}
  {% endif %}
{% endfor %}

While this is a bit more complex, it provides better support multiple credit cards being used on a single order. 
Be sure to update both your plain-text and HTML templates!

Boots Highland Shopify Partner doubler.com
Posts:
2
July 09, 2014

Awesome!  Thanks for clearing it up for us, Jeff!

Tom Kennedy Member
Posts:
4
July 09, 2014

Thanks for the reply Jeff.

Looking at my HTML Order Confirmation email I just have the following snippet from the ones you mentioned: {{ payment_details.credit_card_company }}<br>

So what exactly shouldI replace that with?

Posts:
10
July 09, 2014

Tom, for your specific case, try replacing {{ payment_details.credit_card_company }} with:

{% for transaction in transactions %}
  {% if transaction.kind == "authorization" or transaction.kind == "sale" %}
    {% if transaction.payment_details.credit_card_company %}
    Credit card type: {{ transaction.payment_details.credit_card_company }} 
    {% endif %}
  {% endif %}
{% endfor %}

 

Tom Kennedy Member
Posts:
4
July 09, 2014

Thanks Jeff, I've done as advised.

Posts:
2
July 10, 2014

It doesn't look like this new code works in the Order Printer templates - should we just continue to use payment_details here?

Posts:
4
July 14, 2014

What happened to having access to the credit card expiration date?

Posts:
58
July 16, 2014

Jeff,

I have a related concern but not specific to the Liquid interaction of this object but the API interaction.

Currently when calling the API [BTW I know xml is depreciated] with the XML extension you get

<order>
.
.
.
<payment-details>
    <avs-result-code>Y</avs-result-code>
    <credit-card-bin>371556</credit-card-bin>
    <cvv-result-code>M</cvv-result-code>
    <credit-card-number>•••• •••• •••• 1016</credit-card-number>
    <credit-card-company>American Express</credit-card-company>
</payment-details>
.
.
.
</order>

When will support for this End?

We have multiple clients we process inbound orders for using the private API Key function, we are currently in the process of migrating these solutions to JSON with the Transaction block driving the card-number and card-company detail.  Our hope is that this block will remain for some time while we finish testing and deploying this update so if you have a timeline for when this will be removed please advise.

Thanks in Advance!

- Rich

Efficiency through Simplicity is the only way to design...
Posts:
10
July 16, 2014

Hey Rich, glad you asked about the API. We'll be making similar changes to the API which will expose payment details on transactions rather than on the order itself. In fact, you can already start using transactions for this information.

I don't have an exact date for the deprecation of order.payment_details through the API yet. Expect a deprecation notice to be posted with more details shortly though.

Posts:
58
July 16, 2014

Thank you Jeff,

If I may ask that on the API you give a little more time between the deprecation notice and the "Kill" date as this would shut down two of my customers.  We are trying to avoid changes to the prior version and focus on testing the new release which will make it a non issue.  

Again thank you for the quick response,

- Rich

Efficiency through Simplicity is the only way to design...
Posts:
3
July 22, 2014

Two things:

1) The "Send Test Email" shows no test payment data for this update to verify the update is coded right. While I realize this update isn't "rocket science', it would be nice if the test email filled in some fake payment information for order.

2) This is the first I've heard that XML support is being removed from API. Why??? This is a big hassle for folks that have created webhooks to your API. Please consider maintaining some kind of legacy support at least for a few years. 

Tom Kennedy Member
Posts:
4
Last edited July 22, 2014

@Jeff Bruton

Note: The following query which I have, is not related to the depreciation of the liquid code, as it's something has been happening prior to that modification.

Having looked at a few order confirmation emails I notice that when a customer pays using PayPal it simply leaves the 'Payment Method' box of the email blank, i.e. it only actually shows something in the 'Payment Method' box when they pay by an actual credit/debit card i.e. Visa, MasterCard etc.

Is there any way (or any plans) to have it so that the Order Confirmation email can also state the word 'PayPal' within the 'Payment Method' box when a customer makes a payment using PayPal, rather than it just being left blank?

Posts:
3
Last edited July 22, 2014

 

{% for transaction in transactions %}
  {% if transaction.kind == "authorization" or transaction.kind == "sale" %}
    {% if transaction.payment_details.credit_card_number %}
    Credit card type: {{ transaction.payment_details.credit_card_company }} 
    Credit card number: {{ transaction.payment_details.credit_card_number }}
    {% endif %}
  {% endif %}
{% endfor %}

This code you posted shows the payment information at least twice for single item purchases. I'm guessing due to the "authorization" or "sale". I have not had a multi-item purchase since updating, so I don't know if it's twice per item. You guys need to be more exact than this. You're probably the #1 store platform available these days. You need to be more exact and better tested.

I'm going to try to remove the loop logic and just show the lines like this:

    Credit card type: {{ transaction.payment_details.credit_card_company }} 
    Credit card number: {{ transaction.payment_details.credit_card_number }}


 

Posts:
3
July 24, 2014

The code below shows nothing if you don't have it in the loop you recommended. In the loop, it shows at least twice. So what's the solution?

Credit card type: {{ transaction.payment_details.credit_card_company }} 
Credit card number: {{ transaction.payment_details.credit_card_number }}