globalpayments/php-sdk
Composer 安装命令:
composer require globalpayments/php-sdk
包简介
PHP SDK for processing payments with Global Payments, including Heartland Payment Systems and Realex Payments
README 文档
README
GlobalPayments PHP SDK
This SDK makes it easy to integrate your PHP application with our Card Not Present and Card Present APIs.
Solutions
General / Omnichannel
- API Payment Processing
- Apple Pay & Google Pay
- Secure Card Storage & Customer Management
- Subscriptions / Recurring Billing Solutions
- Credit, Debit, Gift & Loyalty, and eCheck/ACH
Card Not Present (Ecommerce & MOTO) Specific
- Minimize PCI compliance requirements with Hosted Payment Solutions
- 140+ Authorization Currencies & 16 Settlement Currencies
- 150+ Local Payment Methods Worldwide
- Account Updater
- Inbuilt Fraud Prevention Rules
- 3D Secure, AVS and CVV Checks
- 260+ Global Enterprise Fraud Rules
Card Present (Terminal & POS) Specific
- Secure End-To-End Encryption
Requirements
- PHP 8.0.0+
- OpenSSL 1.0.1+
- PHP Curl extension
- PHP DOM extension
- PHP OpenSSL extension
Installation
Installing the SDK into your solution is usually be done by either using Composer/Packagist, or by adding the project to your solution and referencing it directly.
To install via Composer/Packagist:
composer require globalpayments/php-sdk
To install via a direct download:
Download and unzip or, using Git, clone the repository from GitHub. See more on how to clone repositories.
git clone https://github.com/globalpayments/php-sdk
Documentation and Examples
You can find the latest SDK documentation along with code examples and test cards on the GlobalPayments and GlobalPayments Developer Hubs.
In addition you can find working examples in the our example code repository.
Quick Tip: The included test suite can be a great source of code samples for using the SDK!
Process a Payment Example
$card = new CreditCardData(); $card->number = "4111111111111111"; $card->expMonth = "12"; $card->expYear = "2025"; $card->cvn = "123"; try { $response = $card->charge(129.99) ->withCurrency("EUR") ->execute(); $result = $response->responseCode; // 00 == Success $message = $response->responseMessage; // [ test system ] AUTHORISED } catch (ApiException $e) { // handle errors }
Test Card Data
| Name | Number | Exp Month | Exp Year | CVN |
|---|---|---|---|---|
| Visa | 4263970000005262 | 12 | 2025 | 123 |
| MasterCard | 2223000010005780 | 12 | 2019 | 900 |
| MasterCard | 5425230000004415 | 12 | 2025 | 123 |
| Discover | 6011000000000087 | 12 | 2025 | 123 |
| Amex | 374101000000608 | 12 | 2025 | 1234 |
| JCB | 3566000000000000 | 12 | 2025 | 123 |
| Diners Club | 36256000000725 | 12 | 2025 | 123 |
Testing Exceptions
During your integration you will want to test for specific issuer responses such as 'Card Declined'. Because our sandbox environments do not actually reach out to issuing banks for authorizations, there are specific transaction amounts and/or card numbers that will trigger gateway and issuing bank responses. Please contact your support representative for a complete listing of values used to simulate transaction AVS/CVV results, declines, errors, and other responses that can be caught in your code. Example error handling code:
try { $response = $card->charge(129.99) ->withCurrency("EUR") ->execute(); } catch (BuilderException $e) { // handle builder errors } catch (ConfigurationException $e) { // handle errors related to your services configuration } catch (GatewayException $e) { // handle gateway errors/exceptions } catch (UnsupportedTransactionException $e) { // handle errors when the configured gateway doesn't support // desired transaction } catch (ApiException $e) { // handle all other errors }
Contributing
All our code is open sourced and we encourage fellow developers to contribute and help improve it!
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Ensure SDK tests are passing
- Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
License
This project is licensed under the GNU General Public License v2.0. Please see LICENSE.md located at the project's root for more details.
globalpayments/php-sdk 适用场景与选型建议
globalpayments/php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.4M 次下载、GitHub Stars 达 55, 最近一次更新时间为 2017 年 08 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 globalpayments/php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 globalpayments/php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.4M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 55
- 点击次数: 25
- 依赖项目数: 9
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2017-08-31