How to distinguish different payments methods "within" Shopify Payments?

Wilhelm_Uschtr1
Shopify Partner
32 0 0

Cross-posting from over there, as I realised in the wrong forum, and I can't move the original one. If an admin reads this, please delete the original one.

---------------

Hey there,

we can use

 

{% transaction.gateway %}

 

in the order confirmation notification e-mail to access the gateway that was used. But I can't find a way to distinguish between different payment methods "within" a certain gateway. How would I achieve showing different texts depending on which payment method is used?

The use case is to display specific payment instructions when a certain local payment method (Klarna) "within" the "shopify_payments" gateway is used.

I already checked:

Any ideas?

Cheers
Will

0 Likes
2BDigital
Pathfinder
86 20 21

Hi Will

Seems like the transaction "gateway" - as you've said - is:

{{ transaction.gateway }}

But I'd also be looking at these properties on the transaction object:

{{ transaction.payment_details }}
{{ transaction.receipt}}

I'd imagine there would be some kind of identifier in one of these variables that could identify which method it is - even if they're not explicit?

Wilhelm_Uschtr1
Shopify Partner
32 0 0

Hey, thanks for the pointers.

I was hopeful after realising that I overlooked the depth of "transaction.receipt" and that "transaction.receipt.payment.payment_method_types" would indeed hold what I am looking for:

"payment_method_types": [
     "klarna"
],

 But unfortunately "receipt" appears to be empty at the point of time that the confirmation order is sent. "{{ transaction.receipt }}" only yields

{}

 on test orders.

"transaction.payment_details" on the other hand only holds useful data for credit card transactions.

 

Any other ideas?

0 Likes
2BDigital
Pathfinder
86 20 21

Ah ok.

That's frustrating.

Is that because they're not fulfilled/captured yet maybe?

What about using transaction.name and seeing if there's a pattern match that differentiates the transactions?

Any chance you can log a couple of different full {{ transaction }} objects for us to look at?

Also do the Order Tags contain anything? Or could you add the payment method as a tag automatically?

0 Likes
Wilhelm_Uschtr1
Shopify Partner
32 0 0

Sorry 2BDigital, if my tone is annoyed or rude. I am just really frustrated with this, and it's shining through. It's not directed at you though.

 

> Is that because they're not fulfilled/captured yet maybe?

I am not sure... the same happens on cancel notifications, and the transactions for those orders should definitely be captured by the time those go out. Also, what good would listing this property in the docs be, if the confirmation mail goes out before any payment capturing is done. I don't understand how this is supposed to work.

 

> What about using transaction.name and seeing if there's a pattern match that differentiates the transactions?

The pattern for {{ transaction.name }} appears to just be the order number/name appended by an incrementing number, no useful information here.

 

> Also do the Order Tags contain anything? Or could you add the payment method as a tag automatically?

They don't. The only information in the whole order object pertaining to payments appears to be

...
"gateway": "shopify_payments",
...
"payment_gateway_names": [
"shopify_payments"
],
...

And I really don't want to add tags myself.

 

> Any chance you can log a couple of different full {{ transaction }} objects for us to look at?

I don't really see the need and don't want to expend the effort to be honest. I know where the information is now (transaction.receipt.payment_method_details), I just can't access it. And really I am looking to solve this the other way around: "How do we distinguish transactions from different payment methods within Shopify Payments?" should be a question, someone from Shopify should be easily able to answer, no?

 

0 Likes