FROM CACHE - de_header

Lokale Zahlungsmethoden in Bestell-E-Mail trennen

Thomas_D
Tourist
14 0 1

Hallo,

 

gibt es eine Möglichkeit zwischen den unterschiedlichen Lokalen Zahlungsmethoden in Shopify Payments in den E-Mail Vorlagen zu unterscheiden?

In meinem Store sind folgende Zahlungsmethoden aktiviert:

- Klarna auf Rechnung
- Klarna Sofortüberweisung
- EPS Sofortüberweisung

Ich will nur für Kunden, die mit Klarna auf Rechnung bestellt haben einen Text in der Bestellbestätigung anzeigen lassen und würde dies gern vor anderen verbergen.

 

Gibt es eine Möglichkeit diese 3 oben genannten zu trennen? Eventuell würde eine Lösung mit Order-Tags oder einem Script auf der Danke-Seite funktionieren, jedoch habe ich noch keine Lösung gefunden die genaue Zahlungsart zu filtern. Für Kreditkarte oder Paypal ist dies ohne weiters möglich, aber nicht bei Lokalen Zahlungsmethoden?

Eventuell könnte man ja die css-Klasse "payment-method-list__item__info" der Danke-Seite auslesen und darauf basierend einen Order Tag setzen? Jedoch wäre das aus meiner Sicht zu spät, da der Abgleich ja bereits in der Bestellbestätigung geschehen sollte...

Wäre sehr dankbar für eine Hilfe oder einen Workaround zu diesem Thema.

8 ANTWORTEN 8

r8r
Shopify Expert
2555 327 940

@Thomas_D – du kannst die Zahlungsmethode im Template über transaction.gateway auslesen und dann entsprechend darauf reagieren und den Inhalt der Vorlage anpassen.

Ich hoffe das hilft,
Mario

★ Ja, man kann mich buchen; schreib mir eine Nachricht!
★ Hinterlass gerne ein Like und markiere meine Antwort gegebenenfalls als Lösung. Ich freue ich mich immer über eine Spende an die (Kinder)krebshilfe oder eine kleine Aufmerksamkeit.
Studio Mitte
Thomas_D
Tourist
14 0 1

Hallo @r8r,

danke für deine Hilfe!
Ich konnte mittels {{ transaction.receipt }} alle Informationen zur Zahlungsmethode auf der Bestellbestätigung darstellen lassen.

So sieht der output in etwa aus:

