david-d
5/3/2017 - 2:52 PM

Klarna order data

Klarna order data

/**
 * ORDER DATA SCHEMA
 * 
 * (All money values are in cents, i.e $500 -> 50000)
 *
 * order_amount equals the sum of the total_amount of each order line.
 * 50938 === 50000 + 3938 + 2000  + (-5000)
 * 
 * order_tax_amount equals the sum of the total_amount of each order line with the type of sales_tax
 * 3938 === 3938
 * 
 * order_lines:
 * total_amount = unit_price * quantity
 * 
 */

{
    "purchase_country": "US",      
    "purchase_currency": "USD",
    "locale": "en-US",         
    "order_amount": 50938,
    "order_tax_amount": 3938,
    "order_lines": [
        {
            "type": "physical",         // Used for physical products
            "reference": "06P4069",
            "name": "Television",
            "quantity": 1,
            "quantity_unit": "item",    // Optional
            "unit_price": 50000,
            "tax_rate": 0,              // Do not use
            "total_amount": 50000,
            "total_discount_amount": 0, // Do not use
            "total_tax_amount": 0,      // Do not use
            "product_url": "",          // Optional
            "image_url": ""             // Optional
        },,
        {
            "type": "sales_tax",        // Used for sales tax
            "reference": "Sales Tax",
            "name": "Sales Tax",
            "quantity": 1,
            "unit_price": 3938,
            "tax_rate": 0,              // Do not use
            "total_amount": 3938,
            "total_discount_amount": 0, // Do not use
            "total_tax_amount": 0,      // Do not use
        },
        {
            "type": "shipping_fee",     // Used for shipping
            "reference": "Free Shipping",
            "name": "Free Shipping",
            "quantity": 1,
            "unit_price": 2000,
            "tax_rate": 0,              // Do not use
            "total_amount": 2000,
            "total_discount_amount": 0, // Do not use
            "total_tax_amount": 0,      // Do not use
        },
        {
            "type": "discount",         // Used for discounts
            "reference": "SAVE50",
            "name": "SAVE50",
            "quantity": 1,
            "unit_price": -5000,
            "tax_rate": 0,              // Do not use
            "total_amount": -5000,
            "total_discount_amount": 0, // Do not use
            "total_tax_amount": 0,      // Do not use
        }
    ],
}