apility/nets-easy
Composer 安装命令:
composer require apility/nets-easy
包简介
Nets Easy library
README 文档
README
The NETS Easy PHP library provides convenient access to the NETS Easy API from applications written in the PHP language. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses.
Requirements
PHP 7.3.0 and later.
Composer
You can install the bindings via Composer. Run the following command:
composer require apility/nets-easy
To use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');
Getting Started
Simple usage looks like:
Backend integration
<?php use Nets\Easy; use Nets\Easy\Payment; Easy::setup([ 'secret_key' => '00000000000000000000000000000000', 'checkout_key' => '00000000000000000000000000000000', 'merchant_id' => '000000000' ]); $payment = Payment::create([ 'checkout' => [ 'url' => 'https://domain.tld/checkout', // The exact URL where your checkout is hosted (except query parameters and fragments) 'termsUrl' => 'https://domain.tld/terms', // Your terms ], 'order' => [ 'currency' => 'NOK', 'reference' => '1', // A unique reference for this specific order 'amount' => 10000, // Total order amount in cents 'items' => [ [ 'reference' => '1', // A unique reference for this specific item 'name' => 'Test', 'quantity' => 1, 'unit' => 'pcs', 'unitPrice' => 8000, // Price per unit except tax in cents 'taxRate' => 25000 // Taxrate (e.g 25.0 in this case), 'taxAmount' => 2000 // The total tax amount for this item in cents, 'grossTotalAmount' => 10000 // Total for this item with tax in cents, 'netTotalAmount' => 8000 // Total for this item without tax in cents ] ] ] ]);
Frontend integration
The simplest way to integrate the checkout form in the frontend, is to use the form helper method on the Payment object.
<?php use Nets\Easy; use Nets\Easy\Payment; Easy::setCredentials(...); $payment = isset($_GET['paymentId'] ? Payment::retrieve($_GET['paymentId']) : Payment::create(...); $form = $payment->form([ 'redirect' => 'https://domain.tld/checkout/complete', // URL to redirect to on payment completion (paymentId query parameter is appended) 'theme' => [ // Optional 'textColor' => 'blue', 'linkColor' => '#bada55', 'buttonRadius' => '50px' ] ]); ?> <div id="easy-complete-checkout"></div> <?php echo $form; ?>
Alternatively, if you require full control of checkout flow, implement it manually:
<html> <head> <title>Example checkout</title> </head> <body> <div id="easy-complete-checkout"></div> <script> document.addEventListener('DOMContentLoaded', () => { const checkout = new Dibs.Checkout({ checkoutKey: "00000000000000000000000000000000", // Checkout Key paymentId: "00000000000000000000000000000000", // Payment ID created in the backend integration partnerMerchantNumber: "000000000", // Merchant ID containerId: "easy-complete-checkout", // Container element where the checkout form should be created }) checkout.on('payment-completed', ({ paymentId }) => { // Payment is completed, do what you need to do here }) }) </script> <script src="https://test.checkout.dibspayment.eu/v1/checkout.js?v=1"></script> <!-- or if in production: --> <script src="https://checkout.dibspayment.eu/v1/checkout.js?v=1"></script> </body> </html>
Documentation
See the Official API docs.
apility/nets-easy 适用场景与选型建议
apility/nets-easy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.42k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2020 年 04 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「nets」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 apility/nets-easy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 apility/nets-easy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 apility/nets-easy 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP banklink library to easily integrate Baltic banklinks.
Nets Easy Checkout gateway for Omnipay payment processing library
Nets Easy driver for the Omnipay PHP payment processing library
Laravel Cashier-inspired subscription billing for Nets Easy.
Nets EstCard implementation
Window model constructor
统计信息
- 总下载量: 9.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 8
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-06