netpay/omnipay-netpay
Composer 安装命令:
composer require netpay/omnipay-netpay
包简介
NetPay Payment Gateway Omnipay plugin
README 文档
README
Gateway Setup
Basic Gateway Creation Code
$gateway = Omnipay::create('NetPay_Api');
On gateway you can set the following options:
Allows you to test your code in test environment:
$gateway->setTestMode(TRUE);
If your endpoint varies from default you can set it using these functions:
$gateway->setLiveEndpoint($liveUrl); $gateway->setTestEndpoint($testUrl);
You can set your merchant credentials using functions:
$gateway->setMerchantId($merchant_id); $gateway->setUsername($username); $gateway->setPassword($password);
You can set SSL authentication for connection using functions:
$gateway->setCertificatePath($path_to_cert); $gateway->setCertificateKeyPath($path_to_key); $gateway->setCertificatePassword($cert_password);
Implemented Gateway Functionalities
Transactions using card data can be done following way:
$response = $gateway->purchase(array('amount' => '10.00', 'currency' => 'GBP', 'card' => $card))->send(); $response = $gateway->authorize(array('amount' => '10.00', 'currency' => 'GBP', 'card' => $card))->send();
You can use following function on any of previous requests to get order id of the payment:
$orderId = $response->getOrderId(); $response = $gateway->capture(array('amount' => '10.00', 'currency' => 'GBP', 'orderId' => $orderId))->send(); $response = $gateway->refund(array('amount' => '10.00', 'currency' => 'GBP', 'orderId' => $orderId))->send();
You can use following function on any of previous requests to get transaction id of the payment:
$transactionId = $response->getTransactionId(); $response = $gateway->retrieveTransaction(array('transactionId' => $transactionId, 'orderId' => $orderId))->send(); $response = $gateway->void(array('voidTransactionId' => $transactionId, 'orderId' => $orderId))->send();
Transaction id can also be retrieved from capture, refund and void requests.
For token transactions following can be used:
When saving card, permanent token expires when card expires and temporary one expires one hour after creation
$response = $gateway->createCard(array('card' => $card, 'tokenPermanent' => TRUE))->send();
You can retrieve created token from previous request the following way:
$token = $response->getToken();
Deletion of saved card
$response = $gateway->deleteCard(array('token' => $token))->send();
Retrieve info about stored card
$response = $gateway->retrieveCard(array('token' => $token))->send();
Making transactions using saved tokens
$response = $gateway->purchase(array('amount' => '10.00', 'currency' => 'GBP', 'token' => $token, 'cvv' => $cvv))->send(); $response = $gateway->authorize(array('amount' => '10.00', 'currency' => 'GBP', 'token' => $token, 'cvv' => $cvv))->send();
Following methods can be used on all requests:
Returns TRUE on successful transaction and FALSE on error
$response->isSuccessful();
Returns human readable message if there is one or NULL if not
$response->getMessage();
Following functions apply to purchase, authorize, capture, refund, void and retrieveTransaction methods, if data is unavailable they return NULL:
Value as generated by the acquirer that summarizes the success or otherwise of the proposed operation.
$response->getCode();
Value generated by the issuing bank in response to a proposal to transfer funds.
$response->getAuthorizationCode();
The Reference Retrieval Number (RRN) is a unique number generated by the acquirer for a specific merchant transaction. The RRN can be used to retrieve the transaction data from the acquirer.
$response->getReceipt();
Unique Order ID of the successful transaction.
$response->getOrderId();
The amount that has been successfully authorized for this order.
$response->getTotalAuthorizedAmount();
The amount that has been successfully captured for this order.
$response->getTotalCapturedAmount();
The amount that has been successfully refunded for this order.
$response->getRefundedAmount();
Summary of the success or otherwise of the proposed operation. List of codes at https://developer.netpay.co.uk/api/transaction/v1#collapseThree?retrieve_transaction_response under response.gateway_code
$response->getGatewayCode();
The acquirer CSC response code generated by the card issuing institution
$response->getCSCCode();
The card security code result generated to indicate whether the data supplied matches the data held by the cardholder's issuing bank. List of codes at https://developer.netpay.co.uk/api/transaction/v1#collapseThree?retrieve_transaction_response under response.cardsecurity.gateway_code
$response->getCSCGatewayCode();
The acquirer AVS response code generated by the card issuing institution.
$response->getAVSCode();
The address verification result generated to indicate whether the address data supplied matches the data held by the cardholder's issuing bank. List of codes at https://developer.netpay.co.uk/api/transaction/v1#collapseThree?retrieve_transaction_response under response.cardholder_verification.avs_gateway_code
$response->getAVSGatewayCode();
netpay/omnipay-netpay 适用场景与选型建议
netpay/omnipay-netpay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 73 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 04 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「pay」 「gateway」 「merchant」 「purchase」 「omnipay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 netpay/omnipay-netpay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 netpay/omnipay-netpay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 netpay/omnipay-netpay 相关的其它包
同方向 / 同关键字的高下载量 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
支付宝接口扩展包
统计信息
- 总下载量: 73
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-19