wearede/tbcpay-php
Composer 安装命令:
composer require wearede/tbcpay-php
包简介
online payments php SDK - collect credit card payments via TbcBank processor
README 文档
README
TBC Credit Card Payment Gateway (php-library)
Making credit card payments work on your website (through a local bank) is pain! So to make everyone's life a bit easier we are sharing this php-library on GitHub.
SMS / DMS
There are two types of transaction within this system: SMS and DMS.
SMS - is a direct payment method, money is charged in 1 event, as soon as customer enters the credit card details and clicks proceed.
DMS - is a two step method, first event blocks the money on the card (max 30 days), second event captures the money (second event can be carried out when product is shipped to the customer for example).
Every 24 hours, a merchant must close the business day.
Install
It is possible to simply include this library see example, but you should use composer instead.
run in terminal:
composer require wearede/tbcpay-php
Creating object
$Payment = new TbcPayProcessor('/cert/tbcpay.pem', '0DhJ4AdxVuPZmz3F4y', $_SERVER['REMOTE_ADDR']);
- Certificate absolute path
- Certificate passphrase
- Client ip address
Methods
| Method name |
|---|
| sms_start_transaction() |
| dms_start_authorization() |
| dms_make_transaction($trans_id) |
| get_transaction_result($trans_id) |
| reverse_transaction($trans_id, $amount = '', $suspected_fraud = '') |
| refund_transaction($trans_id) |
| credit_transaction($trans_id, $amount = '') |
| close_day() |
Example implementations
- To get started quickly have a look at the fully functional working prototype.
- You can find a simple example here.
Instructions
Relevant to a simple example here.
Chores
- Ask TBC to generate a certificate.
- Tell TBC your server IP so they can whitelist it.
- create
example.com/ok.phpandexample.com/fail.phpurls and communicate these to TBC.- ok url - is used for redirecting back user in almost all situations (even when card has insuficient funds and transaction fails!).
- fail url - is used for redirecting back user when technical error occurs (very rare).
Flow
start.exampleHere we start our process. We call TBC servers usingsms_start_transaction()and get$trans_idin return.- We use returned $trans_id to redirect user to a TBC page, where credit card info can be entered.
- After user fills out card info he is thrown back to our
ok.exampleurl on our server.
- Take a look at
ok.exampleWe get$trans_idback from TBC, and we plug that inget_transaction_result($trans_id). get_transaction_result($trans_id)tells us if transaction was success or not.array('RESULT' => 'OK')for example is success message, transaction went through.
Common issues
- TBC bank provides SSL certificate in .p12 format, we need it in .pem format, to transform use command:
openssl pkcs12 -in *.p12 -out tbcpay.pem. - Move cert directory somewhere non public as a security meassure. Give it correct permissions so that php can read it.
- SDK needs outgoing port 18443 open to communicate with TBC. Some hosting services do not allow this.
wearede/tbcpay-php 适用场景与选型建议
wearede/tbcpay-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.66k 次下载、GitHub Stars 达 90, 最近一次更新时间为 2015 年 08 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 wearede/tbcpay-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wearede/tbcpay-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 91
- 点击次数: 15
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-18
