Making payment work on your website is a pain!
So to make everyones' life a bit easier we are sharing the
Georgian TBC payment gateway sdk on GitHub.
Have fun :)
There are two types of transaction within this system: SMS and DMS.
SMS - is direct payment, where money is charged in 1 event.
DMS - is delayed. Requires two events: first event blocks money on the card, second event takes this money. Second event can be carried out when product is shipped to the customer for example.
Every 24 hours, the merchant must send a request to server to close the business day.
$Payment = new tbcpay( 'https://securepay.ufc.ge:18443/ecomm2/MerchantHandler', __DIR__ . '/cert/tbcpay.pem', '0DhJ4AdxVuPZmz3F4y', $_SERVER['REMOTE_ADDR'], 1, 981, 'product_id:1234567', 'GE' );
- Submit url (provided by bank)
- Certificate absolute path
- Certificate passphrase
- Client ip address
- Amount
1
(0.01 gel) - Currency
981
(http://en.wikipedia.org/wiki/ISO_4217) - Description
- Interface language
EN
Method name | Return Value | Description |
---|---|---|
sms_start_transaction() | array( 'TRANSACTION_ID' => 'AX23x...' ) |
start SMS transaction. This is simplest form that charges amount to customer instantly. |
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() |
-
Ask bank to generate certificate
-
Tell them your server IP so they whitelist it
-
create
example.com/ok.php
andexample.com/fail.php
urls and tell them about it- ok url - is used for redirecting back user in almost all situations
- fail ulr - is used for redirecting back user when technocal error occurs
-
start.php
Here we start our process. We call bank servers usingsms_start_transaction()
and get$trans_id
in return.- We use returned $trans_id to redirect user to a bank page, where credit card info can be entered.
- After user fills out card info he is thrown back to our
ok.php
url on our server.
-
Take a look at
ok.php
We get$trans_id
back from bank, 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.
- Regular payments
- DMS example
- CRON for
close_day()
- Make composer compatible
This API besides TBCBANK should support BANK OF GEORGIA, LIBERTY BANK, and some other minor banks. But since I've only tested this with TBCBANK, I'm releasing this as such.
TBC bank provides SSL certificate in .p12 format
To Trasnform it into .pem format Run: openssl pkcs12 -in *.p12 -out tbcpay.pem
! Move cert directory somewhere non accessible to web server as a security meassure.