Skip to content

Instantly share code, notes, and snippets.

@robjmills
Created April 11, 2019 11:22
Show Gist options
  • Save robjmills/d4e9b202460ee4f8e3888837b24abb26 to your computer and use it in GitHub Desktop.
Save robjmills/d4e9b202460ee4f8e3888837b24abb26 to your computer and use it in GitHub Desktop.
Example of a Klarna checkout order with a voucher line item
<?php
$order = [
'amount' => 88,
'tax_amount' => 14.67,
'currency' => 'GBP',
'locale' => 'GB',
'purchase_country' => 'GB',
'notify_url' => 'https://developers.klarna.com/api/#checkout-api__ordermerchant_urls__validation',
'return_url' => 'https://developers.klarna.com/api/#checkout-api__ordermerchant_urls__checkout',
'terms_url' => 'https://developers.klarna.com/api/#checkout-api__ordermerchant_urls__terms',
'validation_url' => 'https://developers.klarna.com/api/#checkout-api__ordermerchant_urls__validation',
'items' => [
[
'type' => 'physical',
'name' => 'Shirt',
'quantity' => 1,
'tax_rate' => 20,
'price' => 100,
'unit_price' => 83.33,
'total_tax_amount' => 16.67,
],
[
'type' => 'discount',
'name' => 'voucher code',
'quantity' => 1,
'tax_rate' => 20,
'price' => -12,
'unit_price' => -10,
'total_tax_amount' => -2,
],
],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment