2014 Content 1. Introduction...............................................................................................................................................4 1.1. What is SCI? ........................................................................................................................................4 1.2. Description of the present document ................................................................................................4 1.3. Consumer audience............................................................................................................................4 1.4. Terminology ........................................................................................................................................4 1.5. Abbreviations .....................................................................................................................................5 2. Description ................................................................................................................................................5 2.1. Main information ...............................................................................................................................5 2.2. Signing up ...........................................................................................................................................5 2.3. Interaction ..........................................................................................................................................5 2.4. Sceme of work ....................................................................................................................................6 2.5. Example of payment process .............................................................................................................8 3. Protocol .....................................................................................................................................................9 3.1. Checkout settings ...............................................................................................................................9 3.2. Form of payment request.................................................................................................................11 3.3. Client result page..............................................................................................................................14 3.4. Notification of payment ...................................................................................................................15 3.4.1. Checking information of payment .............................................................................................16 3.5. Digital signature forming ..................................................................................................................17 4. Advanced features ...................................................................................................................................17 4.1. Hidden SCI mode ..............................................................................................................................17 4.1.1. Description ................................................................................................................................17 4.1.2. Receiving of available for checkout list of payways...................................................................17 4.1.3. Data receiving on the cost of payment on the payment gateway.............................................18 4.1.4. Receiving data on payment form of payment gateway .............................................................19 5. Testing .....................................................................................................................................................20 5.1. Creation of payment request form...................................................................................................20 5.2. Payment process and carrying out of payment................................................................................20 6. Reference book........................................................................................................................................21 6.1. Currency codes .................................................................................................................................21 6.2. Error codes .......................................................................................................................................21 6.3. Payway codes ...................................................................................................................................22 7. Notes .......................................................................................................................................................24 www.interkassa.com Страница 2 8. Links .........................................................................................................................................................24 9. Lisy of changes.........................................................................................................................................25 www.interkassa.com Страница 3 1. Introduction 1.1. What is SCI? SCI (Shop Cart Interface) – the program interface, which allows every merchant automatically receive payments online. Demonstration - https://sci.interkassa.com/demo/. 1.2. Description of present document In the given document presented exhaustive information of interaction protocol with SCI payment gateway. Also, you`ll find typical decisions, examples of realization and all necessary information for integration of your site with the gateway. 1.3. Consumer audience Present document is intended for technical specialists, web-masters and developers, working for the company that is willing to receive and process data of payments in the Internet. For using given protocol it is necessary to have base knowledge of web-developer. Protocol is presenting different by complication typical sign-up decisions. 1.4. Terminology SCI (Shop Cart Interface) – program interface, which allows every merchant automatically receive payments online. Merchant – account owner, who receives on its account payments via SCI, as the rule, goods or services that are presented on his or her web-shop. Client – purchaser, who buy goods or services from merchant. The buyer is redirected onto SCI for making payment. Checkout – point of receiving payments on merchant site. www.interkassa.com Страница 4 1.5. Abbreviations IK — Interkassa SCI — ShopCartInterface CO — Checkout - point of receiving payments on merchant site. XSS — СrossSiteSсriрting EDS — Electronic digital signature URL — Uniform Resource Locator WWW — World Wide Web 2. Description 2.1. Main information SCI – program interface for receiving payments via Internet. The main point of payment acceptance gateway reduces to single entry point of client paying and returning back onto the site after paying. It allows, independently of payway, uniformly interact with client and process payments. As any program interface, it has its own interaction protocol, its functionality, number of demands and restrictions. Depending on the degree of integration, protocol allows very flexible realization of various schemes of interaction between you and your client. 2.2. Connection All you need for accepting payments online is to: 1. 2. 3. 4. Register in Interkassa system. Create new (or use current) business-account. Create new checkout and adjust it (setting parameters are given below). Redirect client for payment with HTML-form of payment inquiry. 2.3. Interaction From the point of integration view, SCI is the web-page (https://sci.interkassa.com/) that receives HTTP request with GET or POST parameters, and depending on the type of action (ik_act) and interface (ik_int: web / json) answers with corresponding result. Inasmuch as the service gives opportunity of flexible integration, beneath we offer typical solutions for various tasks and complexity of fulfillment. Depending on the type of your business, SCI can be used by different ways: If you haven`t own site and sell in small amount goods or services and orders are processed by hands, it’s enough to redirect client for paying with HTML-form that can be placed as in e-mail, so on your site. After payment realization it will be available in your personal cabinet. Also, you can receive e-mail or SMS notification after payment enrollment. If you provide goods or services having your own billing and you are willing automatically process received payments, you need to realize logic of processing notification from SCI about completed payment. It will be transmitted automatically after funds crediting onto your site, www.interkassa.com Страница 5 independently of payment, which can be Visa, MasterCard or Wire transfer, terminals of self care etc. If you want to realize choosing of payway and redirecting of client directly on the payment gateway bypassing SCI web-interface, this can be done due to protocol support of JSON interface, which allows your site to receive all necessary data for processing in hidden mode for client. 2.4. Scheme of work Checkout Page — page, on which HTML-form of payment request is displayed (SCI Form). www.interkassa.com Страница 6 Paysystems List — page with available for present checkout payment systems, with assist of which client can done the payment. Example: Payway List — page of payway choosing. Example: Create Invoice — script of creating invoice and redirecting client on the payment gateway (Pay Form). Payment Gateway — payment gateway with assist of which client makes payment. Payment Processing — script for carrying out a payment on the payment gateway. When carrying out the payment, SCI server (Interaction page) informs of the result of processing. In its turn, SCI notifies www.interkassa.com Страница 7 Interaction Page on the merchant server with the information about the invoice and payment processing (Interaction Form). Payment Result Page — result page of payment processing from that client redirects on the SCI. Result Page — SCI page, on that client is redirected after payment, waiting for SCI result notification of the payment processing by payment gateway, dependently on that accordingly on the Success Page if success payment processing, Fail Page if unsuccessful payment or incomplete payment process onto Pending Page. Example: 2.5. Example of payment process Let’s look at the typical process of payment on the example of internet-shop. Assume that, internet-shop offers to client an opportunity of purchase ticket to cinema. Payment of the order need to be processed automatically and the ticket is provided to client immediately after payment. 1. Client chooses already liked showing and seats. Forms an invoice. Identification number and sum of payment are given for the created order. 2. Client jumps on the page of payment (Checkout page) on the merchant site and he or she is shown the button for redirection on the SCI payment gateway. The button is linked with the HTML-form (SCI Form) and indicates the SCI web-interface – https://sci.interkassa.com/ . This HTML-form includes number of hidden parameters for SCI (view Protocol); also it includes data of the payment (sum, order ID and others). 3. When pressing the button client is redirected onto the SCI web-interface with available payment systems (Paysystems List) with that payment can be done. 4. On the page of paysystems choosing (Paysystems List) client is shown data of payment, sum and description. 5. While choosing one of the paysystems client is shown all the methods of payment through it (Payway List). Also, client is suggested with the terms of payment and mentioning of his or her contacts. www.interkassa.com Страница 8 6. When pressing the button “Buy” new invoice is created in Interkassa system (Create Invoice) that is fixed by the checkout and client is redirected (Pay Form) onto the payment gateway (Payment Gateway). 7. On the Payment Gateway client makes the payment. 8. While processing the payment (Payment Processing) SCI receives notification about the result of payment processing and retranslates it in unified format (Interaction Form) on the site of merchant (Interaction Page). 9. Payment gateway redirects the client onto the page of result (Result Page) after the payment. On this page, SCI based on the available data, determines the status of the payment and dependently on it redirects the client on the suitable page of the merchant site (Success Page, Fail Page, Pending Page). 3. Protocol 3.1. Checkout settings SCI settings begin with checkout settings. They allow set the values by default, logic of gateway work and web-interface, security settings, available payways and others. The full list of checkout properties is shown below: Property Name Note Name Name It is displayed on the SCI. Url URL It is displayed on the SCI. Desc Description It is displayed on the SCI. Fee Rate Commission of Interkassa SCI is used when payment amount calculating. See tariffs. FeeShift Shifting the fee onto buyer SCI is used when payment amount calculating. Shows in percentage the part of fee that was laid onto seller. For example: if set 30% of fee on the seller, than 70% on the buyer. On the basis that, Interkassa fee is 3% and, For example, payment sum is 100 c.u., than payment amount in the payment system makes up to 102.1 c.u. and taken funds for crediting to checkout account are 99.1 c.u. PaymentNoUniqu e Checking of the unique payments number SCI is used. Such option allows carrying out the checking before creating new payment on its unique by the number. In case, if the same number of the payment was found in Interkassa billing than corresponding error message is issued. When checking SCI parameter is used "Ошибка! Источник ссылки не найден. source not found". Disabled by default. Payment Amount Edit Payment amount edit If turned on, than allows client by himself to specify the amount of payment on SCI. Disabled by default. PaymentAmountE ditOverride Opportunity to override the feature of payment amount edit Specify the opportunity for overriding the feature of “Payment amount edit” by the parameter "ik_am_ed" on SCI. Disabled by default. MAIN www.interkassa.com Страница 9 Payment Lifetime Lifetime of payment Specify in seconds expiry time of the payment after its creation. Does not used if the option of payment lifetime is set by the parameter "ik_exp" on SCI. By default it is "2592000". PaymentLifetime Override Opportunity to override the payment lifetime Specify the opportunity for overriding the “Payment lifetime” by the parameter "ik_ltm" on SCI. Disabled by default. ShowLogo Logo displaying Specify the opportunity for displaying checkout logo onto SCI web-interface. Disabled by default. SignAlgorithm Algorithm of digital signature forming SCI is used when digital signature forming. Available algorithms: md5, sha256, rsa. It is "md5” by default. SignKey Key of digital signature SCI is used when digital signature forming. SignTestKey Key of digital signature for testing SCI is used when digital signature forming, if the payment SECURITY was done via test payment system. See testing. SignCoRequired If digital signature from the checkout is required SCI is used when checking the incoming parameters from the checkout, if the option is activated. Disabled by default. See digital signature forming. INTERACTION Success Url URL page of success payment SuccessUrlOverrid Opportunity to override URL page of success payment e Is used when redirecting client from SCI back to checkout page, if payment was done successfully. Specify the opportunity for overriding the feature “URL page of success payment” by the parameter “ik_suc_u” on SCI. Enabled by default. SuccessMethod Method of page requirement of success payment Is used when redirecting client from SCI back to checkout page, if payment was done successfully. It is POST by default. Success Method Override Opportunity to override method of page requirement of success payment Specify the opportunity for overriding the feature “Method Fail Url URL page of fail payment Is used when redirecting client from SCI back to checkout page, if payment was failed. Fail Url Override Opportunity to override URL page of fail payment Specify the opportunity for overriding the feature "Method of page requirement of success payment” by the parameter "ik_suc_m" on SCI. Enabled by default. of page requirement of fail payment" by the parameter "ik_fal_u" on SCI. Enabled by default. Fail Method Method of page requirement of fail payment Is used when redirecting client from SCI back to checkout page, if payment was failed. It is POST by default. Fail MethodOverride Opportunity to override method of page request of fail payment Specify the opportunity for overriding the feature "Method of page request of fail payment" by the parameter "ik_fal_m" on SCI. Enabled by default. Pending Url Pending URL page of payment processing Is used when redirecting client from SCI back to checkout page, if payment is in process. www.interkassa.com Страница 10 Pending Url Override Opportunity to override pending URL page of processing payment Specify the opportunity for overriding the feature "Pending URL page of payment processing" by the parameter "ik_pnd_u" on SCI. Enabled by default. Pending Method Method of pending page request of payment processing Is used when redirecting client from SCI back to checkout page, if payment is in process. It is POST by default. Pending Method Override Opportunity to override method of method of pending page request of payment processing Specify the opportunity for overriding the feature "Method Interaction Url Interaction URL page SCI is used when sending notification about the status of payment on the site of checkout. See notification of payment status. Interaction Url Override Opportunity to override Interaction URL page Specify the opportunity for overriding the feature "Interaction URL page" by the parameter "ik_ia_u" on SCI. Disabled by default. Interaction Method Method of interaction page request SCI is used when sending notification about the status of payment on the site of checkout. It is POST by default. Interaction Method Override Opportunity to override method of interaction page request Specify the opportunity for overriding the feature "Method of interaction page request" by the parameter "ik_ia_m" on SCI. Disabled by default. Interaction Confirm Http Code Http-code of confirmation about successful receiving of the payment notification SCI is used when sending notification about the status of payment on the site of checkout. If while sending notification, answer of HTTP-code from server of the checkout won`t be the same as the specified value, then such notification wouldn`t be consider as delivered and will be resent again. It is "200" (OK) by default. Interaction Confirm Text Confirmation text of successful receiving of notification about the status of payment SCI is used when sending notification about the status of payment on the site of checkout. If while sending notification, in the body of answer from the server of checkout will be mention text, then such notification wouldn`t be consider as delivered and will be resent again. Disabled by default. of pending page request of payment processing” by the parameter "ik_pnd_m" на SCI. Enabled by default. 3.2. Form of payment request Present HTML-form (SCIForm) is key issue in the SCI protocol. With its assist, you can redirect client to the payment form from every point of your web-application. You send all necessary values in it, such as checkout identifier, amount and currency of payment, also are sent links of your site on that a client will be redirected after success or fail payment, for example: <form name="payment" <input type="hidden" <input type="hidden" <input type="hidden" <input type="hidden" <input type="submit" </form> method="post" action="https://sci.interkassa.com/"accept-charset="UTF-8"> name="ik_co_id" value="51237daa8f2a2d8413000000" /> name="ik_pm_no" value="ID_4233" /> name="ik_am" value="1.44" /> name="ik_desc" value="Payment Description" /> value="Pay"> www.interkassa.com Страница 11 Also, payment form can consist of additional values, which influence onto the available payways, expiry time of the order, language of merchant interface etc. Full list of the values of payment form are given below: Key Name Format Example Description ik_co_id* CheckoutID /^[\w\-]{1,36}$/D 4f269503a1da9 2c807000002 Checkout identifier. Obligatory parameter. See checkout settings. ik_pm_no Payment No. /^[\w\-]{1,32}$/D 14533; ID_4233 Payment number. Is saved in Interkassa billing. Allows identify payment in the system, also to connect orders in your billing. If the given option set, then unique is checking. Optional parameter. ik_cur Currency /^.{3}$/ USD; EUR; UAH Payment currency. Obligatory parameter, if checkout has more than one currency. See checkout settings. ik_am * Amount /^[\d]{1,15}([\.,][\d] {1,4})?$/ 1.43; 43 Payment amount. Obligatory parameter. ik_am_ed Amount Edit /0|1/ 0; 1 Editing of the amount of the payment. If turned on, allows client to put in payment amount individually. Optional parameter. It is used feature of checkout “Payment amount edit” by default. ik_am_t Amount Type /invoice|payway/ invoice; payway ik_desc Description /^.{0,255}$/ Payment Description; Cool stuff Payment description. Optional parameter. ik_exp Expired /^.{0,30}$/ 2011-05-01; 2011-10-01 20:50:33 Expiry period of payment. Doesn`t allow client to pay for the mentioned order after expired period. If the payment was done after it, then funds are credited onto his personal account in Interkassa system. Parameter is used if the payment connected with order and loses its unique quickly after expiry period. For example: online booking. Optional parameter. ik_ltm Lifetime /^[\d]{1,10}$/ 3600; 86400 Payment lifetime. Specify in seconds period of payment life after its creation. It doesn`t use if payment expiry period is set (ik_exp). Optional parameter. Checkout feature “Payment lifetime” is used by default. ik_pw_on Payway On /^[\w;,\.]{0,512}$/ webmoney; w1_merchant_ usd Turned on payways. Allows specify available payways for client. Optional parameter. ik_pw_off Payway Off /^[\w;,\.]{0,512}$/ webmoney_me rchant Turned off payways. Allows specify disabled payways for client. Optional parameter. ik_pw_via Payway Via /^[\w]{0,62}$/ visa_liqpay_mer Elected payway. Allows specify exact payway for client. Parameter works only with acting value (ik_act) that is set Payment Amount type of payment. Allows specify the strategy of calculating the amount payment of checkout and paysystem. Dependently on it, calculates those or that amount. If “invoice” amount type is mentioned than amount payment is calculated from the checkout amount type. If specified "payway" amount type – than conversely. It is "invoice" by default. Payway www.interkassa.com Страница 12 chant_usd in "process" or "payway". See action (ik_act).Optional parameter. System ik_sign Signature /^.{0,128}$/ oVAOevI3mWrc vrjB4j/ySg== Digital signature. See digital signature forming. Obligatory parameter, if in the checkout settings value “If digital signature from the checkout is required” is set. (Sign Co Required). ik_loc Locale /^.{5}$/' ru; de_us Locale. Allows evidently specify language and region set for the client. Form by the template: [language [_territory]. Defines automatically by default. ik_enc Encoding /^.{0,16}$/ utf-8; ISO-88591; cp1251 Encoding. It is used UTF-8 encoding by default. ik_usr User /^.{0,64}$/ usermail@gmail .com; +380501234567 User contact information. Assume the value as email or phone number. Optional parameter. ik_ia_u Interaction Url URL http://www.site .com/interactio n.script URL interaction page. Optional parameter. ik_ia_m Interaction Method /get|post/i POST, GET Method of interaction page request. Optional parameter. ik_suc_u Success Url URL http://www.site .com/success.sc ript URL page of success payment. Optional parameter. ik_suc_m Success Method /get|post/i POST, GET Method of success payment page request. Optional parameter. ik_pnd_u Pending Url URL http://www.site .com/pending.s cript URL pending page request of payment processing. Optional parameter. ik_pnd_m Pending Method /get|post/i POST, GET Method of pending page request of payment processing. Optional parameter. ik_fal_u Fail Url URL http://www.site .com/fail.script URL page of fail payment. Optional parameter. ik_fal_m Fail Method /get|post/i POST, GET Method of fail page request. Optional parameter. Action /process|payways| payways_calc|payw ay/ process; payways Action. Allows overriding initial status of payment process. Optional parameter. Interaction Protocol ik_act process — handle process; payways — payment method; payways_calc — calculation of payment ways; payway — payment direction. www.interkassa.com Страница 13 ik_int Interface ik_x_[nam e] X Prefix /web|json/ web; json Interface. Allows specify format of interface of SCI as "web" or "json". It is "web" by default. ik_x_field1 = somedata; ik_x_baggage1 = code123; Prefix of additional fields. Allows transmitting of additional fields on SCI, after which these parameters are included in notification about success payment onto the interaction page. For creation you can use our generator of payment form. 3.3. Client result page Payment gateway redirects client on the result page after payment (Result Page). On this page SCI tries to determine on the basis of available data the status of the payment and dependently on this redirect client on the proper result page of seller (Success Page, Fail Page, Pending Page) accordingly. Also, in the return form of client on the checkout (Return Form), SCI can send additional parameters depending on the checkout setting and parameters of the payment. Full list of the return form parameters are given below: Key Name Example Description ik_co_id CheckoutID 4f269503a1da92c807000002 Checkout identifier. See checkout settings. ik_pm_no Payment No. 14533; ID_4233 Payment number. Saved in Interkassa billing. Allows identify payment in the system and connect it with the order in your billing. Unique is checking if in the checkout settings such option is set. ik_cur Currency USD; EUR; UAH Payment currency. ik_am Amount 1.43; 43 Payment amount. ik_desc Description Payment Description; Cool stuff Payment description. ik_pw_via Payway Via visa_liqpay_merchant_usd Chosen payway. ik_x_[name] X Prefix ik_x_field1 = somedata; ik_x_baggage1 = code123; Prefix of additional fields. ik_inv_crt Invoice Created 2013-03-17 17:30:33 Time of payment creation. ik_inv_prc Invoice Processed 2013-03-20 15:46:58 Time of payment invoice processing. ik_inv_st Invoice State success; fail Payment invoice status. Possible values: Main Additional new — new, waitAccept —wait for payment, process — is in process, success —success payment, canceled— cancelled payment, fail—fail payment. ik_ps_price Paysystem Price 25.32 Amount of payment in paysystem. ik_co_rfn CheckoutRefund 24.94 Amount for refund on the checkout balance. www.interkassa.com Страница 14 Attention! Inasmuch as the clients return form (Return Form) is redirected via unsecured channel therefore it can`t be used for crediting of payment by your web-application. You need to use interaction form of payment for this (InteractionForm). 3.4. Notification of payment While carrying out the payment, SCI creates request with the data over it on the interaction page (InteractionURL). This request consists of all necessary data for the completing payment process of the order on your site. The given form is intended for tight integration of your site with SCI. It allows automate the process that is initialized by receiving such notification about success payment, for refunding the payment and order processed in the billing on your site. Full list of result page form is given below: Key Name Example Description ik_co_id CheckoutID 4f269503a1da92c807000002 Checkout identifier. Obligatory parameter. See checkout settings. ik_pm_no Payment No. 14533; ID_4233 Payment number. Saved in Interkassa billing. Allows identify payment in the system and connect it with the order in your billing. Unique is checking if in the checkout settings such option is set Optional parameter. ik_desc Description Payment Description; Cool stuff Payment description. Optional parameter. ik_pw_via Payway Via visa_liqpay_merchant_usd Chosen payway. Allows specify exact payway for client. Parameter works only with acting value (ik_act) that is set in "process" or "payway". See action (ik_act).Optional parameter. ik_am Amount 1.43; 43 Payment amount. Obligatory parameter. ik_cur Currency USD; EUR; UAH Payment currency. Obligatory parameter, if checkout has more than one currency. See checkout settings. ik_x_[name] X Prefix ik_x_field1 = somedata; ik_x_baggage1 = code123; Prefix of additional fields. Allows transmitting of additional fields on SCI, after which these parameters are included in notification about success payment onto the interaction page. ik_inv_id Invoice Id 12345; 5632156 Invoice identifier. ik_co_prs_id Checkout Purse Id 307447812424 Checkout purse identifier. Main Additional www.interkassa.com Страница 15 ik_trn_id Transaction Id 14533; ID_4233 Transaction identifier. ik_inv_crt Invoice Created 2013-03-17 17:35:33 Time of invoice creation. ik_inv_prc Invoice Processed 2013-03-17 17:36:13 Processing time. ik_inv_st Invoice State success; fail Payment status. ik_ps_price Paysystem Price 25.00 Payment amount in paysystem. ik_co_rfn CheckoutRe fund 24.94 Amount for refund onto checkout. ik_sign Signature oVAOevI3mWrcvrjB4j/ySg== Digital signature. See digital signature forming. Attention! This notification is send on the checkout server via interaction link (InteractionURL) up until SCI receives by present request status of HTTP-code from the checkout server, which is specified in checkout settings (it is "200 OK" by default). Also, see checkout settings “Confirmation text of successful receiving of notification about the status of payment”. 3.4.1. Checking payment information To avoid the possibility of compromised notification of payment on the interaction page you need to realize its checking, which is given below. Besides that it is recommended to conduct additional data reconciliation of payment notification by API. Verification of data source In given checking, you need to certify that payment notification was sent directly by Interkassa and isn`t compromised. For this, it is needed to check IP address of sender`s server (SCI). The address range that is used by SCI you can view on the page “Interkassa IP addresses”. To authenticate the source of sender and integrity of data digital signature is used (See digital signature forming). Data checking Despite the fact that notification is formed on the SCI side, ALLWAYS check such information of payment notification as: Checkout identifier (parameter "ik_co_id"). Should correspond to your checkout identifier. Invoice amount (parameter "ik_am"). Should correspond to amount of your order for which it was billed. Invoice status (parameter "ik_inv_st"). Should correspond to value "success". Digital signature (parameter "ik_sign"). See digital signature forming. www.interkassa.com Страница 16 3.5. Digital signature forming Digital signature forms by combining of the values of all form parameters with “ik_” prefix in alphabetical order of their names (case insensitive), with adding in the end “secret key” of the checkout. Concatenation goes through ":" symbol. If form consists of some fields with the same names, such fields are sorted in alphabetical order of their values. Obtained field after combining of parameters and “secret key” value is hashed by selected method of EDS forming and its bytes is in Base64 encoding. ik_sign = Base64(MD5(Implode(Sort(Params) + SecretKey, ':')))); Attention! Make sure that your hash function returns an array of bytes, not HEX representation. If everything was done properly, than length of the ik_sign parameter consist of exact 24 symbols in MD5 hash-function. Attention! If payment direction with which bill was paid is Test (ik_pw_via = ‘test_interkassa_test_xts’ ONLY FOR INTERACTION URL), than while digital signature forming “Test secret key” is used. This is spread as to payment form forming, such as to payment notification. See Testing. Example of EDS forming algorithm in PHP language: ksort($dataSet, SORT_STRING); // sort by the keys in alphabetical order array elements array_push($dataSet, $key); // add in the end of array “secret key” $signString = implode(':', $dataSet); // concatenate value through the ":" symbol $sign = base64_encode(md5($signString, true)); // take MD5 hash in a binary form by the formed line and encode in BASE64 return $sign; // return the result Other examples of implementation in different programming languages are available on the web-site in the chapter “Developers”. 4. Advanced features 4.1. Hidden SCI mode 4.1.1. Описание Given mode is intended to receive payments via Interkassa with redirecting client when paying directly onto payment system gateway. This allows your server, in the background for a client, receive data in HTML-form which destined for payment through mentioned payment gateway. All that is required for this is to use JSON interface with SCI that can be indicated by payment request form —"ik_int" with "json" value. 4.1.2. Receiving of available for checkout list of payways For receiving payment form for payment through payment system gateway, you need to specify such values as: type of action "ik_act" — "payways”. And generate HTTP-request with payment form request of payment onto SCI by POST or GET method, and receive in answer JSON-data packet of available for payment of payways. Example of request: www.interkassa.com Страница 17 <form name="payment" <input type="hidden" <input type="hidden" <input type="hidden" <input type="hidden" <input type="hidden" <input type="hidden" <input type="submit" </form> method="post" action="https://sci.interkassa.com/"accept-charset="UTF-8"> name="ik_co_id" value="51237daa8f2a2d8413000000" /> name="ik_pm_no" value="ID_4233" /> name="ik_am" value="1.44" /> name="ik_desc" value="Payment Description" /> name="ik_act" value="payways" /> name="ik_int" value="json" /> value="Pay"> Example of answer: { "resultCode": 0, "resultMsg": "Success", "resultData": { "paywaySet": [ { "_id": "4f217ec98f2a2d4c0c0002d4", "als": "privatterm_liqpay_merchant_uah", "cur": "4e4147718f2a2d7014000467", "curAls": "uah", "in": "4e4147718f2a2d701400046e", "inAls": "merchant", "insInId": "4f674bd0e313d0f810000154", "ps": "liqpay", "ser": "privatterm", "srt": "25" }, { "_id": "4f217ec98f2a2d4c0c0002d6", "als": "anelik_w1_merchant_rub", "cur": "4e4147718f2a2d701400047c", "curAls": "rub", "in": "4e4147718f2a2d7014000484", "inAls": "merchant", "insInId": "4f674bd0e313d0f81000014c", "ps": "w1", "ser": "anelik", "srt": "36" }, ... ] } } 4.1.3. Receiving of data on the cost of payment on the payment gateway For receiving payment form for payment through payment system gateway, you need to specify such values as: type of action "ik_act" — "payway”, payment method "ik_pw_via" — <paywayalias> (any available payment method, See Payway codes). And generate HTTP-request with payment form request of payment onto SCI by POST or GET method, and receive in answer JSON-data packet of available for payment of payways. Example of request: <form name="payment" method="post" action="https://sci.interkassa.com/"accept-charset="UTF-8"> <input type="hidden" name="ik_co_id" value="51237daa8f2a2d8413000000" /> <input type="hidden" name="ik_pm_no" value="ID_4233" /> www.interkassa.com Страница 18 <input type="hidden" <input type="hidden" <input type="hidden" <input type="hidden" <input type="hidden" <input type="submit" </form> name="ik_am" value="1.44" /> name="ik_desc" value="Payment Description" /> name="ik_int" value="json" /> name="ik_act" value="payway" /> name="ik_pw_via" value="webmoney_webmoney_merchant_wmz" /> value="Pay"> Example of answer: { "resultCode":0, "resultMsg":"Success", "resultData": { "invoice": { "checkoutId":"51237daa8f2a2d8413000000", "checkoutPurseId":"307447812424", "paymentNo":"218", "paywayId":"4f217ec98f2a2d4c0c000318", "paywayPurseId":"50d828d159d93cfb72000001", "expired":1385305065, "coAmount":5, "coRefund":4.925, "ikFee":0.15, "ikFeeIn":0.075, "ikFeeOut":0.075, "ikPrice":5.075, "psAmount":0.4323, "psFeeIn":0, "psFeeOut":3, "psPrice":0.44, "psExchRate":0.085166 } } } 4.1.4. Receiving data of payment form of payment gateway For receiving payment form for payment through payment system gateway, you need to specify such values as: type of action "ik_act" — "process”, payment method "ik_pw_via" — <paywayalias> (any available payment method, See Payway codes). And generate HTTP-request with payment form request of payment onto SCI by POST or GET method, and receive in answer JSON-data packet of available for payment of payways. Example of request: <form name="payment" <input type="hidden" <input type="hidden" <input type="hidden" <input type="hidden" <input type="hidden" <input type="hidden" <input type="hidden" <input type="submit" </form> method="post" action="https://sci.interkassa.com/"accept-charset="UTF-8"> name="ik_co_id" value="51237daa8f2a2d8413000000" /> name="ik_pm_no" value="ID_4233" /> name="ik_am" value="1.44" /> name="ik_desc" value="Payment Description" /> name="ik_int" value="json" /> name="ik_act" value="process" /> name="ik_pw_via" value="webmoney_webmoney_merchant_wmz" /> value="Pay"> Example of answer: www.interkassa.com Страница 19 { "resultCode": 0, "resultMsg": "Success", "resultData": { "paymentForm": { "action": "https://merchant.webmoney.ru/lmi/payment.asp" , "method": "post", "parameters": { "LMI_PAYEE_PURSE": "Z922208109129", "LMI_PAYMENT_AMOUNT": "103.10", "LMI_PAYMENT_DESC": "Payment No. IK15002746; Ноутбук Asus Z99LSeries", "LMI_PAYMENT_NO": "15002746" } } } } 5. Testing 5.1. Creation of payment request form For creation of simplified payment form, we offer you to use our payment generator of HTML-form. With its assist, you can quickly create and configure payment request form, specify all necessary parameters and settings and also to test it for redirecting client for payment via SCI. 5.2. Payment process and carrying out of payment There is “Test payment system” for testing and carrying out of payment. It is turned on by default in the new checkout as possible method of making the payment in your checkout. Attention! If your checkout is already set and works out in open public mode, than you need to turn off “Test payment system” in your checkout. For making the test payment, you need only to pick up it for payment and press the button “Pay” or chose other Action for payment. After this, SCI will redirect you onto the proper result page of your site. Attention! When carrying out a payment via “Test payment system” transaction is not held! The status of the billed invoice is changing, amount of the payment is not refunding on your balance. Thus, you can test in full all process, as well as the processing of payment notification in your checkout (InteractionForm). For this you need to use “test secret key”, that is available in checkout settings. Given key is used for payment notification signature of the payment that was done only via “Test payment system”. Attention! Present mechanism, with “test secret key”, prevents a situation when you webapplication can credit the funds of the payment which was done via “test payment system” according to transmitted data on the interaction page (InteractionURL). For this, ALLWAYS check digital signature from SCI. www.interkassa.com Страница 20 6. Reference book 6.1. Currency codes Actual information of the currency code is always available on the Interkassa web-site. ID Name Character code Figures code 10 Euro EUR 978 20 Dollar USD 840 30 Hryvnia UAH 980 40 Russian ruble RUB 643 50 Belorussian ruble BYR 974 60 Gold (one troy pound) XAU 959 99 Test currency XTS 963 6.2. Code errors Code Alias Message 100 E_IS_NOT_WORKING SCI is not working. Try later... 101 E_PROTOCOL_NOT_EXIST Protocol not exist 103 E_REQUEST_IS_EMPTY Request is empty 102 E_INVALID_REQUEST_METHOD Invalid request method 104 E_REQUEST_IS_NOT_SECURE Request is not secure 106 E_PARAM_IS_NOT_SET Parameter "%s" is not set 107 E_PARAM_IS_EMPTY Parameter "%s" is empty 108 E_PARAM_INCORRECT_FORMAT Parameter "%s" has incorrect format 109 E_PARAM_SET_FORBIDDEN Parameter set "%s" forbidden 120 E_CHECKOUT_NOT_FOUND Checkout is not found 121 E_CHECKOUT_UNAVAILABLE Checkout is unavailable 122 E_CHECKOUT_CURRENCY_INVALID Checkout has no purses with requested currency 115 E_REQUEST_SIGN_INVALID Request sign "%s" is invalid 110 E_PAYMENT_NO_NOT_UNIQUE Payment no "%s" must be unique 123 E_CHECKOUT_PURSE_UNAVAILABLE Checkout purse is unavailable www.interkassa.com Страница 21 124 E_CHECKOUT_PAYWAY_UNAVAILABLE Payway is unavailable for current checkout 125 E_CHECKOUT_PAYWAYS_UNAVAILABLE Checkout has not any available payway 6.3. Payway codes Actual information of the payway codes is always available on the Interkassa web-site. Alias Service Gateway Method Currency Alias (IK 1.0) privatterm_liqpay_merchant_uah PrivatBank terminals LiqPay Merchant UAH liqpayterminal u anelik_w1_merchant_rub Anelik Wallet One Merchant RUB w1anelikr beeline_w1_merchant_rub Beeline Wallet One Merchant RUB w1beeliner contact_w1_merchant_rub CONTACT Wallet One Merchant RUB w1contactr lider_w1_merchant_rub Leader Wallet One Merchant RUB w1liderr megafon_w1_merchant_rub Megafon Wallet One Merchant RUB w1megafonr mobileretails_w1_merchant_rub Mobile retails Wallet One Merchant RUB w1cashtermin alr mts_w1_merchant_rub MTS Wallet One Merchant RUB w1mtsr qiwiwallet_w1_merchant_rub Qiwi Wallet Wallet One Merchant RUB w1qiwir ruspost_w1_merchant_rub Post of Russia Wallet One Merchant RUB w1ruspostr rusterminal_w1_merchant_rub Russian terminals Wallet One Merchant RUB w1terminalr unistream_w1_merchant_rub UNIStream Wallet One Merchant RUB w1unistreamr webmoney_webmoney_merchant_wmb WebMoney WebMoney Merchant WMB webmoneyb webmoney_webmoney_merchant_wme WebMoney WebMoney Merchant WME webmoneye webmoney_webmoney_merchant_wmg WebMoney WebMoney Merchant WMG webmoneyg webmoney_webmoney_merchant_wmr WebMoney WebMoney Merchant WMR webmoneyr webmoney_webmoney_merchant_wmu WebMoney WebMoney Merchant WMU webmoneyu webmoney_webmoney_merchant_wmz WebMoney WebMoney Merchant WMZ webmoneyz nsmep_smartpay_invoice_uah NSMEP SmartPay Invoicing UAH nsmep yandexmoney_yandexmoney_merchant_ rub Yandex.Money Yandex.Mone y Merchant RUR yandexdengir zpayment_zpayment_merchant_rub Z-payment Z-payment Merchant ZP RUB zpaymentr www.interkassa.com Страница 22 sbrf_rusbank_receipt_rub Sberbank RF Russian Bank Invoice RUB webmoney_webmoney_invoice_wmz WebMoney WebMoney Invoicing WMZ webmoney_webmoney_invoice_wmu WebMoney WebMoney Invoicing WMU webmoney_webmoney_invoice_wmr WebMoney WebMoney Invoicing WMR webmoney_webmoney_invoice_wmg WebMoney WebMoney Invoicing WMG webmoney_webmoney_invoice_wme WebMoney WebMoney Invoicing WME webmoney_webmoney_invoice_wmb WebMoney WebMoney Invoicing WMB webcreds_webcreds_merchant_rub WebCreds WebCreds Merchant RUB webcreds w1_w1_merchant_usd Wallet One Wallet One Merchant USD w1z w1_w1_merchant_uah Wallet One Wallet One Merchant UAH w1u w1_w1_merchant_rub Wallet One Wallet One Merchant RUB w1r w1_w1_merchant_eur Wallet One Wallet One Merchant EUR w1e visa_liqpay_merchant_usd Visa LiqPay Merchant USD liqpaycardwz visa_liqpay_merchant_rub Visa LiqPay Merchant RUB liqpaycardwr visa_liqpay_merchant_eur Visa LiqPay Merchant EUR liqpaycardwe ukrbank_ukrbank_receipt_uah Ukrainian Bank Ukrainian Bank Invoice UAH ukrbank ukash_w1_merchant_usd Ukash Wallet One Merchant USD w1ukashz rusbank_rusbank_receipt_rub Russian Bank Russian Bank Invoice RUB rusbank rbkmoney_rbkmoney_merchant_rub RBK Money RBK Money Merchant RUB rbkmoney privat24_privat24_merchant_usd Privat24 Privat24 Merchant USD privat24z privat24_privat24_merchant_uah Privat24 Privat24 Merchant UAH privat24u privat24_privat24_merchant_eur Privat24 Privat24 Merchant EUR privat24e perfectmoney_perfectmoney_merchant_ usd PerfectMoney PerfectMoney Merchant USD perfectmoneyz perfectmoney_perfectmoney_merchant_ eur PerfectMoney PerfectMoney Merchant EUR perfectmoney e moneymail_moneymail_merchant_usd MoneyMail MoneyMail Merchant USD moneymailz moneymail_moneymail_merchant_rub MoneyMail MoneyMail Merchant RUB moneymailr moneymail_moneymail_merchant_eur MoneyMail MoneyMail Merchant EUR moneymaile monexy_monexy_merchant_usd MoneXy MoneXy Merchant USD monexyz monexy_monexy_merchant_uah MoneXy MoneXy Merchant UAH monexyu monexy_monexy_merchant_rub MoneXy MoneXy Merchant RUR monexyr www.interkassa.com Страница 23 sbrf monexy_monexy_merchant_eur MoneXy MoneXy Merchant EUR monexye mastercard_liqpay_merchant_usd Mastercard LiqPay Merchant USD liqpaycardwz mastercard_liqpay_merchant_rub Mastercard LiqPay Merchant RUB liqpaycardwr mastercard_liqpay_merchant_eur Mastercard LiqPay Merchant EUR liqpaycardwe liqpay_liqpay_merchant_usd LiqPay LiqPay Merchant USD liqpayz liqpay_liqpay_merchant_uah LiqPay LiqPay Merchant UAH liqpayu liqpay_liqpay_merchant_rub LiqPay LiqPay Merchant RUB liqpayr liqpay_liqpay_merchant_eur LiqPay LiqPay Merchant EUR liqpaye libertyreserve_libertyreserve_merchant_ usd Liberty Reserve Liberty Reserve Merchant USD libertyz libertyreserve_libertyreserve_merchant_ eur Liberty Reserve Liberty Reserve Merchant EUR libertye eurobank_eurobank_receipt_usd Wire Transfer Wire Transfer Invoice USD eurobank paypal_paypal_merchant_usd Paypal Paypal Merchant USD paypal alfaclick_w1_merchant_rub Alfasclick (Alfabank) Wallet One Merchant RUB w1alfaclick interkassa_interkassa_voucher_usd Interkassa Interkassa Voucher USD pincodez visa_liqpay_merchant_uah Visa LiqPay Merchant UAH liqpaycardu mastercard_liqpay_merchant_uah Mastercard LiqPay Merchant UAH liqpaycardu rbkmoney_rbkmoney_merchantx_rub RBK Money RBK Money Merchant RUB rbkmoneyx telemoney_telemoney_merchant_rub Telemoney Telemoney Merchant RUR telemoneyr ukrterminal_w1_terminal_uah Terminals of Ukraine Wallet One Terminal UAH w1terminalu test_interkassa_test_xts Test payment system Interkassa Test XTS 7. Notes Electronic digital signature Billing Processing Codes List of HTTP status codes 8. Links Hash generator Generator of payment form request Interkassa API documentation IP addresses of Interkassa www.interkassa.com Страница 24 Currency codes Interkassa tariffs Directory of payment methods Examples of using History of payment and no commission returns Security questions Examples of implementation of connecting in different programming languages 9. List of changes v0.1: new documentation of SCI protocol v0.8: added chapter "Advanced features" www.interkassa.com Страница 25