Klarna Integration CreateSession错误值order_lines [0] .total_tax_amount

问题描述

我正在努力将Klarna Payments集成到网站中。不幸的是,当我向请求加税时,我无法获得成功的会话响应。没有税收,效果很好。谁能告诉我我做错了吗?

我正在欧洲Klarna游乐场进行测试:https://api.playground.klarna.com/

这是我发送数据的请求:

{
"purchase_country": "DE","purchase_currency": "EUR","locale": "de-DE","order_amount": 10000,"order_tax_amount": 1600,"order_lines": [
{
    "type": "physical","reference": "19-402","name": "Battery Power Pack","image_url": "https://www.exampleobjects.com/logo.png","product_url": "https://www.estore.com/products/f2a8d7e34","quantity": 1,"tax_rate": 1600,"total_amount": 10000,"total_tax_amount": 1600,"unit_price": 10000,}
]

}

我从Klarna API得到的响应是:

{"error_code":"BAD_VALUE","error_messages":["Bad value: order_lines[0].total_tax_amount"],"correlation_id":"c651f01d-dcfd-432d-9b34-39890e2d557e"}

任何建议都值得赞赏。

解决方法

来自克拉纳 docs

必须在 total_amount - total_amount * 10000 / (10000 + tax_rate) 的 ±1 以内。类型为折扣时为负。