{"id"=>"####", "object"=>"payment_intent", "amount"=>2490, "amount_capturable"=>0, "amount_received"=>2490, "application"=>"###", "application_fee_amount"=>67, "canceled_at"=>nil, "cancellation_reason"=>nil, "capture_method"=>"automatic", "charges"=>{"object"=>"list", "data"=>[{"id"=>"###", "object"=>"charge", "amount .......

 

Könntest du mir noch helfen, wie ich das Feld "payment_method_category" aus diesem Code ausgeben kann? Ich habe es mit einigen if statements versucht aber konnte noch keine Lösung finden.

 

Vielen Dank, Thomas

r8r
Shopify Expert
2555 327 940

@Thomas_D ich hab's jetzt gerade nicht vor mir – woher hast Du payment_method_category?

LG, Mario

★ Ja, man kann mich buchen; schreib mir eine Nachricht!
★ Hinterlass gerne ein Like und markiere meine Antwort gegebenenfalls als Lösung. Ich freue ich mich immer über eine Spende an die (Kinder)krebshilfe oder eine kleine Aufmerksamkeit.
Studio Mitte
Thomas_D
Tourist
14 0 1

Hallo Mario @r8r ,

 

hier der gesamte code von {{ transaction.receipt }}

Hier kommt unter payment_method_details die payment_method_category

so etwas in der Art wollte ich machen, es funktioniert aber leider nicht (denke aufgrund der anführungszeichen?)

{% if transaction.receipt contains "payment_method_category"=>"pay_now" %}

// do something

{% endif %}

 

Spoiler
{"id"=>"###", "object"=>"payment_intent", "amount"=>2490, "amount_capturable"=>0, "amount_received"=>2490, "application"=>"##", "application_fee_amount"=>67, "canceled_at"=>nil, "cancellation_reason"=>nil, "capture_method"=>"automatic", 
"charges"=>{"object"=>"list", "data"=>[{"id"=>"##", "object"=>"charge", "amount"=>2490, "amount_captured"=>2490, "amount_refunded"=>0, "application"=>"#", "application_fee"=>"#", "application_fee_amount"=>67, "balance_transaction"=>"#", "billing_details"=>{"address"=>{"city"=>"#", "country"=>"#", "line1"=>"#", "line2"=>"", "postal_code"=>"#", "state"=>nil}, "email"=>"#", "name"=>nil, "phone"=>nil}, "calculated_statement_descriptor"=>nil, "captured"=>true, "created"=>#, "currency"=>"eur", "customer"=>nil, "description"=>nil, "destination"=>nil, "dispute"=>nil, "disputed"=>false, "failure_code"=>nil, "failure_message"=>nil, "fraud_details"=>{}, "invoice"=>nil, "livemode"=>true, "metadata"=>{"checkout_id"=>"#", "payments_charge_id"=>"#", "payment_service"=>"true", "payment_object_type"=>"Charge", "payment_object_id"=>"#"}, "on_behalf_of"=>nil, "order"=>"#", "outcome"=>{"network_status"=>"approved_by_network", "reason"=>nil, "risk_level"=>"not_assessed", "seller_message"=>"Payment complete.", "type"=>"authorized"}, "paid"=>true, "payment_intent"=>"#", "payment_method"=>"#", 


"payment_method_details"=>{"klarna"=>{"payment_method_category"=>"pay_now", "preferred_locale"=>"de-AT"}, "type"=>"klarna"}, 


"receipt_email"=>nil, "receipt_number"=>nil, "receipt_url"=>"#", "refunded"=>false, "refunds"=>{"object"=>"list", "data"=>[], "has_more"=>false, "total_count"=>0, "url"=>"#"}, "review"=>nil, "shipping"=>nil, "source"=>{"id"=>"#", "object"=>"source", "amount"=>2490, "client_secret"=>"#", "created"=>1634536611, "currency"=>"eur", "flow"=>"redirect", "klarna"=>{"first_name"=>"#", "last_name"=>"#", "shipping_first_name"=>"#", "shipping_last_name"=>"#", "locale"=>"de-AT", "purchase_country"=>"AT", "client_token"=>"#", "pay_later_asset_urls_descriptive"=>"x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg", "pay_later_asset_urls_standard"=>"x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg", "pay_later_name"=>"Rechnung", "pay_later_redirect_url"=>"pay.klarna.com/eu/hpp/payments/3tCkcjt", "pay_now_asset_urls_descriptive"=>"x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg", "pay_now_asset_urls_standard"=>"x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg", "pay_now_name"=>"Sofort bezahlen", "pay_now_redirect_url"=>"pay.klarna.com/eu/hpp/payments/3tksPLC", "payment_intents_redirect_url"=>"pay.klarna.com/eu/hpp/payments/3pDVTcd", "payment_method_categories"=>"pay_now,pay_later"}, "livemode"=>true, "metadata"=>{"charge_id"=>"#", "payment_service"=>"true", "payment_object_type"=>"Source", "payment_object_id"=>"#"}, "order"=>"or_1JlooJFW0TpqcpXKnwhcyY0m", "owner"=>{"address"=>{"city"=>"#", "country"=>"#", "line1"=>"#", "line2"=>"", "postal_code"=>"#", "state"=>nil}, "email"=>"#", "name"=>nil, "phone"=>nil, "verified_address"=>nil, "verified_email"=>nil, "verified_name"=>nil, "verified_phone"=>nil}, "redirect"=>{"failure_reason"=>nil, "return_url"=>"#", "status"=>"succeeded", "url"=>"#"}, "statement_descriptor"=>nil, "status"=>"consumed", "type"=>"klarna", "usage"=>"single_use"}, "source_transfer"=>nil, "statement_descriptor"=>nil, "statement_descriptor_suffix"=>nil, "status"=>"succeeded", "transfer_data"=>nil, "transfer_group"=>nil}], "has_more"=>false, "total_count"=>1, "url"=>"#"}, "client_secret"=>"#", "confirmation_method"=>"automatic", "created"=>1634536609, "currency"=>"eur", "customer"=>nil, "description"=>nil, "invoice"=>nil, "last_payment_error"=>nil, "livemode"=>true, "metadata"=>{"checkout_id"=>"#", "payments_charge_id"=>"#", "payment_service"=>"true", "payment_object_type"=>"Charge", "payment_object_id"=>"#"}, "next_action"=>nil, "on_behalf_of"=>nil, "payment_method"=>nil, "payment_method_options"=>{"klarna"=>{"preferred_locale"=>nil}}, "payment_method_types"=>["klarna"], "receipt_email"=>nil, "review"=>nil, "setup_future_usage"=>nil, "shipping"=>nil, "source"=>"#", "statement_descriptor"=>nil, "statement_descriptor_suffix"=>nil, "status"=>"succeeded", "transfer_data"=>nil, "transfer_group"=>nil, "requested_credentials"=>[]}

Wäre dir sehr dankbar für deine Hilfe!

Danke und LG

Thomas

Thomas_D
Tourist
14 0 1

Hallo Mario @r8r 

 

Hier der vollständige Code von {{ transaction.receipt }}:

 

Spoiler
{"id"=>"#", "object"=>"payment_intent", "amount"=>2490, "amount_capturable"=>0, "amount_received"=>2490, "application"=>"#", "application_fee_amount"=>67, "canceled_at"=>nil, "cancellation_reason"=>nil, "capture_method"=>"automatic", "charges"=>{"object"=>"list", "data"=>[{"id"=>"#", "object"=>"charge", "amount"=>2490, "amount_captured"=>2490, "amount_refunded"=>0, "application"=>"#", "application_fee"=>"#", "application_fee_amount"=>67, "balance_transaction"=>"#", "billing_details"=>{"address"=>{"city"=>"#", "country"=>"#", "line1"=>"#", "line2"=>"", "postal_code"=>"#", "state"=>nil}, "email"=>"#, "name"=>nil, "phone"=>nil}, "calculated_statement_descriptor"=>nil, "captured"=>true, "created"=>#, "currency"=>"eur", "customer"=>nil, "description"=>nil, "destination"=>nil, "dispute"=>nil, "disputed"=>false, "failure_code"=>nil, "failure_message"=>nil, "fraud_details"=>{}, "invoice"=>nil, "livemode"=>true, "metadata"=>{"checkout_id"=>"#", "payments_charge_id"=>"#", "payment_service"=>"true", "payment_object_type"=>"Charge", "payment_object_id"=>"#"}, "on_behalf_of"=>nil, "order"=>"#", "outcome"=>{"network_status"=>"approved_by_network", "reason"=>nil, "risk_level"=>"not_assessed", "seller_message"=>"Payment complete.", "type"=>"authorized"}, "paid"=>true, "payment_intent"=>"#", "payment_method"=>"#", 


"payment_method_details"=>{"klarna"=>{"payment_method_category"=>"pay_now", "preferred_locale"=>"de-AT"}, "type"=>"klarna"}, 


"receipt_email"=>nil, "receipt_number"=>nil, "receipt_url"=>"#", "refunded"=>false, "refunds"=>{"object"=>"list", "data"=>[], "has_more"=>false, "total_count"=>0, "url"=>"#"}, "review"=>nil, "shipping"=>nil, "source"=>{"id"=>"#", "object"=>"source", "amount"=>2490, "client_secret"=>"#", "created"=>#, "currency"=>"eur", "flow"=>"redirect", "klarna"=>{"first_name"=>"#", "last_name"=>"#", "shipping_first_name"=>"#", "shipping_last_name"=>"#", "locale"=>"de-AT", "purchase_country"=>"AT", "client_token"=>"#", "pay_later_asset_urls_descriptive"=>"x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg", "pay_later_asset_urls_standard"=>"x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg", "pay_later_name"=>"Rechnung", "pay_later_redirect_url"=>"pay.klarna.com/eu/hpp/payments/3tCkcjt", "pay_now_asset_urls_descriptive"=>"x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg", "pay_now_asset_urls_standard"=>"x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg", "pay_now_name"=>"Sofort bezahlen", "pay_now_redirect_url"=>"pay.klarna.com/eu/hpp/payments/3tksPLC", "payment_intents_redirect_url"=>"pay.klarna.com/eu/hpp/payments/3pDVTcd", "payment_method_categories"=>"pay_now,pay_later"}, "livemode"=>true, "metadata"=>{"charge_id"=>"#", "payment_service"=>"true", "payment_object_type"=>"Source", "payment_object_id"=>"#"}, "order"=>"#", "owner"=>{"address"=>{"city"=>"#", "country"=>"#", "line1"=>"#", "line2"=>"", "postal_code"=>"#", "state"=>nil}, "email"=>"#", "name"=>nil, "phone"=>nil, "verified_address"=>nil, "verified_email"=>nil, "verified_name"=>nil, "verified_phone"=>nil}, "redirect"=>{"failure_reason"=>nil, "return_url"=>"#", "status"=>"succeeded", "url"=>"#"}, "statement_descriptor"=>nil, "status"=>"consumed", "type"=>"klarna", "usage"=>"single_use"}, "source_transfer"=>nil, "statement_descriptor"=>nil, "statement_descriptor_suffix"=>nil, "status"=>"succeeded", "transfer_data"=>nil, "transfer_group"=>nil}], "has_more"=>false, "total_count"=>1, "url"=>"#"}, "client_secret"=>"#", "confirmation_method"=>"automatic", "created"=>1634536609, "currency"=>"eur", "customer"=>nil, "description"=>nil, "invoice"=>nil, "last_payment_error"=>nil, "livemode"=>true, "metadata"=>{"checkout_id"=>"#", "payments_charge_id"=>"#", "payment_service"=>"true", "payment_object_type"=>"Charge", "payment_object_id"=>"#"}, "next_action"=>nil, "on_behalf_of"=>nil, "payment_method"=>nil, "payment_method_options"=>{"klarna"=>{"preferred_locale"=>nil}}, "payment_method_types"=>["klarna"], "receipt_email"=>nil, "review"=>nil, "setup_future_usage"=>nil, "shipping"=>nil, "source"=>"#", "statement_descriptor"=>nil, "statement_descriptor_suffix"=>nil, "status"=>"succeeded", "transfer_data"=>nil, "transfer_group"=>nil, "requested_credentials"=>[]}

Hier ist unter payment_method_details die payment_method_category aufgeführt.

Ich würde gerne soetwas wie hier in meiner E-Mail machen:

{% if transaction.receipt contains 'payment_method_category"=>"pay_now' %}

// do something

{% endif %}

Das funktioniert aber nicht (ich denke wegen den anführungszeichen?)

Danke für die Hilfe,

Thomas

Thomas_D
Tourist
14 0 1

Hallo @r8r ,

Der folgende Code kommt in {{ transaction.receipt }} vor:

"payment_method_details"=>{"klarna"=>{"payment_method_category"=>"pay_now", "preferred_locale"=>"de-AT"}, "type"=>"klarna"},

Wollte vorhin den gesamten Code posten, wurde aber nicht veröffentlicht... (hab ihn als doc angefügt)

 

Ich würde also gerne so etwas hier machen:

{% if transaction.receipt contains '"payment_method_category"=>"pay_now"'%}

// do something

{% endif %}

Dies funktioniert aber leider nicht (ich denke wegen den anführungszeichen?)

 

Bin für Hilfe sehr dankbar!

LG Thomas

Thomas_D
Tourist
14 0 1

Hier der Workaround, der bei mir funktioniert, falls jemand das gleiche Problem hat:

{% for transaction in transactions %}
{% assign einzelzeilen = transaction.receipt | split: ", " %}
{% for zeile in einzelzeilen %}
{% if zeile contains "payment_method_details" %}
{% assign zahlungsmethode_detail = zeile | split: "=>" %}
{% for zahlungsmethode in zahlungsmethode_detail %}
{% if zahlungsmethode contains "pay_now" %}
{% assign klarna_methode = "Sofortüberweisung" %}
{% elsif zahlungsmethode contains "eps" %}
{% assign eps_methode = "EPS" %}
{% else %}
{% assign klarna_methode = "auf Rechnung" %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}

 

{% if klarna_methode == "auf Rechnung" %}

// do something

{% endif %}

 

Gibt sicher elegantere Lösungen, aber it works.

LG Thomas

Thomas_D
Tourist
14 0 1

Hallo @r8r ,

 

leider hab ich doch noch keine Lösung für mein Problem gefunden, da {{ transaction.reciept }} in der ursprünglichen Bestellbestätigung nicht ausgegeben wird (erst, wenn man nachträglich "Bestellbestätigung erneut versenden" aus dem Admin bereich klickt funktioniert meine Lösung). 

Die restlichen transaction-Liquids geben nur "shopify_payments" zurück und nichts genaueres.

 

Hast du noch eine weitere Idee, wie das funktionieren könnte?

Danke und liebe Grüße,

Thomas