Parameter | Type | Description | Sample |
---|---|---|---|
order_id |
string(1024) | Order ID which is generated by merchant.
mandatory
|
ID1234 |
merchant_id |
integer(12) | Merchant unique ID. Generated by hutko during merchant registration.
mandatory
|
1 |
order_desc |
string(1024) | Order description. Generated by merchant in UTF-8 always
mandatory
|
Hotel booking №1234 Antalya Resort |
signature |
string(40) | Order signature. Required to verify merchant request consistency and authenticity. Signature generation algorithm please see at Signature generation for request and response
mandatory
|
1773cf135bd89656131134b98637894dad42f808
|
amount |
integer(12) | Order amount in cents without separator
mandatory
|
1020 (EUR) means 10 euros and 20 cents |
currency |
string(3) |
Order currency. Supported values: Full list of supported currencies. |
EUR |
version |
string(10) | Protocol version.
Default value: 1.0.1
Version 1.0 is deprecated
|
If 1.0.1 passed, additional_info parameter will be returned in the callback |
response_url |
string(2048) | Merchant site URL, where a customer will be redirected after payment completion |
http://site.com/responseurl
|
server_callback_url |
string(2048) | Merchant site URL, where host-to-host callback will be sent after payment completion. See Receiving Callbacks for more details on callbacks. |
http://site.com/callbackurl
|
payment_systems |
string(1024) | Payment systems which can be used for payment by the customer at hutko payment page. Systems must be separated by a comma or semicolon. Supported values: see. Supported payment systems Default value: is set from merchant settings in hutko merchant portal
|
card
|
payment_method |
string(1024) | The payment method that should be displayed to the payer on the payment page by default. For example, monobank_ua
Default: taken from merchant settings
|
card
|
default_payment_system |
string(25) | Payment system which will be shown to the customer at hutko payment page first. Supported values: see. Supported payment systems |
card |
lifetime |
integer(9) | Order lifetime in seconds. After this time, the order will be given the status of ‘expired’ if the client has not paid it
Default value: 36000
Maximum allowed value: 69120000
|
600 |
merchant_data |
string(2048) | Any arbitrary set of data that a merchant wants to get back in the response to response_url or/and server_callback_url , and also in reports |
|
preauth |
string(1) | Parameter supported only for Visa/MasterCard payment method N — the amount is debited from the customer’s card immediately and settled to the merchant account, in accordance with the rules of settlements. Y — amount held on the customer card and not charged until the merchant sends a ‘capture’ request to confirm Default value: N
|
N |
sender_email |
string(254) | Customer email | |
descriptor |
string(21) | Dynamic descriptor | |
delayed |
string(1) | Delayed order flag. Y — allows the customer to pay the order during period sent by the merchant in lifetime parameter. Merchant must expect several host-to-host callbacks and browser redirects at the same order. Customer will have the possibility to try to pay the same order_id , if the previous attempt failedN — after payment is declined order_id customer will be redirected to the merchant site to recreate the order. In this case, only one callback will be sent to server_callback_url
Default value: Y
|
|
lang |
string(2) | Payment page language. Supported values: uk – Ukrainian ru – Russian en – English lv – Latvian fr – French cs – Czech ro – Romanian it – Italian sk – Slovak pl – Polish es – Spanish hu – Hungarian de – German |
|
product_id |
string(1024) | Merchant product or service id | |
required_rectoken |
string(1) | Flag which indicates whether hutko must return card token — token to access card funds without cardholder interaction
Default value: N
|
Y |
verification |
string(1) | If Y order will be automatically reversed by hutko after successful approval
Default value: N
|
Y |
verification_type |
string(25) | amount – amount submitted from merchant will be held on card code – amount submitted from merchant will be held on card. Also, cardholder have to enter 4-characters code to pass verification Default value: amount
|
Y |
rectoken |
string(40) | Card token — token to access card funds without cardholder interaction |
544d3f86237886b6404d8b000f6a7d71c45410b7
|
receiver_rectoken |
string(40) | Card token — token to credit card without transferring full card number |
544d3f86237886b6404d8b000f6a7d71c45410b7
|
design_id |
integer(6) | ID of design which is set in merchant portal |
123
|
subscription |
string(1) | Y – enable scheduled payments N – by default, disable scheduled payments |
Y/N
|
subscription_callback_url |
string(2048) | Merchant site URL, where host-to-host callback will be sent after scheduled payment completion |
Parameter | Type | Description | Response sample |
---|---|---|---|
order_id |
string(1024) | Order ID which is generated by merchant. | |
merchant_id |
integer(12) | Merchant unique ID. Generated by hutko during merchant registration. | 1 |
amount |
integer(12) | Order amount in cents without separator | 1020 (EUR) means 10 euros and 20 cents |
currency |
string(3) | Order currency. Supported values: EUR — Euro USD — US Dollar GBP — Pound sterling mandatory CZK — Czech Republic Koruna UAH — Ukrainian Hryvnia</p/> |
|
order_status |
string(50) | Order processing status. Can contain the following values: created — order has been created, but the customer has not entered payment details yet; merchant must continue to request the status of the order processing — order is still in processing by payment gateway; merchant must continue to request the status of the order declined — order is declined by hutko payment gateway or by a bank or by an external payment system approved — order completed successfully, funds are held on the payer’s account and soon will be credited of the merchant; merchant can provide the service or ship goods expired — order lifetime expired. reversed — previously approved transaction was fully reversed. In this case, parameter reversal_amount will be equal to actual_amount |
|
response_status |
string(50) | Request processing status. If parameters sent by merchant did not pass validation then failure , else success |
|
signature |
string(40) | Order signature. Required to verify merchant request consistency and authenticity. Signature generation algorithm please see at Signature generation for request and response |
1773cf135bd89656131134b98637894dad42f808
|
tran_type |
string(50) | Supported values: purchase verification p2p credit p2p transfer settlement — split payments reverse |
|
sender_cell_phone |
string(16) | Customer mobile phone number | |
sender_account |
string(50) | Customer payment account | |
masked_card |
string(19) | Masked card number | 444444XXXXXX5555 |
card_bin |
integer(6) | Card bin — usually first 6 digits | 444444 |
card_type |
string(50) | Supported values: VISA, MasterCard |
|
rrn |
string(50) | Commonly not unique transaction ID returned by bank. | |
approval_code |
string(6) | Commonly not unique authorization code returned by bank. | |
response_code |
integer(4) | Order decline response code. Possible codes see in Response codes | |
response_description |
string(1024) | Order response code description, see Response codes | |
reversal_amount |
integer(12) | The total amount of all reversals for current order | |
settlement_amount |
integer(12) | The settlement amount for current order | |
settlement_currency |
string(3) | The currency of order settlement | |
order_time |
string(19) | Order creation date DD.MM.YYYY hh:mm:ss | 21.12.2014 11:21:30 |
settlement_date |
string(10) | Settlement date in format DD.MM.YYYY | 21.12.2014 |
eci |
integer(2) | Ecommerce Indicator – parameter specifies whether 3DSecure authentication was performed or not. Supported values: 5 — full 3DSecure authentication performed 6 — merchant supports 3DSecure, but issuing bank does not 7 — neither merchant nor issuing bank supports 3DSecure |
|
fee |
integer(12) | Fee charged by hutko | |
payment_system |
string(50) | Payment system which was used for payment. Supported payment systems list see Supported payment systems | card |
sender_email |
string(254) | Customer email | |
payment_id |
integer(19) | Unique payment ID generated by hutko payment gateway | |
actual_amount |
integer(12) | The actual amount held or charged from card. | |
actual_currency |
string(3) | The actual currency authorized from card | |
product_id |
string(1024) | Merchant product or service ID | |
merchant_data |
string(2048) | Any arbitrary set of data that a merchant sends in a request | |
verification_status |
string(50) | Code verification result Supported values: verified — card successfully verified with code incorrect — incorrect code entered but limit not exceeded yet failed — allowed number of invalid attempts to enter code exceeded created — verification code created but not entered yet |
|
rectoken |
string(40) | Flag which indicates whether hutko must return card token — token to access card funds without cardholder interaction |
da39a3ee5e6b4b0d3255bfef95601890afd80709
|
rectoken_lifetime |
string(19) | Token lifetime in format DD.MM.YYYY hh:mm:ss |
01.01.2018 00:00:00
|
additional_info |
string(20480) | Additional field in JSON format |
{ |
Parameter | Type | Description | Sample |
---|---|---|---|
response_status |
string(50) | always returns failure |
failure |
error_code |
integer(4) | Response decline code. Supported values see Response codes | |
error_message |
string(1024) | Response code description. See Response codes |
Signature is generated by SHA1 function which is applied to the string which contains merchant password and all parameters concatenated in alphabetic order and separated by |
symbol
Merchant request:
{ "request":{ "order_id":"test123456", "order_desc":"test order", "currency":"USD", "amount":"125", "signature":"df38818facfbfd79953fa847667dac73a1291127", "merchant_id":"1700002" } }
string used for signature build:
test|125|USD|1700002|test order|test123456
If parameter is absent or is empty then there is no need to add | symbol.
function getSignature( $merchant_id , $password , $params = array() ){ $params['merchant_id'] = $merchant_id; $params = array_filter($params,'strlen'); ksort($params); $params = array_values($params); array_unshift( $params , $password ); $params = join('|',$params); return(sha1($params)); }
namespace Ipsp; /** * Class Signature * @package Ipsp */ class Signature { /** * @var */ private static $password; /** * @var */ private static $merchant; /** * Set merchant password * @param String $password * @return mixed */ public static function password($password){ self::$password = $password; } /** * Set merchant id * @param String $merchant * @return mixed */ public static function merchant( $merchant ){ self::$merchant = $merchant; } /** * Generate request params signature * @param array $params * @return string */ public static function generate(Array $params){ $params['merchant_id'] = self::$merchant; $params = array_filter($params,'strlen'); ksort($params); $params = array_values($params); array_unshift( $params , self::$password ); $params = join('|',$params); return(sha1($params)); } /** * Sign params with signature * @param array $params * @return array */ public static function sign(Array $params){ if(array_key_exists('signature',$params)) return $params; $params['signature'] = self::generate($params); return $params; } /** * Clean array params * @param array $data * @return array */ public static function clean(Array $data){ if( array_key_exists('response_signature_string',$data) ) unset( $data['response_signature_string'] ); unset( $data['signature'] ); return $data; } /** * Check response params signature * @param array $response * @return bool */ public static function check(Array $response){ if(!array_key_exists('signature',$response)) return FALSE; $signature = $response['signature']; $response = self::clean($response); return $signature == self::generate($response); } }
require_once 'Signature.php'; # import Signature class from namespace use Ipsp\Signature; # setup merchant id and password Signature::merchant(1700002); Signature::password('test'); if(Signature::check($response)){ echo 'signature is valid. Now we can complete purchase'; } else{ echo 'bad signature throw error' }
There are two typical situations when the signature parameter verification error occurs.
Consider both cases:
function getSignature( $merchant_id , $password , $params = array() ){ $params['merchant_id'] = $merchant_id; $params = array_filter($params,'strlen'); ksort($params); $params = array_values($params); array_unshift( $params , $password ); $params = join('|',$params); return(sha1($params)); }
Response example from hutko (JSON):
{ "rrn": "429417347068", "masked_card": "444455XXXXXX6666", "sender_cell_phone": "", "response_signature_string": "**********|3324000|EUR|3324000|027440|444455|VISA|EUR|444455XXXXXX6666|1700002| 14#1500639628|approved|21.07.2017 15:20:27|51247263|card|success|0|429417347068|test@example.com|0|purchase", "response_status": "success", "sender_account": "", "fee": "", "rectoken_lifetime": "", "reversal_amount": "0", "settlement_amount": "0", "actual_amount": "3324000", "order_status": "approved", "response_description": "", "verification_status": "", "order_time": "21.07.2017 15:20:27", "actual_currency": "EUR", "order_id": "14#1500639628", "parent_order_id": "", "merchant_data": "", "tran_type": "purchase", "eci": "", "settlement_date": "", "payment_system": "card", "rectoken": "", "approval_code": "027440", "merchant_id": 1700002, "settlement_currency": "", "payment_id": 51247263, "product_id": "", "currency": "EUR", "card_bin": 444455, "response_code": "", "card_type": "VISA", "amount": "3324000", "sender_email": "test@example.com", "signature": "47bdcaf61b99edd31e3ec7913225a14d2ce07575" }
To diagnose the cause of a signature mismatch, follow these steps:
parameter
function getSignature( $merchant_id , $password , $params = array() ){ $params['merchant_id'] = $merchant_id; $params = array_filter($params,'strlen'); ksort($params); $params = array_values($params); array_unshift( $params , $password ); $params = join('|',$params); return(sha1($params)); }
Request to hutko payment gateway can be sent in several methods
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <form name="tocheckout"method="POST"action="https://pay.hutko.org/api/checkout/redirect/"> <input type="text"name="server_callback_url"value="https://site.com/callback/"> <input type="text"name="response_url"value="https://site.com/responsepage/"> <input type="text"name="order_id"value="test4207135583"> <input type="text"name="order_desc"value="Test payment"> <input type="text"name="currency"value="UAH"> <input type="text"name="amount"value="100"> <input type="text"name="signature"value="1773cf135bd89656131134b98637894dad42f808"> <input type="text"name="merchant_id"value="1"> <input type="submit"> </form> </body> </html>
Interaction scheme B API supports following text transfer protocols: URL encoded, JSON. Best cases to use this method are:
Request
curl -i -X POST \ -H "Content-Type:application/json" \ -d \ '{ "request": { "server_callback_url": "http://myshop/callback/", "order_id": "TestOrder2", "currency": "UAH", "merchant_id": 1700002, "order_desc": "Test payment", "amount": 1000, "signature": "91ea7da493a8367410fe3d7f877fb5e0ed666490" } }' \ 'https://pay.hutko.org/api/checkout/url'
Normal response
{ "response":{ "response_status":"success", "checkout_url":"https://pay.hutko.org/checkout?token=afcb21aef707b1fea2565b66bac7dc41d7833390" } }
Response in case of error
{ "response":{ "response_status":"failure", "error_message":"Parameter `amount` is mandatory", "error_code":"1008" } }
Example host-to-host for interaction scheme B (URL encoded form)
curl -i -X POST \ -H "Content-Type:application/x-www-form-urlencoded" \ -d 'response_url=http://myshop/callback/&order_id=TestOrderURLEncode211&order_desc=Test payment¤cy=USD&amount=100&signature=b7acb85c7f02882049c9e19813025f27cb09ad63&merchant_id=1700002' \ 'https://pay.hutko.org/api/checkout/url'
Normal response
response_status=success&checkout_url=http%3A%2F%2Flocalhost%2Fcheckout%3Ftoken%3D643f3cea682e066f142099a76b0fa9d1613969dc
Response in case of error
response_status=failure&error_message=Parameter%20%60amount%60%20is%20mandatory&error_code=1008
curl -i -X POST \ -H "Content-Type:application/json" \ -d \ '{ "request": { "server_callback_url": "http://myshop/callback/", "order_id": "TestOrder2", "currency": "UAH", "merchant_id": 1700002, "order_desc": "Test payment", "amount": 1000, "signature": "91ea7da493a8367410fe3d7f877fb5e0ed666490" } }' \ 'https://pay.hutko.org/api/checkout/token'
Normal response:
{ "response":{ "response_status":"success", "token":"afcb21aef707b1fea2565b66bac7dc41d7833390" } }
Response in case of error
{ "response":{ "response_status":"failure", "error_message":"Parameter `amount` is mandatory", "error_code":"1008" } }
This token is used in JavaScript SDK which allows to embed credit card form in your site and make a customized checkout page.
Response is always returned in request context in the same content-type. So if request is sent in JSON, response will be sent in JSON format too. Response for such request will be interim and will contain URL where customer must be redirected to payment page.
Sending request in interaction scheme A does not assume getting response in request context. The final response will be returned to merchant URL, specified in response_url
and server_callback_url
parameters.