luxplus/kco_rest
Composer 安装命令:
composer require luxplus/kco_rest
包简介
Official Klarna REST PHP SDK
README 文档
README
SDK Deprecation Warning and Sunsetting
Dear community, the SDK you are currently looking at is now deprecated. These are details related to sunsetting:
- We intend to archive this repo on June 1 2020 (01/06/20)
- Until November 1 2020 (01/11/20) high severity security issues found within the latest published version will be fixed. All support will cease after this date.
- No new builds will follow effective April 20 (20/04/2020) apart from the fixes mentioned above.
Workarounds
We are making Klarna REST API definition files available in Swagger / OAS v2 format, under the Klarna API Reference section on the Klarna Developer Portal. These will be regularly updated as the APIs evolve. You can use tools like https://swagger.io/tools/swagger-codegen/ to generate your own SDKs, client libraries, etc.
Shop now. Pay later.
Shop at your favorite stores today and experience the freedom to pay later with Klarna.
Getting started
SDK covers all of Klarna API: https://developers.klarna.com/api/
Prerequisites
- PHP 5.5 or above
- API credentials
- Composer (optional)
API Credentials
Before getting a production account you can get a playground one. Register here to be able to test your SDK integration before go live:
- https://playground.eu.portal.klarna.com/developer-sign-up - for EU countries
- https://playground.us.portal.klarna.com/developer-sign-up - for the US
PHP SDK Installation and Usage
Install via Composer
To install the PHP SDK from the Central Composer repository use composer:
composer require klarna/kco_rest
Highly recommended to use version tag when installing SDK.
composer require klarna/kco_rest:1.2.3.4
Detailed information about the PHP SDK package and a list of available versions can be found here: https://packagist.org/packages/klarna/kco_rest
Include the SDK into your PHP file using the Composer autoloader:
<?php require('vendor/autoload.php');
Manual installation
To install the PHP SDK manually you need to clone the repo to any folder on your machine:
git clone git@github.com:klarna/kco_rest_php.git /path/to/some/folder/kco_rest_php
Include the SDK into your PHP file using the SDK autoloader:
<?php require('/path/to/some/folder/kco_rest_php/src/autoload.php');
⚠️Warning: Using manually installed SDK requires you to use the CURLTransport instance to send HTTP requests.
Read more about How to use HTTP Transport
Documentation and Examples
Klarna API documentation: https://developers.klarna.com/api/
SDK References: https://klarna.github.io/kco_rest_php/
Example files can be found in the docs/ directory.
Additional documentation can be found at https://developers.klarna.com.
Logging and Debugging
PHP SDK logs information to STDOUT/STDERR. To enable debug mode, set DEBUG_SDK environment variable:
$ DEBUG_SDK=true php <your_program.php>
or
$ export DEBUG_SDK=1 $ php <your_program.php>
Another way to enable Debugging Mode is define the DEBUG_SDK inside your script:
<?php // some code here define('DEBUG_SDK', true); // some code here
Be aware, the SDK just checks if the DEBUG_SDK is defined! It means you will see the debug information
by using define('DEBUG_SDK', false); or export DEBUG_SDK=no
More information about the DEBUG_SDK flag can be found here: klarna#32
The output will look like:
DEBUG MODE: Request
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GET : https://api.playground.klarna.com/customer-token/v1/tokens/TOKEN
Headers : {"User-Agent":["Library\/Klarna.kco_rest_php_3.1.0 (Guzzle\/6.3.3; curl\/7.54.0) OS\/Darwin_17.5.0 Language\/PHP_5.6.37"]}
Body :
DEBUG MODE: Response
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Headers : {"Content-Type":["application\/json"],"Date":["Wed, 15 Aug 2018 15:55:53 GMT"],"Klarna-Correlation-Id":["ABC-123"],"Server":["openresty"],"Content-Length":["62"],"Connection":["keep-alive"]}
Body : {
"status" : "ACTIVE",
"payment_method_type" : "INVOICE"
}
Questions and feedback
If you have any questions concerning this product or the implementation, please create an issue: https://github.com/klarna/kco_rest_php/issues/new/choose
Use an official Klarna Contact us form (https://klarna.com) if you have a question about the integration.
How to contribute
At Klarna, we strive toward achieving the highest possible quality for our products. Therefore, we require you to follow these guidelines if you wish to contribute.
To contribute, the following criteria needs to be fulfilled:
- Description regarding what has been changed and why
- Pull requests should implement a boxed change
- All code and documentation must follow the PSR-2 standard
- New features and bug fixes must have accompanying unit tests:
- Positive tests
- Negative tests
- Boundary tests (if possible)
- No less than 90% decision coverage
- All tests should pass
License
Klarna Checkout REST PHP SDK is licensed under Apache License, Version 2.0
luxplus/kco_rest 适用场景与选型建议
luxplus/kco_rest 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 233.33k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 09 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 luxplus/kco_rest 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 luxplus/kco_rest 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 233.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2020-09-30