By using token retrieval services, merchants obtain a unique token by ensuring that the customer card information they send in the transaction is securely encrypted on Garanti Bank servers without creating a payment. During the service call, validation checks are performed for the card from which the token is obtained. If the card is eligible for authorization, the token information generated as a result of the transaction is returned to the merchant in the response message.
For token purchase transactions sent with bank cards other than Garanti Bank cards, a sale transaction of 0.11 TL is made by the system for each token purchase transaction for card validation. If the sale transaction is successful, a token value is generated for the card and the sale transaction of 0.11 TL is automatically canceled. This transaction is not displayed on the cardholder's e-statement.
Merchants should store the token information returned in the service response by associating it with customer data (e.g. registration number, customer number, etc.) for later use in payment transactions.
The token information generated on Garanti Bank servers instead of the card information or customer information sent in the transaction is stored in a form associated with the merchant. The management and use of tokens belongs to the merchant.
The TEST BASE URL to be used for testing Card Storage and Switch services is as follows:
TEST BASE URL: https://gbtaksimtunel-integration.garanti.com.tr/
Note: This TEST BASE URL represents the virtual environment offered by Garanti Bank and is intended to be used for testing purposes instead of real transactions. Transactions in this environment do not have real financial implications as in a live environment and only work through test scenarios.
The test environment allows to test the performance and reliability of the application by simulating different scenarios and error conditions. It can also be used to verify that API requests and responses are processed correctly.
During testing, it is important to understand how to react to potential error situations, how to handle errors and how to ensure that the system is working correctly. Testing is also important for security and compliance, and a successful testing phase must be achieved before going live.
It should be noted that errors in the test environment may be temporary. The development team should prefer to contact ETicaretDestek@garantibbva.com.tr support units in case possible errors recur frequently. In this way, problems will be solved more quickly and effectively, ensuring that the testing process proceeds efficiently. Successful testing contributes greatly to the safe and smooth transition of the application and systems to the live environment.
The following information can be used to send in API requests in the test environment. These values will be used in all request types:
Title | Value |
---|---|
Switch ID: | CC82C381E078482AB328943FCCB7100C |
Switch Şifresi: | 123asdASD@ |
This is the authentication information that will be used to test the Card Storage and Switch APIs. Care must be taken to use these credentials correctly in order to perform the tests successfully and get accurate results. Making sure that API requests are made with these credentials is important for the reliability and success of the tests.
In order to send requests with real data in the production environment of the merchant, after the integration is completed in the test environment, the merchant must obtain the Switch ID value by sending the Garanti Sanalpos terminal number to ETicaretDestek@garantibbva.com.tr.
Based on the obtained Switch ID value, the hash data created for security purposes in API requests must be calculated. This hash data must also include the Switch Password of the merchant. Details about the hash calculation will be explained in the following sections.
The Switch Password of the member workplace must be created under the Password Update menu on the management screens of the member workplace. This process is performed by the member workplace admin user.
Detailed information about creating a Switch Password can be found under the "Password Update" heading. In this way, merchants can securely make API requests with real data and successfully complete the GarantiBBVA Switch integration.
In all JSON API requests to the card storage and Switch system, the Request Header field must be sent completely. With these fields, the fields in the related transaction are checked and it is checked whether the data sent is valid or not. The response header field will be returned in the JSON API response information of all of the aforementioned requests. Content-Type of all JSON API requests must be application/json type. Again, the encoding of all JSON API requests must be in UTF-8 format.
Request Header tag and the parameters to be sent under it are as follows:
Field | Type | Requirement | Length | Description |
---|---|---|---|---|
requestId | String | Yes | Max 36 Character | The unique ID value generated for each transaction. |
swtId | String | Yes | Max 36 Character | This is the field where the switch ID value defined on behalf of the workplace or company performing the operation is sent. In tests, the swtId transmitted in the upper segment can be used. For the Prod environment, the swtId defined for the workplace should be used. |
timestamp | String | Yes | - | Transaction time is sent in this field. |
userId | String | Yes | Max 36 Character | This is the field where the ID value of the user who performed the transaction is sent. Any data can be sent, but it is recommended to be a workplace specific value. The purpose of this data is to distinguish which person or system is handling the request. |
hashedData | String | Yes | - | By the workplace JSON API Request Hash Calculation Example The value generated by calculating the hash according to the criteria given under the heading is sent in this field. |
The Response Header tag and the parameters to be returned under it are as follows:
Field | Type | Description |
---|---|---|
requestId | String | It is the unique ID value generated for each transaction. It will hold the same value as the field sent in the request header. |
swtId | String | This is the field where the switch ID value defined on behalf of the workplace or company performing the transaction is sent. It will hold the same value as the field sent in the request header. |
timestamp | Timestamp | The transaction time is sent in this field. The value here is the timestamp of the transaction in the Card Storage and Switch system. |
userId | String | The transaction time is sent in this field. The value here is the timestamp of the transaction in the Card Storage and Switch system. |
hashedData | String | JSON API Response Hash Calculation Example A hash is calculated according to the criteria given under the heading and the generated value is sent in this field. |
In all JSON API responses, in addition to the header field, a Map called errorMap is returned outside the header field, which indicates whether the fields sent in the request contain data errors.
Field | Type | Description |
---|---|---|
errorMap | Map<String, String> | It tells whether the fields sent in the request contain a data error. |
One of the fields that must be sent when paying with 3D is hashedData. In this field, the hash value generated using certain fields in the content of the 3D request sent must be fed. In the hash value calculation, the following parameters sent in the request must be concatenated as String side by side and the password value generated for the Switch user must be put into the calculation. The final String value obtained is used for hash calculation using SHA256 algorithm. The String produced as a result of the hash is converted to uppercase letters and fed into the hashedData field. The method and example are as follows:
The sample response header information and the hash calculation method for this information to verify the hashedData parameter in the response returned in the transaction results are as follows:
The "timestamp" field in the Response is returned as Unix Timestamp, but this value must be used in String format for hash calculation. Therefore, the Unix Timestamp value must be converted to String format.
The following steps are followed for HashedData calculation:
The hashedData value is the same as the value specified in the sample response header. In this way, the correctness of the hashedData value in API responses can be verified and data integrity is ensured.
By sending a request with the HTML POST method via 3D streaming, token retrieval operations can be performed for all bank cards to the Switch module only through the Garanti Bank virtual platform.
In the HTML form to be prepared by the merchant, the addresses and form fields to send the POST request are as follows. Each of the fields must be sent as String.
Field | Requirement | Length | Description |
---|---|---|---|
swtId | Yes | Max 36 Character | This is the field where the Switch ID value defined on behalf of the workplace or company that performs the transaction is sent. |
requestId | Yes | Max 36 Character | The unique ID value generated for each transaction. |
level | Yes | - | It is the model information that determines whether the transaction will continue to be provisioned after 3D secure. This field must be set as 3D. |
cardNumber | Yes | Min:15 Character Max:30 Character | This is the field where the card number is sent. |
cardExpireYear | Yes | 2 Character | This is the field where the year of the expiration date of the card used in the transaction is sent. |
cardExpireMonth | Yes | 2 Character | This is the field where the month information of the expiration date of the card used in the transaction is sent. |
cardCvv | No | 3 Character | This is the field where the CVV information of the card used in the transaction is sent. |
cardToken | No | Max 32 Character | This is the field where Token ID information is sent. |
orderId | No | Max 36 Character | This is the field where the order number is sent. |
generateOrderId | No | 1 Character | "N" should be sent if the workplace wants the orderId sent in the transaction to be forwarded to the virtual exchange, and "Y" should be sent if the virtual exchange wants to generate a new orderId according to the orderId structure. Switch will generate a new orderId even if the field is not sent at all or the value is null. |
userId | Yes | Max 36 Character | This is the field where the ID value of the user performing the transaction is sent. |
txnType | Yes | - | This is the field where the transaction information is sent. It should be sent as "tokengenerate". |
txnAmount | Yes | - | This is the field where the transaction amount will be sent. Penny separation will be provided with ".". Example: 1.45 |
txnCurrencyCode | Yes | 3 Character | This is the field where exchange rate information is sent. In ISO standards, 3 digit code will be sent. Example: 949 |
txnInstallmentCount | No | Max 3 Character | This is the field where the number of transaction installments will be sent. |
companyName | No | Max 64 Character | There will be workplace name information to be used in page displays. |
successUrl | Yes | - | The address of the workplace where the successful transaction response will be returned will be included in this field. |
failureUrl | Yes | - | The address of the workplace where the erroneous transaction response will be returned will be included in this field. |
txnMotoInd | No | 1 Character | This is the field where information is sent whether the transaction is a mail order transaction or not. If 'Y', it will be perceived as a mail order transaction. |
txnTimestamp | Yes | - | Transaction time is sent in this field. |
lang | Yes | - | This is the field where the language information is sent. "en" value is expected to be sent. |
refreshTime | Yes | - | This field is used when there is a page display on the bank side. 5 value must be sent. |
customerName | No | Max 50 Character | The name of the cardholder will be included. |
customerLastName | No | Max 50 Character | cardholder's surname information will be included. |
customerGsm | No | Max 16 Character | GSM information of the cardholder will be included. |
customerIp | Yes | Max 20 Character | The cardholder's IP information will be included. It must be in ipv4 format. |
customerEmail | Yes | Max 128 Character | The cardholder's email information will be included. |
customerNationalNumber | No | Max 20 Character | The cardholder's TR ID number will be included. |
acqId | Yes | - | This field is used if the transaction is to be sent through the virtualpos of a specific bank. Ids corresponding to the following numbers should be used for the desired Virtualpos. Bank Code and Name: 64: İŞ BANK A.Ş. 62: T. GARANTİ BANKASI A.Ş. 46: AKBANK T.A.Ş. 111: QNB FINANSBANK A.Ş. 10: T.C. ZİRAAT BANKASI A.Ş. 12: T. HALK BANKASI A.Ş. 67: YAPI KREDİ BANK |
hashedData | Yes | - | Payment Request Hash Calculation with 3D It will be created by the workplace in accordance with the criteria described under the heading and sent within the request. |
shippingAddress.name | No | Max 50 Character | The name information of the person belonging to the cargo address will be included. |
shippingAddress.lastName | No | Max 50 Character | The surname information of the person belonging to the shipping address will be included. |
shippingAddress.companyName | No | Max 64 Character | The company name of the shipping address will be included. |
shippingAddress.city | No | Max 50 Character | The city name of the shipping address will be included. |
shippingAddress.country | No | Max 50 Character | The country name of the shipping address will be included. |
shippingAddress.zipCode | No | Max 16 Character | The postal code information of the shipping address will be included. |
shippingAddress.addressDetail | No | Max 256 Character | The detailed address field information of the shipping address will be included. |
shippingAddress.phone | No | Max 36 Character | Phone information of the shipping address will be included. |
shippingAddress.gsm | No | Max 16 Character | GSM information of the shipping address will be included. |
shippingAddress.email | No | Max 128 Character | Mail information of the shipping address will be included. |
billingAddress.name | No | Max 50 Character | The name of the person belonging to the invoice address will be included. |
billingAddress.lastName | No | Max 50 Character | The surname information of the person belonging to the invoice address will be included. |
billingAddress.companyName | No | Max 64 Character | The company name of the invoice address will be included. |
billingAddress.city | No | Max 50 Character | The city name of the shipping address will be included. |
billingAddress.country | No | Max 50 Character | The country name of the shipping address will be included. |
billingAddress.zipCode | No | Max 16 Character | The postal code information of the shipping address will be included. |
billingAddress.addressDetail | No | Max 256 Character | The detailed address field information of the shipping address will be included. |
billingAddress.phone | No | Max 36 Character | Phone information of the shipping address will be included. |
billingAddress.gsm | No | Max 16 Character | GSM information of the shipping address will be included. |
billingAddress.email | No | Max 128 Character | Mail information of the shipping address will be included. |
hashVersion | Yes | - | It should be sent as "2.0". |
3D Secure response message will be POSTed as HTML Form by Switch 3D Secure Gateway to the successUrl or failureUrl addresses sent by the merchant in the request message together with the data set below.
Field | Description |
---|---|
swtId | This is the field where SwitchID information is returned. |
requestId | This is the field where the unique ID information sent by the workplace during the request is returned. |
txnId | This is the field where transaction ID information is returned. |
orderId | This is the field where the order number is returned. |
returnCode | Switch It is a field where information about the response code is returned. |
reasonCode | It is a field where information about the Switch Sub Answer code is returned. |
message | The field where the answer description is returned. |
installmentCount | This is the field where the number of installments is returned. |
txnAmount | This is the field where the transaction amount is returned. |
currencyCode | This is the field where the currency type is returned. |
maskedNumber | This is the field where the masked card number will be returned. |
acquirerId | This is the field where the bank ID information is returned. |
acquirerName | This is the field where the name of the bank from which provision is received is returned. |
orderId | This is the field where the order number is returned. |
hashedData | This is the field where the response hash information is returned. The merchant is expected to verify the hash value returned in this field by calculating it. Payment Response Hash Calculation with 3D The calculation must be made by the workplace in accordance with the criteria described under the heading. |
terminalId | is the field where the terminal information is returned. |
merchantId | This is the field where the workplace number is returned. |
authCode | This is the field where the approval code is returned in approved provision transactions. |
successUrl | This is the field where the successful transaction URL of the workplace is returned. |
failureUrl | This is the field where the failed transaction URL of the workplace is returned. |
approved | This is the field where the information about whether the transaction is approved or not is returned. |
retrefNum | This is the field where the unique transaction number on the bank side is returned. |
response | This is the field where the result information of the Switch application is returned. |
mdErrorMessage | This is the field where the MD response message is returned as a result of 3D secure verification. |
eci | This is the field where the ECI value received as a result of 3D secure verification is returned. |
cavv | This is the field where the CAVV value received as a result of 3D secure verification is returned. |
md | This is the field where the MD value received as a result of 3D secure verification is returned. |
xid | This is the field where the XID value received as a result of 3D secure verification is returned. |
mdStatus | This is the field where the MD STATUS value received as a result of 3D secure verification is returned. |
acqReturnCode | This is the field where the response code generated by the merchant bank is returned. |
acqReasonCode | This is the field where the sub answer code generated by the merchant bank is returned. |
sec3DTokenResCode | This is the area where the response code of receiving token with 3D secure verification is returned. |
sec3DTokenRetCode | This is the field where the sub-answer code of receiving token with 3D secure verification is returned. |
additionalData | Returns the additionalData value sent in the token retrieval request. |
expireDate | This is the field where the card SKT information is returned in mmYYY format. |
sec3DTokenResMessage | This is the area where the response message of receiving a token with 3D secure verification is returned. |
token | This is the field where token information is returned if the token is generated after the 3D secure verification is successfully completed. |
vposOrderId | The orderid value generated by the Switch if generateOrderId was sent as Y or empty in the request message, or if this field was not sent at all. |
A sample HTML form for token retrieval with 3D streaming is given below in HTML Table format. After the fields here are filled in as desired, the 3D request hash calculation is made and set in the hashedData field, the token retrieval/token update request can be triggered with 3D by submitting the form to the test or prod url given below. POSTed data must be application/x-www- form-urlencoded type.
Below are links to custom code examples written in various programming languages. You can examine the codes written with predetermined values in detail through the link of your preferred programming language.
These examples contain code for the relevant operation type and are written in different languages, so you can observe various approaches and practices. In this way, you can find the opportunity to work with more understandable and authentic examples of your preferred programming language.
Click for C# Code Examples.
Click for VB.Net Code Examples.
Click here for Java Code Examples.
Click here for PHP Code Examples.
Please note that these examples are written with predefined values and may require adaptation and security measures for use in real projects.
You can find the list of test cards on this page.
We would love to hear from you. Do you have problems/questions about services ? Send us detailed email about it ?
Send Us a Question Send Us a Question