首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Magento 2 Klarna结账

Magento 2 Klarna结账
EN

Stack Overflow用户
提问于 2019-05-17 23:24:22
回答 2查看 1.7K关注 0票数 3

我需要将Klarna Checkout模块集成到magento 2.1.2中。我使用的是"klarna/m2-checkout module“的版本: 4.2.2。选择交付方式时,弹出窗口总是会出现错误:

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

当我选择发货方式时,我会得到这样的响应:

代码语言:javascript
复制
   {
        "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"
        }
    }

这里我不喜欢这个区块:

代码语言:javascript
复制
 "errors": {
        "generic": ["shipping_service_failed"]
    }

有人知道怎么修吗?

传送错误:

EN

回答 2

Stack Overflow用户

发布于 2019-10-07 17:45:53

当您设置address_update回调和时,会出现此错误,但处理方式不正确。如果您需要更新order的地址,则应设置该回调,并且该回调的时间不超过10秒。

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

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

票数 3
EN

Stack Overflow用户

发布于 2020-04-22 10:11:27

如果您在localhost上运行Klarna Checkout,那么您应该使localhost-based应用程序可以通过HTTP协议从Klarna访问(例如,用于address_update回调)。

你可以通过像Ngrok这样的服务做到这一点。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56189439

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档