承接 vkopytich13/cybersource-rest-client-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vkopytich13/cybersource-rest-client-php

Composer 安装命令:

composer require vkopytich13/cybersource-rest-client-php

包简介

Client SDK for CyberSource REST APIs

README 文档

README

The CyberSource PHP client provides convenient access to the CyberSource REST API from your PHP application.

Version

Requirements

  • PHP 5.6+
  • Enable cURL PHP Extension
  • Enable JSON PHP Extension
  • Enable MBString PHP Extension
  • Enable PHP_APCU PHP Extension. You will need to download it for your platform (Windows/Linux/Mac)
  • CyberSource Account
  • CyberSource API Keys

Dependencies

  • PHP-JWT : JWT token Generation
  • CURL : Http communication with the payment gateway
  • PHP_APCU : Caching
  • phpunit-5.7.25 : unit testing
  • phpunit-5.7.25 code coverage : Sonar coverage

Installation

Composer

We recommend using Composer. (Note: we never recommend you override the new secure-http default setting). Update your composer.json file as per the example below and then run composer update.

{
  "require": {
  "php": ">=5.6",
  "cybersource/rest-client-php": "0.0.25"
  }
}

Registration & Configuration

Use of this SDK and the CyberSource APIs requires having an account on our system. You can find details of getting a test account and creating your keys here

Once you have your keys, simply load them into the appropriate variables in your code, as per the below sample code dealing with the authentication part of the API request.

Remember this SDK is for use in server-side PHP applications that access the CyberSource REST API and credentials should always be securely stored and accessed appropriately.

SDK Usage Examples and Sample Code

To get started using this SDK, it's highly recommended to download our sample code repository:

In that respository, we have comprehensive sample code for all common uses of our API:

Additionally, you can find details and examples of how our API is structured in our API Reference Guide:

The API Reference Guide provides examples of what information is needed for a particular request and how that information would be formatted. Using those examples, you can easily determine what methods would be necessary to include that information in a request using this SDK.

MetaKey Support

A Meta Key is a single key that can be used by one, some, or all merchants (or accounts, if created by a Portfolio user) in the portfolio.

The Portfolio or Parent Account owns the key and is considered the transaction submitter when a Meta Key is used, while the merchant owns the transaction.

MIDs continue to be able to create keys for themselves, even if a Meta Key is generated.

Further information on MetaKey can be found in New Business Center User Guide.

To set your API credentials for an API request, configure the following information in ExternalConfiguration.php file:

Create a file in your application ExternalConfiguration.php inside a Resources folder and configure the following information as per requirement similar to this one.

For Http Signature Authentication

Configure the following information in ExternalConfiguration.php file

  • Authentication Type: Merchant should enter "HTTP_SIGNATURE" for HTTP authentication mechanism.
  • Merchant ID: Merchant will provide the merchant ID, which has taken from EBC portal.
  • MerchantSecretKey: Merchant will provide the secret Key value, which has taken from EBC portal.
  • MerchantKeyId: Merchant will provide the Key ID value, which has taken from EBC portal.
  • Enable Log: To start the log entry provide true else enter false.
  • LogDirectory: Merchant will provide directory path where logs will be created.
  • LogMaximumSize: Merchant will provide size value for log file.
  • LogFilename: Merchant will provide log file name.
   $this->authType          = "HTTP_SIGNATURE";
   $this->runEnv            = "apitest.cybersource.com";
   $this->merchantID        = <merchantID>;
   $this->apiKeyID          = <merchantKeyId>;
   $this->secretKey         = <merchantSecretKey>;

   $this->enableLog         = true;
   $this->logSize           = <logMaximumSize>;
   $this->logFile           = <logDirectory>;
   $this->logFilename       = <logFilename>;

   $this->proxyUrl          = <proxyHost>;
   $this->proxyHost         = <proxyPort>;

   $this->useMetaKey        = false;

For Jwt Signature Authentication

Configure the following information in the ExternalConfiguration.php file

  • Authentication Type: Merchant should enter "JWT" for JWT authentication mechanism.
  • Merchant ID: Merchant will provide the merchant ID, which has taken from EBC portal.
  • keyAlias: Alias of the Merchant ID, to be used while generating the JWT token.
  • keyPassword: Alias of the Merchant password, to be used while generating the JWT token.
  • keyFileName: Filename of the key generated from the EBC portal, without the extension part .P12
  • keysDirectory: Path of the directory, where key is placed.
  • Enable Log: To start the log entry provide true else enter false.
  • LogDirectory: Merchant will provide directory path where logs will be created.
  • LogMaximumSize: Merchant will provide size value for log file.
  • LogFilename: Merchant will provide log file name.
   $this->authType            = "JWT";
   $this->runEnv              = "apitest.cybersource.com";
   $this->merchantID          = <merchantID>;

   $this->keyAlias            = <keyAlias>;
   $this->keyPass             = <keyPassword>;
   $this->keyFilename         = <keyFileName>";
   $this->keyDirectory        = <keysDirectory>;

   $this->enableLog           = true;
   $this->logSize             = <logMaximumSize>;
   $this->logFile             = <logDirectory>;
   $this->logFilename         = <logFilename>;

   $this->proxyUrl            = <proxyHost>;
   $this->proxyHost           = <proxyPort>;

   $this->useMetaKey          = false;

For using MetaKey

MetaKey can be used for HTTP Signature and JWT authentication

For HTTP Signature Authentication

   $this->authType            = "HTTP_SIGNATURE";
   $this->merchantID          = <child merchantID>;
   $this->apiKeyID            = <MetaKey merchantKeyId>;
   $this->secretKey           = <Metakey merchantsecretKey>;
   $this->useMetaKey          = true;
   $this->portfolioID         = <Portfolio ID>;

For JWT Authentication

   $this->authenticationType  = "JWT";
   $this->merchantID          = <child merchantID>;
   $this->keyAlias            = <keyAlias>;
   $this->keyPass             = <keyPassword>;
   $this->keyFileName         = <keyFileName>;
   $this->keyDirectory        = <keysDirectory>;
   $this->useMetaKey          = true;

Switching between the sandbox environment and the production environment

CyberSource maintains a complete sandbox environment for testing and development purposes. This sandbox environment is an exact duplicate of our production environment with the transaction authorization and settlement process simulated. By default, this SDK is configured to communicate with the sandbox environment. To switch to the production environment, set the appropriate property in Resources\ExternalConfiguration.php.

For example:

   // For TESTING use
   // $this->runEnv = "apitest.cybersource.com";
   // For PRODUCTION use
   $this->runEnv = "api.cybersource.com";

The API Reference Guide provides examples of what information is needed for a particular request and how that information would be formatted. Using those examples, you can easily determine what methods would be necessary to include that information in a request using this SDK.

vkopytich13/cybersource-rest-client-php 适用场景与选型建议

vkopytich13/cybersource-rest-client-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.84k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 09 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「ecommerce」 「payment」 「payments」 「merchant」 「authorize」 「merchants」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 vkopytich13/cybersource-rest-client-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 vkopytich13/cybersource-rest-client-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 vkopytich13/cybersource-rest-client-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 3.84k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 75
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2021-09-03