{"id":20849653,"url":"https://github.com/pimcore/payment-provider-klarna","last_synced_at":"2025-05-12T04:30:48.770Z","repository":{"id":57041651,"uuid":"333177021","full_name":"pimcore/payment-provider-klarna","owner":"pimcore","description":"Klarna payment integration for Pimcore Ecommerce Framework (community bundle)","archived":false,"fork":false,"pushed_at":"2025-01-17T10:32:21.000Z","size":39,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":10,"default_branch":"2.x","last_synced_at":"2025-05-01T05:19:25.600Z","etag":null,"topics":["payment-integration","pimcore"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pimcore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-26T18:23:48.000Z","updated_at":"2024-04-29T11:48:31.000Z","dependencies_parsed_at":"2024-01-22T12:39:41.413Z","dependency_job_id":"747695c1-c262-4fc5-9f50-538d98fb1229","html_url":"https://github.com/pimcore/payment-provider-klarna","commit_stats":{"total_commits":14,"total_committers":6,"mean_commits":"2.3333333333333335","dds":0.5714285714285714,"last_synced_commit":"0a01054a99959b1d4fe8d944bd2f0d0bb36a1d59"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimcore%2Fpayment-provider-klarna","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimcore%2Fpayment-provider-klarna/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimcore%2Fpayment-provider-klarna/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimcore%2Fpayment-provider-klarna/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pimcore","download_url":"https://codeload.github.com/pimcore/payment-provider-klarna/tar.gz/refs/heads/2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253675111,"owners_count":21945900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["payment-integration","pimcore"],"created_at":"2024-11-18T03:06:03.508Z","updated_at":"2025-05-12T04:30:48.347Z","avatar_url":"https://github.com/pimcore.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pimcore E-Commerce Framework Payment Provider - Klarna\n\n### Official Klarna Documentation\n* [Klarna Documentation](https://www.developers.klarna.com/en/de/kco-v2/klarna-checkout-overview-v1)\n* [Test card numbers](https://www.developers.klarna.com/en/de/kco-v2/test-credentials)\n\nTest E-Mail Accounts\n- klarna@green.com -\u003e Open Invoice without selection of payment method\n- klarna@yellow.com -\u003e selection of payment methods: open invoice + credit cart\n- klarna@red.com -\u003e only credit card\n\n## Requirements\n - klarna/checkout\n\n## Installation\n\nInstall latest version with Composer:\n```bash \ncomposer require pimcore/payment-provider-klarna\n```\n\nEnable bundle via console or extensions manager in Pimcore backend:\n```bash\nphp bin/console pimcore:bundle:enable PimcorePaymentProviderKlarnaBundle\n```\n## Configuration\n\n```php\n\u003c?php\n$url = $this-\u003eview-\u003eserverUrl();\n$config = [\n    'purchase_country' =\u003e 'AT'\n    , 'merchant_reference' =\u003e [\n        'orderid2' =\u003e $paymentInfo-\u003egetInternalPaymentId()\n    ]\n    , 'locale' =\u003e 'de-at'\n    , 'merchant' =\u003e [\n        'back_to_store_uri' =\u003e $url(['action' =\u003e 'payment'])\n        , 'terms_uri' =\u003e $this-\u003eview-\u003eserverUrl() . '/agb'\n        , 'checkout_uri' =\u003e $url(['action' =\u003e 'payment']) . '?klarna_order={checkout.order.uri}'\n        , 'confirmation_uri' =\u003e $url(['action' =\u003e 'confirm'], 'payment') . '?klarna_order={checkout.order.uri}'\n        , 'push_uri' =\u003e $url(['action' =\u003e 'confirm'], 'payment') . '?klarna_order={checkout.order.uri}'\n        , 'validation_uri' =\u003e $this-\u003eview-\u003eserverUrl() . '/\u003cLINK TO VALIDATE ORDER\u003e?klarna_order={checkout.order.uri}'\n    ]\n    , 'options' =\u003e [\n        'color_button' =\u003e '#557F0D'\n        , 'color_button_text' =\u003e '#FFFFFF'\n        , 'color_checkbox' =\u003e '#FF0000'\n        , 'color_checkbox_checkmark' =\u003e '#FF0000'\n        , 'color_header' =\u003e '#EA5B0C'\n        , 'color_link' =\u003e '#FF0000'\n        , 'allow_separate_shipping_address' =\u003e true\n    ]\n];\n```\n\n## The cart items \nThe Klarna provider implementation has currently no fallback to the default checkout manager to extract the cart items. So you have to pass them in the config array `$config['cart']['items'] `. \nSee under __\"1. Add the cart items\"__ https://developers.klarna.com/en/at/kco-v2/checkout/2-embed-the-checkout \n\nExample implementation:\n\n```php\n    $items = [];\n\n    foreach ( $cart-\u003egetItems() as $cartItem){\n\n            $item = [];\n            $item['reference'] = $cartItem-\u003egetProduct()-\u003egetOSProductNumber(); // a unique reference for this product / variant\n            $item['name'] = $cartItem-\u003egetProduct()-\u003egetOSName(); \n            $item['quantity'] = (int) $cartItem-\u003egetCount();\n\n            $unitPrice = $cartItem-\u003egetProduct()-\u003egetOSPrice(); // the price for 1 piece\n            $item['unit_price'] =  (int) $unitPrice-\u003egetAmount()-\u003easRawValue() / 100; // format to integer\n            \n            $item['discount_rate'] = 0; // mostly implemented via an cart modificator\n            $item['tax_rate'] = 0; // can be null, if you don't need tax calculation in the Klarna checkout\n            $items[]  = $item; // push it to the items array\n     }\n     \n     $config['cart']['items'] = $items;\n```\n\nMost important is the formatting of the prices, they have to be integers. For example: `20.00 €` has to become `2000`. Klarna only accepts integers because of avoiding rounding mistakes. \n\nHere is a list for all accepted item fields: https://developers.klarna.com/en/at/kco-v2/checkout-api#cart-item-object-properties \n\n\n\n\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpimcore%2Fpayment-provider-klarna","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpimcore%2Fpayment-provider-klarna","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpimcore%2Fpayment-provider-klarna/lists"}