How to identify Klarna orders in REST API?

kookoo
Tourist
9 1 0

Dear community,

we have integrated Klarna as payment gateway in our shop. We transfer all order data via REST API to our WMS but are wondering how to identify Klarna orders in the transferred data? Looking at some real Klarna orders we can not find any hint in the JSON files (but we need them to print a big disclaimer on our invoices not to pay to our bank account).

Thank you!

rgds

Kurt from KooKoo

0 Likes
KristiAtKlarna
Shopify Partner
90 6 20

Hi @kookoo ,

As documented at https://shopify.dev/docs/admin-api/rest/reference/orders/order & https://shopify.dev/docs/admin-api/rest/reference/orders/transaction

you can find Klarna information in these fields from the Shopify API JSON response, e.g. 

"payment_gateway_names": [
"buy_now_pay_later_with_klarna"
],

 

and from the order's transaction data:

{
"transactions": [
{
"id": 317649312345,
"order_id": 258053212345,
"kind": "sale",
"gateway": "buy_now_pay_later_with_klarna",
"status": "success",
"message": "Completed",
"created_at": "2020-09-30T11:07:00-04:00",
"test": true,
"authorization": "this will be the Klarna order id",
"processed_at": "2020-09-30T11:07:00-04:00",
"receipt": {
"x_account_id": " this will be the Klarna merchant id",
"x_gateway_reference": "this will also be the Klarna order id",

tommydev
Tourist
9 0 0

Dear Kristi,

do you also know a possibility to check that an order is paid with Klarna, if it was paid through the shopify_payments gateway?

I tried the endpoints you suggested, buy since I can't find any of the required fields(gateway, x_gateway_reference, payment_gateway_names), I guess that those only work on the "pure" Klarna gateway.

On /admin/api/2020-01/orders/<id>/transactions.json I found the field: transaction.receipt.payment_method_details.type = "klarna", but since this is so deeply nested, I am not sure, if it is reliable information on every order.

Many Greetings,

Tom

0 Likes