omnipay/authorizenet
Composer 安装命令:
composer require omnipay/authorizenet
包简介
Authorize.Net gateway for the Omnipay payment processing library
README 文档
README
Authorize.Net driver for the Omnipay PHP payment processing library
Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Authorize.Net support for Omnipay.
Installation
Omnipay is installed via Composer. To install, simply require league/omnipay and omnipay/authorizenet with Composer:
composer require league/omnipay omnipay/authorizenet:"3.x@dev"
Basic Usage
The following gateways are provided by this package:
- AuthorizeNet_AIM
- AuthorizeNet_CIM
- AuthorizeNet_SIM
- AuthorizeNet_DPM
In addition, Accept.JS is supported by the AIM driver and CIM (create card). More details are provided below.
For general usage instructions, please see the main Omnipay repository.
Accept.JS
This gateway uses a JavaScript script to tokenize credit card details at the front end, i.e. in the payment form. Just the tokenized version of the credit card is then sent back to the merchant site, where it is used as a proxy for the credit card.
The card is tokenized into two values returned in opaqueData object from Accept.JS:
- dataDescriptor - the type of opaque data, e.g. "COMMON.ACCEPT.INAPP.PAYMENT"
- dataValue - the value for the opaque data, e.g. "eyJjb2RlIjoiNT... {256 characters} ...idiI6IjEuMSJ9"
These two values must be POSTed back to the merchant application, usually as a part of the payment form. Make sure the raw credit card details are NOT posted back to your site. How this is handled is beyond this short note, but examples are always welcomed in the documentation.
On the server, the tokenized details are passed into the payment or authorize request object.
You will still need to pass in the CreditCard object, as that contains details of the payee and
recipient, but just leave the credit card details of that object blank. For example:
// $gateway is an instantiation of the AIM driver. // $dataDescriptor and $dataValue come from the payment form at the front end. use Omnipay\Common\CreditCard; $request = $gateway->purchase( [ 'notifyUrl' => '...', 'amount' => $amount, // 'opaqueDataDescriptor' => $dataDescriptor, 'opaqueDataValue' => $dataValue, // 'card' => new CreditCard([ 'firstName' => 'Anne', 'lastName' => 'Payee', ... ]), ... ] );
CIM Create Card feature usage: Accept.js must be implemented on your frontend payment form, once Accept.js 'tokenizes' the customer's card, just send the two opaque fields and remove the Card's (Number, Expiration and CVV) from your post request.
Accept.js goal is to remove the need of Card information from ever going into your server so be sure to remove that data before posting to your server.
The create card feature on CIM will automatically create a Customer Profile and a Payment Profile with the 'tokenized' card for each customer you request it for on your authorize.net account, you can use these Payment Profiles later to request payments from your customers.
In order to create a Customer & Payment Profile pass the opaque fields and the card array with the billing information to the createCard method on the CIM driver:
// $gateway is an instantiation of the CIM driver. //Omnipay::create( 'AuthorizeNet_CIM' ) // $dataDescriptor and $dataValue come from the payment form at the front end. $request = $gateway->createCard( [ 'opaqueDataDescriptor' => $dataDescriptor, 'opaqueDataValue' => $dataValue, 'name' => $name, 'email' => $email, //Authorize.net will use the email to identify the CustomerProfile 'customerType' => 'individual', 'customerId' => $user_customer_id,//a customer ID generated by your system or send null 'description' => 'MEMBER',//whichever description you wish to send 'forceCardUpdate' => true 'card' => [ 'billingFirstName' => $name, 'billingLastName' => $last_name, 'billingAddress1' => $address, 'billingCity' => $city, 'billingState' => $state, 'billingPostcode' => $zipcode, 'billingPhone' => '', //... may include shipping info but do not include card (number, cvv or expiration) ], ] ); $response = $request->send(); $data = $response->getData(); $data['paymentProfile']['customerProfileId']; $data['paymentProfile']['customerPaymentProfileId']; // Now you can use these 2 fields to reference this customer and this payment profile for later use with // the rest of the CIM driver features as usual.
DPM and SIM Signatures
DPM and SIM used to sign their requests with the transactionKey using the mdh HMAC algorithm.
From early 2019, this algorithm is being removed completely.
Instead, the SHA-512 HMAC algorithm is used to sign the DPM and SIM requests,
and to validate the received notifications.
To start using the SHA-512 signing, set your signatureKey in the gateway:
$gateway->setSignatureKey('48D2C629E4A...{100}...E7CA3C4E6CD7223D');
The signatureKey can be generated in the API Credentials & Keys section of your account setings.
Support
If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.
If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.
If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.
omnipay/authorizenet 适用场景与选型建议
omnipay/authorizenet 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.6M 次下载、GitHub Stars 达 58, 最近一次更新时间为 2013 年 11 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「pay」 「gateway」 「merchant」 「authorize」 「authorize.net」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 omnipay/authorizenet 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 omnipay/authorizenet 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 omnipay/authorizenet 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Payyo Gateway for the Omnipay payment processing library
Библиотека для приема платежей через Альфабанк.
Some pre-defined rules for validation in Omnipay payment processing library.
BluePay gateway for the Omnipay payment processing library
支付宝接口扩展包
统计信息
- 总下载量: 2.6M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 59
- 点击次数: 33
- 依赖项目数: 8
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-11-16