Magento 2 克拉纳结帐

标签 magento payment checkout klarna

我需要将 Klarna Checkout 模块集成到 magento 2.1.2 中。我使用的是“klarna/m2-checkout 模块”的版本:4.2.2。 在选择配送方式时,弹窗总是报错:

抱歉,无法处理您选择的送货方式。请选择其他交付选项。

当我选择送货方式时,我得到这样的回应:

   {
        "shared": {
            "customer": {
                "type": "person"
            },
            "user_preferences": {
                "remember_me": true
            },
            "language": "en",
            "locale": "en-US",
            "customer_details": {
                "client_token": "eyJhbGciOiJSUzUxMiJ9.eyJz",
                "country": "swe",
                "completed": true,
                "fields_with_obfuscation": {
                    "email": "melosicuva@royalhost.info",
                    "given_name": "Testperson-se",
                    "family_name": "Approved",
                    "street_address": "Stårgatan 1",
                    "postal_code": "123 45",
                    "city": "Ankeborg",
                    "country": "SE",
                    "phone": "076-526 00 00",
                    "date_of_birth": "1941-03-21",
                    "national_identification_number": "19410321-9202"
                },
                "reference": "2f9a445a57a49215175178099002fc7165ee"
            },
            "shipping_details": {
                "client_token": "eyJhbGciOiJSUzUxMiJ9.eyJzZXNzaW9uX"
            },
            "currency": "SEK",
            "obfuscated_fields": []
        },
        "cart": {
            "total_tax_amount": 30000,
            "total_price_including_tax": 150000,
            "total_price_excluding_tax": 120000,
            "total_shipping_amount_excluding_tax": 0,
            "total_surcharge_amount_excluding_tax": 0,
            "total_discount_amount_excluding_tax": 0,
            "total_shipping_amount_including_tax": 0,
            "total_surcharge_amount_including_tax": 0,
            "total_discount_amount_including_tax": 0,
            "subtotal": 120000,
            "total_store_credit": 0,
            "items": [{
                "type": "physical",
                "reference": "1201018390010",
                "name": "Armour Bib Shorts",
                "quantity": 1,
                "unit_price": 150000,
                "total_tax_amount": 30000,
                "tax_rate": 2500,
                "total_price_including_tax": 150000,
                "total_price_excluding_tax": 120000,
                "product_url": "https://local.com/armour-bib-shorts-black.html?___store%5B_data%5D%5Bstore_id%5D=2&___store%5B_data%5D%5Bcode%5D=se&___store%5B_data%5D%5Bwebsite_id%5D=2&___store%5B_data%5D%5Bgroup_id%5D=2&___store%5B_data%5D%5Bname%5D=Sweden+Store&___store%5B_data%5D%5Bsort_order%5D=30&___store%5B_data%5D%5Bis_active%5D=1&___store%5B_data%5D%5Balias%5D=Sweden&___store%5B_data%5D%5Bavailable_currency_codes%5D%5B0%5D=SEK",
                "image_url": "https://local.com//media/catalog/product/a/r/armour-bib-shorts-aw18-01.jpg"
            }]
        },
        "errors": {
            "generic": ["shipping_service_failed"]
        },
        "options": {
            "allow_separate_shipping_address": false,
            "date_of_birth_mandatory": false,
            "title_mandatory": false,
            "national_identification_number_mandatory": false,
            "phone_mandatory": true,
            "allowed_customer_types": ["person"],
            "payment_selector_on_load": false
        },
        "preview_payment_methods": [{
            "id": "-1",
            "type": "invoice",
            "locked": false,
            "selected": false,
            "data": {
                "days": 14
            }
        }, {
            "id": "-1",
            "type": "direct_debit",
            "locked": false,
            "selected": false
        }, {
            "id": "-1",
            "type": "credit_card",
            "locked": false,
            "selected": false,
            "data": {
                "available_cards": ["VISA", "MASTER"],
                "allow_saved_card": false,
                "do_save_card": false,
                "collect_consent": false,
                "consent_given": false
            }
        }],
        "allowed_billing_countries": ["swe"],
        "status": {
            "prescreened": false
        },
        "analytics_user_id": "ELmpDn1f600JYxHtagC7FcsOdAXe9-2iwWhIzHSfmhM=",
        "merchant": {
            "hashed_id": "a9c814c7a780d46a7fb2403e452829b3",
            "name": "Your business name"
        },
        "merchant_urls": {
            "checkout": "https://local.com/checkout/klarna",
            "confirmation": "https://checkout-eu.playground.klarna.com/yaco/orders/ffc4101d-00cb-5e63-81fc-0f0c15baeac3/redirect?auth_token=0el7mltb89prfz2fz2mw",
            "terms": "https://local.com/terms",
            "confirmation_page": "https://local.com/checkout/klarna/confirmation/id/ffc4101d-00cb-5e63-81fc-0f0c15baeac3"
        }
    }

这里我不喜欢这个 block :

 "errors": {
        "generic": ["shipping_service_failed"]
    }

有人知道怎么解决吗?

传递错误: enter image description here

最佳答案

当您设置 address_update 回调并且没有以正确的方式处理时,会发生此错误。如果您需要更新订单地址,则应设置此回调,并且不应超过 10 秒。

这是一个例子:https://developers.klarna.com/api/#checkout-api-callbacks-address-update

以及一些最佳实践:https://developers.klarna.com/documentation/klarna-checkout/best-practices/#address-updated

关于Magento 2 克拉纳结帐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56189439/

相关文章:

php - 在 woocommerce 中添加具有默认值的自定义隐藏结账字段

php - 覆盖 Magento GetPrice 函数

Paypal 预批付款

concurrency - 使用 PayPal 在线订票 : Prevent multiple visitors from buying same ticket

payment-gateway - Bluesnap 市场 - 如何阻止供应商销售?

javascript - 一页结账在 Magento 版本中不起作用1.7.0.2

ruby-on-rails - 添加购物车项目 Ruby on Rails

php - Magento:更改搜索中的排序顺序,更改类别页面排序

php - 使用php和mysql创建csv文件时有文件大小限制吗?

Java - Magento2 Rest api 产品上传图像静默失败