Lokale Zahlungsmethoden in Bestell-E-Mail trennen

Hallo Mario @r8r

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

Show More

markup {"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