solidpay/php-client
Composer 安装命令:
composer require solidpay/php-client
包简介
PHP-SDK to communicate with the payment provider Solidpay.io
README 文档
README
solidpay-php-client is a official client for Solidpay. The Solidpay API enables you to accept payments in a secure and reliable manner.
Installation
Composer
Simply add a dependency on solidpay/solidpay-php-client to your project's composer.json file if you use Composer to manage the dependencies of your project. Here is a minimal example of a composer.json file that just defines a dependency on newest stable version of Solidpay:
{
"require": {
"solidpay/php-client": "1.0.*"
}
}
With command line
Adding the Solidpay repository with command line is easy as well. Just type:
composer require solidpay/php-client
Manually upload
If you cannot use composer or don't have SSH access to your server, you can upload /solidpay/ to your web space. However, then you need to manage the autoloading of the classes yourself.
Usage
Before doing anything you should register yourself with Solidpay and get access credentials.
Create a new payment
require_once("/vendor/autoload.php"); use Solidpay\Solidpay; try { $api_key = 'YOUR_KEY'; $merchant_id = 'YOUR_MERCHANT_ID'; $client = new Solidpay($api_key, $merchant_id); $form = array( 'order_id' => 'YOUR_TRANSACTION_ID', 'currency' => 'gbp', 'amount' => '100', 'capture' => false, 'return_url' => 'https://yourstore.com/success/123456' ); $payments = $client->request->post('/payments/', $form); $status = $payments->httpStatus(); if ($status == 200){ $payments = $payments->asArray(); $paymentUrl = $payments['url']; $paymentId = $payments['id']; } } catch (Exception $e) { }
Response
If the payload was successful, you will get a success response like the one below.
{
"status": "success",
"id": "502244",
"url": "https://solidpay.io/payments/bd1b9bc8c35df675a9b174d499aa7e2e4dfd1658fe8bbd4c4a94a247deb969f3"
}
API Calls
You can afterwards call any method described in Solidpay api with corresponding http method and endpoint. These methods are supported currently: get, post, put, patch and delete. For full list of API calls you can find all examples in Postman collection.
// Get all payments $payments = $client->request->get('/payments'); // Get specific payment $payments = $client->request->get('/payments/{id}'); // Refund payment $form = array( 'amount' => '100', ); $payments = $client->request->post('/payments/{id}/refund', $form); // Capture payment $form = array( 'amount' => '100', ); $payments = $client->request->post('/payments/{id}/capture', $form);
solidpay/php-client 适用场景与选型建议
solidpay/php-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 05 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 solidpay/php-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 solidpay/php-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-05-08