• Resolved Demian

    (@demian85)


    Hi,

    We have added recently Klarna to 4 different EU countries. Each of them is showing the iframe in the correspondent language, except for Finland; the iframe is in English. Not sure if this is a development error? Finland is definitely a Klarna country:

    Please see webshop link.

    With thanks,
    Demian

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Payment Plugins

    (@mrclayton)

    Hi @demian85,

    The plugin is doing what it’s supposed to regarding locale. Not sure why Klarna isn’t showing the correct language. Here is an output showing what’s being sent to Klarna and the locale is correct.

    {
      "source": {
        "id": "src_1JG5ftAnnaTlulpkRAn2Ht90",
        "object": "source",
        "amount": 6795,
        "client_secret": "src_client_secret_8Ixa74I0XoTd1rPIy94J3L0G",
        "created": 1626974829,
        "currency": "eur",
        "flow": "none",
        "klarna": {
          "first_name": "Test",
          "last_name": "User",
          "shipping_first_name": "Test",
          "shipping_last_name": "User",
          "locale": "fi",
          "purchase_country": "FI",
          "client_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ijc0OWM5M2U2LTJkNWQtMzJmNC04ZTk1LWJhNWUwZDA1OTJiYSJ9.eyJzZXNzaW9uX2lkIjoiZTdhMWVlYzYtMGQzNy0xYTMyLWFjY2EtMjVkNGZmNmIzYjk0IiwiYmFzZV91cmwiOiJodHRwczovL2pzLmtsYXJuYS5jb20vZXUva3AvbGVnYWN5L3BheW1lbnRzIiwiZGVzaWduIjoia2xhcm5hIiwibGFuZ3VhZ2UiOiJlbiIsInB1cmNoYXNlX2NvdW50cnkiOiJGSSIsImVudmlyb25tZW50IjoicHJvZHVjdGlvbiIsIm1lcmNoYW50X25hbWUiOiJTZWxib25kIE9ubGluZSBsdGQuIiwic2Vzc2lvbl90eXBlIjoiUEFZTUVOVFMiLCJjbGllbnRfZXZlbnRfYmFzZV91cmwiOiJodHRwczovL2V1LmtsYXJuYWV2dC5jb20iLCJleHBlcmltZW50cyI6W3sibmFtZSI6ImluLWFwcC1zZGstbmV3LWludGVybmFsLWJyb3dzZXIiLCJwYXJhbWV0ZXJzIjp7InZhcmlhdGVfaWQiOiJuZXctaW50ZXJuYWwtYnJvd3Nlci1lbmFibGUifX1dfQ.E999lTZ4F3y7bvHYUjnpoeJjnGb2ECiMl9eUROcsVrHGPXTnnvhPY2WWqhKcr9If2OtH-o29VssGPTqh55Y5DPfFbhCY4vjr8LctTgJLZq0hWAexvhygjS-E8JTGzKG17FvdVukWMHz1Tnx2Rbwv6QT7gGEccTHLjHe8A-vuigWZYTOCiWmWyyKzN0Qr2WDYUPXkDb9vOGqIxIYNQe6AJy9mAAM0QxQdnp2Hb_bpIsCIvRomUNG2kRwNTnzPWIl5zN-ZksBJR_TKgMIf_XdJZha0YOeobTaoUjyfNPXnIvVg2TsszYDIiQNZp-n37djbM36RbBigOIKxbGLCQVsQpg",
          "pay_later_asset_urls_descriptive": "https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg",
          "pay_later_asset_urls_standard": "https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg",
          "pay_later_name": "Pay later.",
          "pay_over_time_asset_urls_descriptive": "https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg",
          "pay_over_time_asset_urls_standard": "https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg",
          "pay_over_time_name": "Slice it.",
          "payment_method_categories": "pay_later,pay_over_time"
        },
        "livemode": true,
        "metadata": [],
        "owner": {
          "address": {
            "city": "050 458 5524",
            "country": "FI",
            "line1": "Koskikatu 64",
            "line2": null,
            "postal_code": "02320",
            "state": null
          },
          "email": "support@paymentplugins.com",
          "name": "Test User",
          "phone": null,
          "verified_address": null,
          "verified_email": null,
          "verified_name": null,
          "verified_phone": null
        },
        "source_order": {
          "amount": 6795,
          "currency": "eur",
          "email": "support@paymentplugins.com",
          "items": [
            {
              "amount": 5319,
              "currency": "eur",
              "description": "Crest 3D Whitestrips™ Gentle Routine - Täysihoito 65,95 €",
              "parent": null,
              "quantity": 1,
              "type": "sku"
            },
            {
              "amount": 200,
              "currency": "eur",
              "description": "Fee total",
              "parent": null,
              "quantity": 1,
              "type": "sku"
            },
            {
              "amount": 1276,
              "currency": "eur",
              "description": "Tax",
              "parent": null,
              "quantity": 1,
              "type": "tax"
            }
          ],
          "shipping": {
            "address": {
              "city": "050 458 5524",
              "country": "FI",
              "line1": "Koskikatu 64",
              "line2": "",
              "postal_code": "02320",
              "state": ""
            }
          }
        },
        "statement_descriptor": null,
        "status": "pending",
        "type": "klarna",
        "usage": "single_use"
      }
    }

    Appears to be a Klarna issue with the fi locale.

    Thread Starter Demian

    (@demian85)

    Hi @mrclayton

    Is this part of the Klarna’s iFrame or is this part of the plugin? How does the plugin communicates with the iframe which language to show?

    It might be that locale should be written as fi-FI instead of fi, like all countries’ locales are written as language-COUNTRY.

    Thanks!

    Plugin Author Payment Plugins

    (@mrclayton)

    Hi @demian85,

    That text is rendered in the iFrame. The language to display is communicated via the source object.

    I forced the locale to fi-FI in a test and Klarna did not render the text in Finnish. This appears to be an issue with Klarna not using the correct locale. There isn’t anything I can do in the plugin as it already correctly uses the locale configured in WordPress.

    Kind Regards,

    Plugin Author Payment Plugins

    (@mrclayton)

    @demian85 I performed another test with locale set to fi-FI and billing country to Finland and the correct language was rendered.

    Make sure WordPress is using fi_FI instead of just FI. The Stripe plugin uses what WordPress gives it in the way of locale.

    Thread Starter Demian

    (@demian85)

    Yes, I was afraid this might be the problem that it is looking at the lang attribute, but wordpress puts for finland the lang attribute as fi. This is not something that can be changed, you just select the country (Suomi) in general settings, and that’s it. Of course you can override it in functions.php, but that’s not a real solution.

    Comparison how WordPress adds Denmark and Finland the html lang tag:

    • This reply was modified 2 years, 9 months ago by Demian.
    Plugin Author Payment Plugins

    (@mrclayton)

    @demian85 Why don’t you use the plugin’s available filters to change the locale?

    Example:

    add_filter('wc_stripe_output_display_items', function($data, $page, $payment_method){
        if($payment_method->id === 'stripe_klarna'){
            $data['source_args']['klarna']['locale'] = 'fi-FI';
        }
        return $data;
    }, 10, 3);
    Thread Starter Demian

    (@demian85)

    That’s what I meant with a solution via a function(), but that doesn’t resolve the main problem; default WP locale is fi and doesn’t match Stripe’s one. I hope you will consider a solution for the long term.

    Thread Starter Demian

    (@demian85)

    Hi @mrclayton ,

    With the custom function you suggested, there are problems in loading it on a Safari browser (tested on iPhone). It doesn’t open the iFrame.

    What could be the cause, or a solution?

    With thanks,
    Demian

    Plugin Author Payment Plugins

    (@mrclayton)

    @demian85 that code would have nothing to do with the iFrame not loading in Safari. I don’t know why it’s not showing. It works fine for me when I test using an iPhone.

    Thread Starter Demian

    (@demian85)

    @mrclayton I have removed the custom code you provided, that’s why it seems nothing is wrong. I put it back now, so you can see. Please let me know if confirmed, so I can remove it.

    Thread Starter Demian

    (@demian85)

    @mrclayton did you check our site again, where I have re-added the function and do you see it doesn’t open the iFrame on a Safari (iPhone) browser?

    Plugin Author Payment Plugins

    (@mrclayton)

    @demian85 your checkout page won’t stop loading. There’s a loader over all of the payment methods that won’t clear.

    Plugin Author Payment Plugins

    (@mrclayton)

    @demian85 in version 3.3.7 logic was added to convert fi to fi-FI.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Klarna -Finnish language’ is closed to new replies.